π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Move
Manav Rathi18ebc485dfea
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsxindex 7b9925dfeb..1ea326ea1a 100644--- a/web/apps/photos/src/pages/gallery.tsx+++ b/web/apps/photos/src/pages/gallery.tsx@@ -49,7 +49,6 @@ import {setSearchCollectionsAndFiles,} from "@/new/photos/services/search";import type { SearchOption } from "@/new/photos/services/search/types";-import type { FamilyData } from "@/new/photos/services/user";import { AppContext } from "@/new/photos/types/context";import { ensure } from "@/utils/ensure";import { wait } from "@/utils/promise";@@ -191,7 +190,6 @@ export const GalleryContext = createContext<GalleryContextType>(*/export default function Gallery() {const [state, dispatch] = useGalleryReducer();- const [familyData, setFamilyData] = useState<FamilyData>(null);const [collections, setCollections] = useState<Collection[]>(null);const [hiddenCollections, setHiddenCollections] =useState<Collection[]>(null);@@ -351,6 +349,10 @@ export default function Gallery() {const { show: showWhatsNew, props: whatsNewVisibilityProps } =useModalVisibility();+ // TODO: Temp+ const user = state.user;+ const familyData = state.familyData;+const router = useRouter();// Ensure that the keys in local storage are not malformed by verifying that@@ -403,8 +405,7 @@ export default function Gallery() {await splitNormalAndHiddenCollections(collections);const trashedFiles = await getLocalTrashedFiles();- setUser(user);- setFamilyData(familyData);+ dispatch({ type: "mount", user, familyData });setFiles(files);setTrashedFiles(trashedFiles);setHiddenFiles(hiddenFiles);diff --git a/web/apps/photos/src/types/user/index.ts b/web/apps/photos/src/types/user/index.tsindex 0073740d09..ca407980f8 100644--- a/web/apps/photos/src/types/user/index.ts+++ b/web/apps/photos/src/types/user/index.ts@@ -1,6 +1,6 @@+import type { FamilyData } from "@/new/photos/services/user";import { Subscription } from "types/billing";-export interface Bonus {storage: number;type: string;diff --git a/web/packages/new/photos/components/gallery/reducer.ts b/web/packages/new/photos/components/gallery/reducer.tsindex 3091ece7f1..0743542a4a 100644--- a/web/packages/new/photos/components/gallery/reducer.ts+++ b/web/packages/new/photos/components/gallery/reducer.ts@@ -29,6 +29,7 @@ import {isPinnedCollection,} from "../../services/magic-metadata";import type { Person } from "../../services/ml/people";+import type { FamilyData } from "../../services/user";/*** Derived UI state backing the gallery.@@ -50,8 +51,7 @@ export interface GalleryState {/*** Family plan related information for the logged in {@link User}.*/- familyData: Fami, setFamilyData] = useState<FamilyData>(null);-+ familyData: FamilyData | undefined;filteredData: EnteFile[];/**@@ -74,9 +74,10 @@ export interface GalleryState {// TODO: dummy actions for gradual migration to reducersexport type GalleryAction =| {- type: "mount",- user: User,- }+ type: "mount";+ user: User;+ familyData: FamilyData;+ }| {type: "set";filteredData: EnteFile[];@@ -85,12 +86,16 @@ export type GalleryAction =| undefined;}| { type: "setDerived"; favFileIDs: Set<number> }- | { type: "setFavorites"; favFileIDs: Set<number> }- | { type: "setNormalAndHiddenCollections";- normalCollections: Collection[]; hiddenCollections: Collection[]; };+ | { type: "setFavorites"; favFileIDs: Set<number> };+// | {+// type: "setNormalAndHiddenCollections";+// normalCollections: Collection[];+// hiddenCollections: Collection[];+// };const initialGalleryState: GalleryState = {user: undefined,+ familyData: undefined,filteredData: [],favFileIDs: new Set(),activePerson: undefined,@@ -105,8 +110,9 @@ const galleryReducer: React.Reducer<GalleryState, GalleryAction> = (case "mount":return {...state,- user: action.user- }+ user: action.user,+ familyData: action.familyData,+ };case "set":return {...state,