Person mode - 1

This commit is contained in:
Manav Rathi
2024-09-18 19:26:11 +05:30
parent dcca546e5a
commit a14160f799

View File

@@ -15,6 +15,7 @@ import {
getLocalTrashedFiles,
} from "@/new/photos/services/files";
import { wipHasSwitchedOnceCmpAndSet } from "@/new/photos/services/ml";
import type { Person } from "@/new/photos/services/ml/cgroups";
import {
filterSearchableFiles,
setSearchCollectionsAndFiles,
@@ -314,23 +315,25 @@ export default function Gallery() {
const closeAuthenticateUserModal = () =>
setAuthenticateUserModalView(false);
// `true` if we're displaying the hidden section.
//
// - The search bar is replaced by a navbar with a back button.
// - The collections bar shows only the hidden collections.
// - The gallery itself shows hidden items.
const [isInHiddenSection, setIsInHiddenSection] = useState(false);
// If set, then display files belonging to this person.
//
// - The search bar is replaced by a navbar with a back button.
// - The collections bar is hidden.
// - The gallery itself shows files which contain this person.
const [person, setPerson] = useState<Person | undefined>();
const [
filesDownloadProgressAttributesList,
setFilesDownloadProgressAttributesList,
] = useState<FilesDownloadProgressAttributes[]>([]);
const openHiddenSection: GalleryContextType["openHiddenSection"] = (
callback,
) => {
authenticateUser(() => {
setIsInHiddenSection(true);
setActiveCollectionID(HIDDEN_ITEMS_SECTION);
callback?.();
});
};
const [isClipSearchResult, setIsClipSearchResult] =
useState<boolean>(false);
@@ -1010,6 +1013,16 @@ export default function Gallery() {
setExportModalView(false);
};
const openHiddenSection: GalleryContextType["openHiddenSection"] = (
callback,
) => {
authenticateUser(() => {
setIsInHiddenSection(true);
setActiveCollectionID(HIDDEN_ITEMS_SECTION);
callback?.();
});
};
const exitHiddenSection = () => {
setIsInHiddenSection(false);
setActiveCollectionID(ALL_SECTION);