mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-12 21:30:39 +00:00
fix: face recognition toolbar (#6927)
Co-authored-by: 杨国璇 <ygx@Hello-word.local>
This commit is contained in:
@@ -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} />
|
||||
|
@@ -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',
|
||||
|
@@ -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) => {
|
||||
|
Reference in New Issue
Block a user