1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-13 05:39:59 +00:00

fix: face recognition toolbar (#6927)

Co-authored-by: 杨国璇 <ygx@Hello-word.local>
This commit is contained in:
杨国璇
2024-10-21 15:37:50 +08:00
committed by GitHub
parent 4ce79038b9
commit a5953c51d6
3 changed files with 8 additions and 3 deletions

View File

@@ -11,6 +11,7 @@ import ReposSortMenu from '../../components/repos-sort-menu';
import MetadataViewToolBar from '../../metadata/components/view-toolbar';
import { PRIVATE_FILE_TYPE } from '../../constants';
import { DIRENT_DETAIL_MODE } from '../dir-view-mode/constants';
import { FACE_RECOGNITION_VIEW_ID } from '../../metadata/constants';
const propTypes = {
repoID: PropTypes.string.isRequired,
@@ -117,6 +118,7 @@ class DirTool extends React.Component {
});
if (isFileExtended) {
if (viewId === FACE_RECOGNITION_VIEW_ID) return null;
return (
<div className="dir-tool">
<MetadataViewToolBar viewId={viewId} isCustomPermission={isCustomPermission} showDetail={this.showDirentDetail} />

View File

@@ -9,6 +9,8 @@ export const VIEW_TYPE = {
GALLERY: 'gallery',
};
export const FACE_RECOGNITION_VIEW_ID = '_face_recognition';
export const VIEW_TYPE_ICON = {
[VIEW_TYPE.TABLE]: 'table',
[VIEW_TYPE.GALLERY]: 'image',

View File

@@ -4,6 +4,7 @@ import { Utils } from '../../utils/utils';
import toaster from '../../components/toast';
import { gettext } from '../../utils/constants';
import { PRIVATE_FILE_TYPE } from '../../constants';
import { FACE_RECOGNITION_VIEW_ID } from '../constants';
// This hook provides content related to seahub interaction, such as whether to enable extended attributes, views data, etc.
const MetadataContext = React.createContext(null);
@@ -82,8 +83,8 @@ export const MetadataProvider = ({ repoID, hideMetadataView, selectMetadataView,
viewsMap.current[view._id] = view;
});
}
viewsMap.current['_face_recognition'] = {
_id: '_face_recognition',
viewsMap.current[FACE_RECOGNITION_VIEW_ID] = {
_id: FACE_RECOGNITION_VIEW_ID,
name: gettext('Photos - classfied by people'),
type: PRIVATE_FILE_TYPE.FACE_RECOGNITION,
};
@@ -119,7 +120,7 @@ export const MetadataProvider = ({ repoID, hideMetadataView, selectMetadataView,
setStaticView([]);
return;
}
setStaticView([{ _id: '_face_recognition', type: 'view' }]);
setStaticView([{ _id: FACE_RECOGNITION_VIEW_ID, type: 'view' }]);
}, [enableFaceRecognition]);
const selectView = useCallback((view, isSelected) => {