Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Conv

Manav Rathi67e1cddfa170
diff --git a/web/apps/photos/src/components/Sidebar.tsx b/web/apps/photos/src/components/Sidebar.tsx
index c9a8b9ec8b..9c76ba958e 100644
--- a/web/apps/photos/src/components/Sidebar.tsx
+++ b/web/apps/photos/src/components/Sidebar.tsx
@@ -78,12 +78,11 @@ import {
useSettingsSnapshot,
useUserDetailsSnapshot,
} from "ente-new/photos/components/utils/use-snapshot";
+import { DUMMY_UNCATEGORIZED_COLLECTION } from "ente-new/photos/services/collection";
import {
- ARCHIVE_SECTION,
- DUMMY_UNCATEGORIZED_COLLECTION,
- TRASH_SECTION,
-} from "ente-new/photos/services/collection";
-import type { CollectionSummaries } from "ente-new/photos/services/collection-summary";
+ CollectionSummaryID,
+ type CollectionSummaries,
+} from "ente-new/photos/services/collection-summary";
import exportService from "ente-new/photos/services/export";
import { isMLSupported } from "ente-new/photos/services/ml";
import {
@@ -440,8 +439,8 @@ const ShortcutSection: React.FC<ShortcutSectionProps> = ({
collectionSummaries,
}) => {
const galleryContext = useContext(GalleryContext);
- const [uncategorizedCollectionId, setUncategorizedCollectionID] =
- useState<number>();
+ const [uncategorizedCollectionID, setUncategorizedCollectionID] =
+ useState<number>(CollectionSummaryID.uncategorizedPlaceholder);
useEffect(() => {
void getUncategorizedCollection().then((uncat) =>
@@ -452,17 +451,17 @@ const ShortcutSection: React.FC<ShortcutSectionProps> = ({
}, []);
const openUncategorizedSection = () => {
- galleryContext.setActiveCollectionID(uncategorizedCollectionId);
+ galleryContext.setActiveCollectionID(uncategorizedCollectionID);
onCloseSidebar();
};
const openTrashSection = () => {
- galleryContext.setActiveCollectionID(TRASH_SECTION);
+ galleryContext.setActiveCollectionID(CollectionSummaryID.trash);
onCloseSidebar();
};
const openArchiveSection = () => {
- galleryContext.setActiveCollectionID(ARCHIVE_SECTION);
+ galleryContext.setActiveCollectionID(CollectionSummaryID.archiveItems);
onCloseSidebar();
};
@@ -478,7 +477,7 @@ const ShortcutSection: React.FC<ShortcutSectionProps> = ({
startIcon={<CategoryIcon />}
label={t("section_uncategorized")}
caption={collectionSummaries
- .get(uncategorizedCollectionId)
+ .get(uncategorizedCollectionID)
?.fileCount.toString()}
onClick={openUncategorizedSection}
/>
@@ -486,7 +485,7 @@ const ShortcutSection: React.FC<ShortcutSectionProps> = ({
startIcon={<ArchiveOutlinedIcon />}
label={t("section_archive")}
caption={collectionSummaries
- .get(ARCHIVE_SECTION)
+ .get(CollectionSummaryID.archiveItems)
?.fileCount.toString()}
onClick={openArchiveSection}
/>
@@ -507,7 +506,7 @@ const ShortcutSection: React.FC<ShortcutSectionProps> = ({
startIcon={<DeleteOutlineIcon />}
label={t("section_trash")}
caption={collectionSummaries
- .get(TRASH_SECTION)
+ .get(CollectionSummaryID.trash)
?.fileCount.toString()}
onClick={openTrashSection}
/>
diff --git a/web/packages/new/photos/services/collection-summary.ts b/web/packages/new/photos/services/collection-summary.ts
index f796e0588b..8f0d0daff6 100644
--- a/web/packages/new/photos/services/collection-summary.ts
+++ b/web/packages/new/photos/services/collection-summary.ts
@@ -32,7 +32,7 @@ export const CollectionSummaryID = {
*
* It shows the files that the user has individually archived.
*/
- archive: -1,
+ archiveItems: -1,
/**
* Trash
*
@@ -51,18 +51,18 @@ export const CollectionSummaryID = {
* dummy placeholder collection as the {@link CollectionSummary} that gets
* shown if the user navigates to the "Uncategorized" section in the UI.
*/
- placeholderUncategorizedCollection: -3,
+ uncategorizedPlaceholder: -3,
/**
* The default collection shown in the "Hidden" section.
*
* It shows the files that the user has individually hidden; effectively, it
- * works as a consolidated combination of all of the user's "default hidden"
+ * works as a merged combination of all of the user's "default hidden"
* albums (See: Note: Multiple "default" hidden collections]).
*
- * In addition to this "Hidden items" collection, the "Hidden" section also
- * shows albums that were hidden.
+ * In addition to this "Hidden items" pseudo-collection, the "Hidden"
+ * section also shows other albums that were hidden.
*/
- mergedDefaultHiddenCollection: -4,
+ hiddenItems: -4,
} as const;
export const ARCHIVE_SECTION = -1;