Skip to content

armgit / ente

Public Imported from GitHub
0

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

Omit empty collection name row in hidden section

Manav Rathi8c16c41b904e
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index cd7d368510..783b4c3abb 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -264,6 +264,8 @@ const Page: React.FC = () => {
normalFiles,
hiddenFiles,
favoriteFileIDs,
+ collectionNameByID,
+ fileNormalCollectionIDs,
normalCollectionSummaries,
pendingFavoriteUpdates,
pendingVisibilityUpdates,
@@ -1122,8 +1124,6 @@ const Page: React.FC = () => {
setSelected={setSelected}
activeCollectionID={activeCollectionID}
activePersonID={activePerson?.id}
- fileNormalCollectionIDs={state.fileNormalCollectionIDs}
- collectionNameByID={state.collectionNameByID}
isInIncomingSharedCollection={
normalCollectionSummaries.get(activeCollectionID)
?.type == "incomingShareCollaborator" ||
@@ -1133,6 +1133,8 @@ const Page: React.FC = () => {
isInHiddenSection={barMode == "hidden-albums"}
{...{
favoriteFileIDs,
+ collectionNameByID,
+ fileNormalCollectionIDs,
pendingFavoriteUpdates,
pendingVisibilityUpdates,
}}
@@ -1153,7 +1155,7 @@ const Page: React.FC = () => {
)}
<Export
{...exportVisibilityProps}
- allCollectionsNameByID={state.collectionNameByID}
+ allCollectionsNameByID={collectionNameByID}
/>
<AuthenticateUser
{...authenticateUserVisibilityProps}
diff --git a/web/packages/gallery/components/FileInfo.tsx b/web/packages/gallery/components/FileInfo.tsx
index 83a0c444ca..076c283dde 100644
--- a/web/packages/gallery/components/FileInfo.tsx
+++ b/web/packages/gallery/components/FileInfo.tsx
@@ -131,18 +131,17 @@ export type FileInfoProps = ModalVisibilityProps & {
* If set, then a clickable chip will be shown for each normal collection
* that this file is a part of.
*
- * Uses {@link fileCollectionIDs}, {@link allCollectionsNameByID} and
+ * Uses {@link fileCollectionIDs}, {@link collectionNameByID} and
* {@link onSelectCollection}, so all of those props should also be set for
* this to have an effect.
*/
showCollections?: boolean;
/**
- * A map from file IDs to the IDs of the normal (non-hidden) collections
- * that they're a part of.
+ * A map from file IDs to the IDs of the collections that they're a part of.
*
* Used when {@link showCollections} is set.
*/
- fileNormalCollectionIDs?: Map<number, number[]>;
+ fileCollectionIDs?: Map<number, number[]>;
/**
* A map from collection IDs to their name.
*
@@ -189,7 +188,7 @@ export const FileInfo: React.FC<FileInfoProps> = ({
allowEdits,
allowMap,
showCollections,
- fileNormalCollectionIDs,
+ fileCollectionIDs,
collectionNameByID,
onNeedsRemoteSync,
onUpdateCaption,
@@ -339,13 +338,13 @@ export const FileInfo: React.FC<FileInfoProps> = ({
</InfoItem>
)}
{showCollections &&
- fileNormalCollectionIDs &&
+ fileCollectionIDs &&
collectionNameByID &&
onSelectCollection && (
<Albums
{...{
file,
- fileNormalCollectionIDs,
+ fileCollectionIDs,
collectionNameByID,
onSelectCollection,
}}
@@ -1004,13 +1003,13 @@ const ExifItem = styled("div")`
type AlbumsProps = Required<
Pick<
FileInfoProps,
- "fileNormalCollectionIDs" | "collectionNameByID" | "onSelectCollection"
+ "fileCollectionIDs" | "collectionNameByID" | "onSelectCollection"
>
> & { file: EnteFile };
const Albums: React.FC<AlbumsProps> = ({
file,
- fileNormalCollectionIDs,
+ fileCollectionIDs,
collectionNameByID,
onSelectCollection,
}) => (
@@ -1024,7 +1023,7 @@ const Albums: React.FC<AlbumsProps> = ({
alignItems: "flex-start",
}}
>
- {fileNormalCollectionIDs
+ {fileCollectionIDs
.get(file.id)
?.filter((collectionID) => collectionNameByID.has(collectionID))
.map((collectionID) => (
diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsx
index b5729def89..b32f4c8fa8 100644
--- a/web/packages/gallery/components/viewer/FileViewer.tsx
+++ b/web/packages/gallery/components/viewer/FileViewer.tsx
@@ -192,6 +192,11 @@ export type FileViewerProps = ModalVisibilityProps & {
* See also {@link onFileVisibilityUpdate}.
*/
pendingVisibilityUpdates?: Set<number>;
+ /**
+ * A mapping from file IDs to the IDs of the normal (non-hidden) collections
+ * that they are a part of.
+ */
+ fileNormalCollectionIDs?: FileInfoProps["fileCollectionIDs"];
/**
* Called when there was some update performed within the file viewer that
* necessitates us to sync with remote again to fetch the latest updates.
@@ -259,10 +264,7 @@ export type FileViewerProps = ModalVisibilityProps & {
onSaveEditedImageCopy?: ImageEditorOverlayProps["onSaveEditedCopy"];
} & Pick<
FileInfoProps,
- | "fileNormalCollectionIDs"
- | "collectionNameByID"
- | "onSelectCollection"
- | "onSelectPerson"
+ "collectionNameByID" | "onSelectCollection" | "onSelectPerson"
>;
/**
@@ -882,12 +884,13 @@ export const FileViewer: React.FC<FileViewerProps> = ({
exif={activeFileExif}
allowEdits={!!activeAnnotatedFile.annotation.isOwnFile}
allowMap={haveUser}
- showCollections={haveUser}
+ showCollections={haveUser && !isInHiddenSection}
+ fileCollectionIDs={fileNormalCollectionIDs}
+ collectionNameByID={collectionNameByID}
onNeedsRemoteSync={handleNeedsRemoteSync}
onUpdateCaption={handleUpdateCaption}
onSelectCollection={handleSelectCollection}
onSelectPerson={handleSelectPerson}
- {...{ fileNormalCollectionIDs, collectionNameByID }}
/>
<MoreMenu
open={!!moreMenuAnchorEl}
diff --git a/web/packages/new/photos/components/gallery/reducer.ts b/web/packages/new/photos/components/gallery/reducer.ts
index 0b4305965b..abb8418870 100644
--- a/web/packages/new/photos/components/gallery/reducer.ts
+++ b/web/packages/new/photos/components/gallery/reducer.ts
@@ -942,7 +942,8 @@ const galleryReducer: React.Reducer<GalleryState, GalleryAction> = (
}
case "clearUnsyncedState": {
- const unsyncedFavoriteUpdates: GalleryState["unsyncedFavoriteUpdates"] = new Map();
+ const unsyncedFavoriteUpdates: GalleryState["unsyncedFavoriteUpdates"] =
+ new Map();
const favoriteFileIDs = deriveFavoriteFileIDs(
state.normalCollections,
state.normalFiles,