Skip to content

armgit / ente

Public Imported from GitHub
0

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

Remove double negation

Manav Rathi535963b2294c
diff --git a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
index d45aab5330..fdc2900fc8 100644
--- a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
+++ b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx
@@ -5,8 +5,8 @@ import {
} from "@/new/photos/components/Gallery/BarImpl";
import { PeopleHeader } from "@/new/photos/components/Gallery/PeopleHeader";
import {
+ areOnlySystemCollections,
collectionsSortBy,
- hasNonSystemCollections,
isSystemCollection,
shouldShowOnCollectionBar,
type CollectionsSortBy,
@@ -122,7 +122,7 @@ export const GalleryBarAndListHeader: React.FC<CollectionsProps> = ({
const shouldBeHidden = useMemo(
() =>
shouldHide ||
- (!hasNonSystemCollections(toShowCollectionSummaries) &&
+ (areOnlySystemCollections(toShowCollectionSummaries) &&
activeCollectionID === ALL_SECTION),
[shouldHide, toShowCollectionSummaries, activeCollectionID],
);
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index ff7243e133..318bab8408 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -16,7 +16,7 @@ import {
import { WhatsNew } from "@/new/photos/components/WhatsNew";
import { shouldShowWhatsNew } from "@/new/photos/services/changelog";
import type { CollectionSummaries } from "@/new/photos/services/collection/ui";
-import { hasNonSystemCollections } from "@/new/photos/services/collection/ui";
+import { areOnlySystemCollections } from "@/new/photos/services/collection/ui";
import downloadManager from "@/new/photos/services/download";
import {
getLocalFiles,
@@ -1264,9 +1264,9 @@ export default function Gallery() {
setShouldDisableDropzone={setShouldDisableDropzone}
setFiles={setFiles}
setCollections={setCollections}
- isFirstUpload={
- !hasNonSystemCollections(collectionSummaries)
- }
+ isFirstUpload={areOnlySystemCollections(
+ collectionSummaries,
+ )}
{...{
dragAndDropFiles,
openFileSelector,
diff --git a/web/packages/new/photos/services/collection/ui.ts b/web/packages/new/photos/services/collection/ui.ts
index b17c48b1d0..3ab3c9ba51 100644
--- a/web/packages/new/photos/services/collection/ui.ts
+++ b/web/packages/new/photos/services/collection/ui.ts
@@ -114,14 +114,9 @@ const hideFromCollectionBarCSTypes = new Set<CollectionSummaryType>([
"defaultHidden",
]);
-export const hasNonSystemCollections = (
+export const areOnlySystemCollections = (
collectionSummaries: CollectionSummaries,
-) => {
- for (const collectionSummary of collectionSummaries.values()) {
- if (!isSystemCollection(collectionSummary.type)) return true;
- }
- return false;
-};
+) => collectionSummaries.values().every(({ type }) => isSystemCollection(type));
export const canMoveToCollection = (type: CollectionSummaryType) =>
!moveToDisabledCSTypes.has(type);