Skip to content

armgit / ente

Public Imported from GitHub
0

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

Pass directly

Manav Rathi6983dd93640c
diff --git a/web/apps/photos/src/components/Sidebar.tsx b/web/apps/photos/src/components/Sidebar.tsx
index d013559fa6..1b67d8cb51 100644
--- a/web/apps/photos/src/components/Sidebar.tsx
+++ b/web/apps/photos/src/components/Sidebar.tsx
@@ -141,6 +141,11 @@ type SidebarProps = ModalVisibilityProps & {
* Called when the plan selection modal should be shown.
*/
onShowPlanSelector: () => void;
+ /**
+ * Called when the collection summary with the given
+ * {@link collectionSummaryID} should be shown.
+ */
+ onShowCollectionSummary: (collectionSummaryID: number) => void;
/**
* Called when the export dialog should be shown.
*/
@@ -160,6 +165,7 @@ export const Sidebar: React.FC<SidebarProps> = ({
collectionSummaries,
uncategorizedCollectionSummaryID,
onShowPlanSelector,
+ onShowCollectionSummary,
onShowExport,
onAuthenticateUser,
}) => (
@@ -169,7 +175,11 @@ export const Sidebar: React.FC<SidebarProps> = ({
<Stack sx={{ gap: 0.5, mb: 3 }}>
<ShortcutSection
onCloseSidebar={onClose}
- {...{ collectionSummaries, uncategorizedCollectionSummaryID }}
+ {...{
+ collectionSummaries,
+ uncategorizedCollectionSummaryID,
+ onShowCollectionSummary,
+ }}
/>
<UtilitySection
onCloseSidebar={onClose}
@@ -437,28 +447,31 @@ const ManageMemberSubscription: React.FC<ManageMemberSubscriptionProps> = ({
type ShortcutSectionProps = SectionProps &
Pick<
SidebarProps,
- "collectionSummaries" | "uncategorizedCollectionSummaryID"
+ | "collectionSummaries"
+ | "uncategorizedCollectionSummaryID"
+ | "onShowCollectionSummary"
>;
const ShortcutSection: React.FC<ShortcutSectionProps> = ({
onCloseSidebar,
collectionSummaries,
uncategorizedCollectionSummaryID,
+ onShowCollectionSummary,
}) => {
const galleryContext = useContext(GalleryContext);
const openUncategorizedSection = () => {
- galleryContext.setActiveCollectionID(uncategorizedCollectionSummaryID);
+ onShowCollectionSummary(uncategorizedCollectionSummaryID);
onCloseSidebar();
};
const openTrashSection = () => {
- galleryContext.setActiveCollectionID(PseudoCollectionID.trash);
+ onShowCollectionSummary(PseudoCollectionID.trash);
onCloseSidebar();
};
const openArchiveSection = () => {
- galleryContext.setActiveCollectionID(PseudoCollectionID.archiveItems);
+ onShowCollectionSummary(PseudoCollectionID.archiveItems);
onCloseSidebar();
};
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index e5b3085e81..a0f71d7277 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -781,7 +781,7 @@ const Page: React.FC = () => {
setUploadTypeSelectorIntent(intent ?? "upload");
};
- const handleSetActiveCollectionID = (
+ const handleShowCollectionSummary = (
collectionSummaryID: number | undefined,
) => dispatch({ type: "showCollectionSummary", collectionSummaryID });
@@ -889,7 +889,7 @@ const Page: React.FC = () => {
<GalleryContext.Provider
value={{
...defaultGalleryContext,
- setActiveCollectionID: handleSetActiveCollectionID,
+ setActiveCollectionID: handleShowCollectionSummary,
syncWithRemote: (force, silent) =>
syncWithRemote({ force, silent }),
setBlockingLoad,
@@ -1030,7 +1030,7 @@ const Page: React.FC = () => {
: undefined) ?? []
}
onChangeMode={handleChangeBarMode}
- setActiveCollectionID={handleSetActiveCollectionID}
+ setActiveCollectionID={handleShowCollectionSummary}
onSelectPerson={handleSelectPerson}
/>
@@ -1071,6 +1071,7 @@ const Page: React.FC = () => {
state.uncategorizedCollectionSummaryID
}
onShowPlanSelector={showPlanSelector}
+ onShowCollectionSummary={handleShowCollectionSummary}
onShowExport={showExport}
onAuthenticateUser={authenticateUser}
/>