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

feat: rename face recognition view (#7164)

* feat: rename face recognition view

* feat: optimize code

---------

Co-authored-by: 杨国璇 <ygx@Hello-word.local>
This commit is contained in:
杨国璇
2024-12-09 14:13:37 +08:00
committed by GitHub
parent 3918b093fa
commit 3f6c4f3d26
4 changed files with 35 additions and 19 deletions

View File

@@ -7,6 +7,7 @@ import { PRIVATE_FILE_TYPE } from '../../constants';
import { FACE_RECOGNITION_VIEW_ID, VIEW_TYPE } from '../constants';
import { useMetadataStatus } from '../../hooks';
import { updateFavicon } from '../utils/favicon';
import { getViewName } from '../utils/view';
// This hook provides content related to seahub interaction, such as whether to enable extended attributes, views data, etc.
const MetadataContext = React.createContext(null);
@@ -30,7 +31,7 @@ export const MetadataProvider = ({ repoID, currentPath, repoInfo, hideMetadataVi
const { navigation, views } = res.data;
if (Array.isArray(views)) {
views.forEach(view => {
viewsMap.current[view._id] = view;
viewsMap.current[view._id] = { ...view, name: getViewName(view) };
});
}
setNavigation(navigation);
@@ -91,7 +92,7 @@ export const MetadataProvider = ({ repoID, currentPath, repoInfo, hideMetadataVi
const view = res.data.view;
let newNavigation = navigation.slice(0);
newNavigation.push({ _id: view._id, type: 'view' });
viewsMap.current[view._id] = view;
viewsMap.current[view._id] = { ...view, name: getViewName(view) };
setNavigation(newNavigation);
selectView(view);
successCallback && successCallback();
@@ -156,7 +157,7 @@ export const MetadataProvider = ({ repoID, currentPath, repoInfo, hideMetadataVi
if (newValue === enableFaceRecognition) return;
if (newValue) {
toaster.success(gettext('Recognizing portraits. Please refresh the page later.'));
addView(gettext('Photos - classified by people'), VIEW_TYPE.FACE_RECOGNITION, () => {}, () => {});
addView('_people', VIEW_TYPE.FACE_RECOGNITION, () => {}, () => {});
} else {
if (viewsMap.current[FACE_RECOGNITION_VIEW_ID]) {
let isSelected = false;