Skip to content

armgit / ente

Public Imported from GitHub
0

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

Cleanup

Manav Rathib00009aaab05
diff --git a/web/apps/photos/src/components/Collections/CollectionSelector.tsx b/web/apps/photos/src/components/Collections/CollectionSelector.tsx
index 82cd320868..12109da32a 100644
--- a/web/apps/photos/src/components/Collections/CollectionSelector.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionSelector.tsx
@@ -6,9 +6,9 @@ import {
LargeTileTextOverlay,
} from "@/new/photos/components/ItemCards";
import {
+ canAddToCollection,
+ canMoveToCollection,
CollectionSummaryOrder,
- isAddToAllowedCollection,
- isMoveToAllowedCollection,
type CollectionSummaries,
type CollectionSummary,
} from "@/new/photos/services/collection/ui";
@@ -88,23 +88,21 @@ export const CollectionSelector: React.FC<CollectionSelectorProps> = ({
} else if (
attributes.intent === CollectionSelectorIntent.add
) {
- return isAddToAllowedCollection(type);
+ return canAddToCollection(type);
} else if (
attributes.intent === CollectionSelectorIntent.upload
) {
return (
- isMoveToAllowedCollection(type) ||
- type == "uncategorized"
+ canMoveToCollection(type) || type == "uncategorized"
);
} else if (
attributes.intent === CollectionSelectorIntent.restore
) {
return (
- isMoveToAllowedCollection(type) ||
- type == "uncategorized"
+ canMoveToCollection(type) || type == "uncategorized"
);
} else {
- return isMoveToAllowedCollection(type);
+ return canMoveToCollection(type);
}
})
.sort((a, b) => {
diff --git a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
index 0d1bf71eda..d45aab5330 100644
--- a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
+++ b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
@@ -1,9 +1,4 @@
import type { Collection } from "@/media/collection";
-import {
- hasNonSystemCollections,
- isSystemCollection,
- shouldBeShownOnCollectionBar,
-} from "@/new/photos/services/collection/ui";
import {
GalleryBarImpl,
type GalleryBarImplProps,
@@ -11,6 +6,9 @@ import {
import { PeopleHeader } from "@/new/photos/components/Gallery/PeopleHeader";
import {
collectionsSortBy,
+ hasNonSystemCollections,
+ isSystemCollection,
+ shouldShowOnCollectionBar,
type CollectionsSortBy,
type CollectionSummaries,
} from "@/new/photos/services/collection/ui";
@@ -212,7 +210,7 @@ export const GalleryBarAndListHeader: React.FC<CollectionsProps> = ({
onChangeCollectionsSortBy={setCollectionsSortBy}
onShowAllCollections={() => setOpenAllCollectionDialog(true)}
collectionSummaries={sortedCollectionSummaries.filter((x) =>
- shouldBeShownOnCollectionBar(x.type),
+ shouldShowOnCollectionBar(x.type),
)}
/>
diff --git a/web/packages/new/photos/services/collection/ui.ts b/web/packages/new/photos/services/collection/ui.ts
index 62418b1fd7..b17c48b1d0 100644
--- a/web/packages/new/photos/services/collection/ui.ts
+++ b/web/packages/new/photos/services/collection/ui.ts
@@ -77,7 +77,7 @@ export const CollectionSummaryOrder = new Map<CollectionSummaryType, number>([
["defaultHidden", 7],
]);
-const SYSTEM_COLLECTION_TYPES = new Set<CollectionSummaryType>([
+const systemCSTypes = new Set<CollectionSummaryType>([
"all",
"archive",
"trash",
@@ -86,7 +86,7 @@ const SYSTEM_COLLECTION_TYPES = new Set<CollectionSummaryType>([
"defaultHidden",
]);
-const ADD_TO_NOT_ALLOWED_COLLECTION = new Set<CollectionSummaryType>([
+const addToDisabledCSTypes = new Set<CollectionSummaryType>([
"all",
"archive",
"incomingShareViewer",
@@ -96,7 +96,7 @@ const ADD_TO_NOT_ALLOWED_COLLECTION = new Set<CollectionSummaryType>([
"hiddenItems",
]);
-const MOVE_TO_NOT_ALLOWED_COLLECTION = new Set<CollectionSummaryType>([
+const moveToDisabledCSTypes = new Set<CollectionSummaryType>([
"all",
"archive",
"incomingShareViewer",
@@ -107,7 +107,7 @@ const MOVE_TO_NOT_ALLOWED_COLLECTION = new Set<CollectionSummaryType>([
"hiddenItems",
]);
-const HIDE_FROM_COLLECTION_BAR_TYPES = new Set<CollectionSummaryType>([
+const hideFromCollectionBarCSTypes = new Set<CollectionSummaryType>([
"trash",
"archive",
"uncategorized",
@@ -123,18 +123,14 @@ export const hasNonSystemCollections = (
return false;
};
-export const isMoveToAllowedCollection = (type: CollectionSummaryType) => {
- return !MOVE_TO_NOT_ALLOWED_COLLECTION.has(type);
-};
+export const canMoveToCollection = (type: CollectionSummaryType) =>
+ !moveToDisabledCSTypes.has(type);
-export const isAddToAllowedCollection = (type: CollectionSummaryType) => {
- return !ADD_TO_NOT_ALLOWED_COLLECTION.has(type);
-};
+export const canAddToCollection = (type: CollectionSummaryType) =>
+ !addToDisabledCSTypes.has(type);
-export const isSystemCollection = (type: CollectionSummaryType) => {
- return SYSTEM_COLLECTION_TYPES.has(type);
-};
+export const isSystemCollection = (type: CollectionSummaryType) =>
+ systemCSTypes.has(type);
-export const shouldBeShownOnCollectionBar = (type: CollectionSummaryType) => {
- return !HIDE_FROM_COLLECTION_BAR_TYPES.has(type);
-};
+export const shouldShowOnCollectionBar = (type: CollectionSummaryType) =>
+ !hideFromCollectionBarCSTypes.has(type);