π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
As attribute
Manav Rathi49e2ae3120da
diff --git a/web/apps/photos/src/components/Collections/CollectionHeader.tsx b/web/apps/photos/src/components/Collections/CollectionHeader.tsxindex edf74db137..1efa848da6 100644--- a/web/apps/photos/src/components/Collections/CollectionHeader.tsx+++ b/web/apps/photos/src/components/Collections/CollectionHeader.tsx@@ -83,14 +83,13 @@ export const CollectionHeader: React.FC<CollectionHeaderProps> = (props) => {return <></>;}- const { name, type, fileCount } = collectionSummary;+ const { name, type, attributes, fileCount } = collectionSummary;const EndIcon = ({ type }: { type: CollectionSummaryType }) => {+ if (attributes.has("archived")) return <ArchiveOutlinedIcon />;switch (type) {case "favorites":return <FavoriteRoundedIcon />;- case "archived":- return <ArchiveOutlinedIcon />;case "incomingShareViewer":case "incomingShareCollaborator":return <PeopleIcon />;@@ -500,6 +499,7 @@ const CollectionHeaderOptions: React.FC<CollectionHeaderProps> = ({return (<Box sx={{ display: "inline-flex", gap: "16px" }}><QuickOptions+ collectionSummary={collectionSummary}collectionSummaryType={collectionSummaryType}isDownloadInProgress={isActiveCollectionDownloadInProgress}onEmptyTrashClick={confirmEmptyTrash}@@ -538,7 +538,8 @@ interface OptionProps {}interface QuickOptionsProps {- collectionSummaryType: CollectionSummaryType;+ collectionSummary: CollectionSummary;+ collectionSummaryType: CollectionSummary["type"];isDownloadInProgress: () => boolean;onEmptyTrashClick: () => void;onDownloadClick: () => void;@@ -549,6 +550,7 @@ const QuickOptions: React.FC<QuickOptionsProps> = ({onEmptyTrashClick,onDownloadClick,onShareClick,+ collectionSummary,collectionSummaryType: type,isDownloadInProgress,}) => (@@ -556,7 +558,7 @@ const QuickOptions: React.FC<QuickOptionsProps> = ({{showEmptyTrashQuickOption(type) && (<EmptyTrashQuickOption onClick={onEmptyTrashClick} />)}- {showDownloadQuickOption(type) &&+ {showDownloadQuickOption(collectionSummary) &&(isDownloadInProgress() ? (<ActivityIndicator size="20px" sx={{ m: "12px" }} />) : (@@ -565,7 +567,7 @@ const QuickOptions: React.FC<QuickOptionsProps> = ({collectionSummaryType={type}/>))}- {showShareQuickOption(type) && (+ {showShareQuickOption(collectionSummary) && (<ShareQuickOptiononClick={onShareClick}collectionSummaryType={type}@@ -585,7 +587,7 @@ const EmptyTrashQuickOption: React.FC<OptionProps> = ({ onClick }) => (</Tooltip>);-const showDownloadQuickOption = (type: CollectionSummaryType) =>+const showDownloadQuickOption = ({ type, attributes }: CollectionSummary) =>type == "album" ||type == "folder" ||type == "favorites" ||@@ -595,7 +597,7 @@ const showDownloadQuickOption = (type: CollectionSummaryType) =>type == "incomingShareCollaborator" ||type == "outgoingShare" ||type == "sharedOnlyViaLink" ||- type == "archived" ||+ attributes.has("archived") ||type == "pinned";type DownloadQuickOptionProps = OptionProps & {@@ -623,13 +625,13 @@ const DownloadQuickOption: React.FC<DownloadQuickOptionProps> = ({</Tooltip>);-const showShareQuickOption = (type: CollectionSummaryType) =>+const showShareQuickOption = ({ type, attributes }: CollectionSummary) =>type == "album" ||type == "folder" ||type == "favorites" ||type == "outgoingShare" ||type == "sharedOnlyViaLink" ||- type == "archived" ||+ attributes.has("archived") ||type == "incomingShareViewer" ||type == "incomingShareCollaborator" ||type == "pinned";diff --git a/web/packages/new/photos/components/gallery/BarImpl.tsx b/web/packages/new/photos/components/gallery/BarImpl.tsxindex 49e801d7ca..5d59a46326 100644--- a/web/packages/new/photos/components/gallery/BarImpl.tsx+++ b/web/packages/new/photos/components/gallery/BarImpl.tsx@@ -23,7 +23,7 @@ import {import { FocusVisibleUnstyledButton } from "ente-new/photos/components/UnstyledButton";import type {CollectionSummary,- CollectionSummaryType,+ CollectionSummaryAttribute,CollectionsSortBy,} from "ente-new/photos/services/collection-summary";import type { Person } from "ente-new/photos/services/ml/people";@@ -528,7 +528,7 @@ const CardText: React.FC<React.PropsWithChildren> = ({ children }) => ();interface CollectionBarCardIconProps {- attributes: Set<CollectionSummaryType>;+ attributes: Set<CollectionSummaryAttribute>;}const CollectionBarCardIcon: React.FC<CollectionBarCardIconProps> = ({diff --git a/web/packages/new/photos/components/gallery/reducer.ts b/web/packages/new/photos/components/gallery/reducer.tsindex 6369b2ed0d..d3469eb0c6 100644--- a/web/packages/new/photos/components/gallery/reducer.ts+++ b/web/packages/new/photos/components/gallery/reducer.ts@@ -33,6 +33,7 @@ import {CollectionSummarySortPriority,PseudoCollectionID,type CollectionSummary,+ type CollectionSummaryAttribute,type CollectionSummaryType,} from "../../services/collection-summary";import type { PeopleState, Person } from "../../services/ml/people";@@ -1414,8 +1415,6 @@ const createCollectionSummaries = (type = "outgoingShare";} else if (isSharedOnlyViaLink(collection)) {type = "sharedOnlyViaLink";- } else if (isArchivedCollection(collection)) {- type = "archived";} else if (isDefaultHiddenCollection(collection)) {type = "defaultHidden";} else if (@@ -1429,7 +1428,7 @@ const createCollectionSummaries = (// This block of code duplicates the above. Such duplication is needed// until type is completely replaced by attributes.- const attributes = new Set<CollectionSummaryType>();+ const attributes = new Set<CollectionSummaryAttribute>();if (collection.owner.id != user.id) {attributes.add(collection.sharees.find((s) => s.id == user.id)?.role ==diff --git a/web/packages/new/photos/services/collection-summary.ts b/web/packages/new/photos/services/collection-summary.tsindex d13e16e299..a4254abdb9 100644--- a/web/packages/new/photos/services/collection-summary.ts+++ b/web/packages/new/photos/services/collection-summary.ts@@ -2,6 +2,19 @@ import type { CollectionType } from "ente-media/collection";import type { EnteFile } from "ente-media/file";export type CollectionSummaryType =+ | CollectionType+ | "all"+ | "archive"+ | "trash"+ | "hiddenItems"+ | "defaultHidden"+ | "outgoingShare"+ | "incomingShareViewer"+ | "incomingShareCollaborator"+ | "sharedOnlyViaLink"+ | "pinned";++export type CollectionSummaryAttribute =| CollectionType| "all"| "archive"@@ -117,7 +130,7 @@ export interface CollectionSummary {* ad-hoc "UI" attributes which make it easier and more efficient for the UI* elements to render the collection summary in the UI.*/- attributes: Set<CollectionSummaryType>;+ attributes: Set<CollectionSummaryAttribute>;/*** The name of the collection or pseudo-collection surfaced in the UI.*/