Skip to content

armgit / ente

Public Imported from GitHub
0

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

Doc

Manav Rathi50f4878d0f0d
diff --git a/web/apps/photos/src/components/Collections/CollectionListBar.tsx b/web/apps/photos/src/components/Collections/CollectionListBar.tsx
index ecd3c26595..7a7a012d13 100644
--- a/web/apps/photos/src/components/Collections/CollectionListBar.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionListBar.tsx
@@ -30,23 +30,46 @@ import CollectionCard from "./CollectionCard";
import CollectionListSortBy from "./CollectionListSortBy";
interface CollectionListBarProps {
- activeCollectionID?: number;
+ /**
+ * `true` if we're currently in the hidden section.
+ */
isInHiddenSection: boolean;
+ /**
+ * The ID of the currently active collection (if any)
+ */
+ activeCollectionID?: number;
+ /**
+ * Called when the user changes the active collection.
+ */
setActiveCollectionID: (id?: number) => void;
- collectionSummaries: CollectionSummary[];
- showAllCollections: () => void;
+ /**
+ * Called when the user selects the option to show a modal with all the
+ * collections.
+ */
+ onShowAllCollections: () => void;
+ /**
+ * The sort order that should be used for showing the collections in the
+ * bar.
+ */
collectionListSortBy: COLLECTION_LIST_SORT_BY;
+ /**
+ * Called when the user changes the sort order.
+ */
setCollectionListSortBy: (v: COLLECTION_LIST_SORT_BY) => void;
+ /**
+ * Massaged data about the collections that should be shown in the bar.
+ */
+ collectionSummaries: CollectionSummary[];
}
export const CollectionListBar: React.FC<CollectionListBarProps> = ({
+ isInHiddenSection,
activeCollectionID,
setActiveCollectionID,
- collectionSummaries,
- showAllCollections,
- isInHiddenSection,
- setCollectionListSortBy,
+ onShowAllCollections,
collectionListSortBy,
+ setCollectionListSortBy,
+ collectionSummaries,
}) => {
const windowSize = useWindowSize();
const isMobile = useIsMobileWidth();
@@ -135,7 +158,7 @@ export const CollectionListBar: React.FC<CollectionListBarProps> = ({
activeSortBy={collectionListSortBy}
disableBG
/>
- <IconButton onClick={showAllCollections}>
+ <IconButton onClick={onShowAllCollections}>
<ExpandMore />
</IconButton>
</Box>
@@ -179,7 +202,7 @@ export const CollectionListBar: React.FC<CollectionListBarProps> = ({
setSortBy={setCollectionListSortBy}
activeSortBy={collectionListSortBy}
/>
- <IconButtonWithBG onClick={showAllCollections}>
+ <IconButtonWithBG onClick={onShowAllCollections}>
<ExpandMore />
</IconButtonWithBG>
</Box>
diff --git a/web/apps/photos/src/components/Collections/index.tsx b/web/apps/photos/src/components/Collections/index.tsx
index 03e75eaf87..e066c75b27 100644
--- a/web/apps/photos/src/components/Collections/index.tsx
+++ b/web/apps/photos/src/components/Collections/index.tsx
@@ -150,12 +150,12 @@ export default function Collections(props: Iprops) {
isInHiddenSection={isInHiddenSection}
activeCollectionID={activeCollectionID}
setActiveCollectionID={setActiveCollectionID}
+ onShowAllCollections={openAllCollections}
+ collectionListSortBy={collectionListSortBy}
+ setCollectionListSortBy={setCollectionListSortBy}
collectionSummaries={sortedCollectionSummaries.filter((x) =>
shouldBeShownOnCollectionBar(x.type),
)}
- showAllCollections={openAllCollections}
- setCollectionListSortBy={setCollectionListSortBy}
- collectionListSortBy={collectionListSortBy}
/>
<AllCollections