π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
State wip
Manav Rathi41de48c45466
diff --git a/web/packages/new/photos/pages/duplicates.tsx b/web/packages/new/photos/pages/duplicates.tsxindex 39a123586f..c5ebbd681a 100644--- a/web/packages/new/photos/pages/duplicates.tsx+++ b/web/packages/new/photos/pages/duplicates.tsx@@ -1,5 +1,6 @@import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator";import { pt } from "@/base/i18n";+import type { EnteFile } from "@/media/file";import { VerticallyCentered } from "@ente/shared/components/Container";import ArrowBackIcon from "@mui/icons-material/ArrowBack";import MoreHorizIcon from "@mui/icons-material/MoreHoriz";@@ -26,6 +27,78 @@ const Page: React.FC = () => {export default Page;+/**+ * A group of duplicates as shown in the UI.+ */+interface DuplicateGroup {+ /**+ * Files which our algorithm has determined to be duplicates of each other.+ *+ * These are sorted in the order of precedence, such that the first item is+ * the one we'd wish to retain if the user decides to dedup this group.+ */+ items: {+ /** The underlying collection file. */+ file: EnteFile;+ /** The name of the collection to which this file belongs. */+ collectionName: string;+ }[];+ /**+ * The size (in bytes) of each item in the group.+ */+ itemSize: number;+ /**+ * The number of files that will be pruned if the user decides to dedup this group.+ */+ prunableCount: number;+ /**+ * The size (in bytes) that can be saved if the user decides to dedup this group.+ */+ prunableSize: number;+ /**+ * `true` if the user has marked this group for deduping.+ */+ isSelected: boolean;+}++interface DuplicatesState {+ status: "analyzing" | "deleting" | undefined;+ /**+ * Groups of duplicates.+ *+ * Within each group, the files are sorted in the order of precedence such+ * that the first item is the one we'd wish to retain if the user decides to+ * dedup this group.+ *+ * This is the primary source of truth computed after we exit the+ * "analyzing" state. It is used to derive the {@link duplicateGroups}+ * property which the UI then displays.+ */+ duplicates: EnteFile[][];+ /**+ * {@link duplicates} augmented with UI state and various cached properties+ * to make them more amenable to be directly used by the UI component.+ *+ * These are sorted in order of display, reflecting the {@link sortType}+ * user preference.+ */+ duplicateGroups: DuplicateGroup[];+ /**+ * The attribute to use for sorting {@link duplicateGroups}.+ */+ sortType: "prunableCount" | "prunableSize";+ /**+ * The number of files that will be pruned if the user decides to dedup the+ * current selection.+ */+ prunableCount: number;+ /**+ * The size (in bytes) that can be saved if the user decides to dedup the+ * current selection.+ */+ prunableSize: number;+}+const Navbar: React.FC = () => {const router = useRouter();