Skip to content

armgit / ente

Public Imported from GitHub
0

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

Inline

Manav Rathi50a0dc754b24
diff --git a/web/apps/photos/src/components/Collections/CollectionInfoWithOptions.tsx b/web/apps/photos/src/components/Collections/CollectionInfoWithOptions.tsx
index bc4fdea036..f7b38a4e99 100644
--- a/web/apps/photos/src/components/Collections/CollectionInfoWithOptions.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionInfoWithOptions.tsx
@@ -13,7 +13,6 @@ import CollectionOptions from "components/Collections/CollectionOptions";
import type { Dispatch, SetStateAction } from "react";
import { CollectionSummary, CollectionSummaryType } from "types/collection";
import { SetFilesDownloadProgressAttributesCreator } from "types/gallery";
-import { shouldShowOptions } from "utils/collection";
interface Iprops {
activeCollection: Collection;
@@ -72,3 +71,12 @@ export default function CollectionInfoWithOptions({
</GalleryItemsHeaderAdapter>
);
}
+
+const OPTIONS_NOT_HAVING_COLLECTION_TYPES = new Set([
+ CollectionSummaryType.all,
+ CollectionSummaryType.archive,
+]);
+
+const shouldShowOptions = (type: CollectionSummaryType) => {
+ return !OPTIONS_NOT_HAVING_COLLECTION_TYPES.has(type);
+};
diff --git a/web/apps/photos/src/components/Collections/CollectionOptions/QuickOptions/index.tsx b/web/apps/photos/src/components/Collections/CollectionOptions/QuickOptions/index.tsx
index eac6046631..0e16383a66 100644
--- a/web/apps/photos/src/components/Collections/CollectionOptions/QuickOptions/index.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionOptions/QuickOptions/index.tsx
@@ -1,15 +1,11 @@
import { FlexWrapper } from "@ente/shared/components/Container";
import EnteSpinner from "@ente/shared/components/EnteSpinner";
import { CollectionSummaryType } from "types/collection";
-import {
- showDownloadQuickOption,
- showEmptyTrashQuickOption,
- showShareQuickOption,
-} from "utils/collection";
import { CollectionActions } from "..";
import { DownloadQuickOption } from "./DownloadQuickOption";
import { EmptyTrashQuickOption } from "./EmptyTrashQuickOption";
import { ShareQuickOption } from "./ShareQuickOption";
+
interface Iprops {
handleCollectionAction: (
action: CollectionActions,
@@ -49,3 +45,34 @@ export function QuickOptions({
</FlexWrapper>
);
}
+
+const showEmptyTrashQuickOption = (type: CollectionSummaryType) => {
+ return type === CollectionSummaryType.trash;
+};
+const showDownloadQuickOption = (type: CollectionSummaryType) => {
+ return (
+ type === CollectionSummaryType.folder ||
+ type === CollectionSummaryType.favorites ||
+ type === CollectionSummaryType.album ||
+ type === CollectionSummaryType.uncategorized ||
+ type === CollectionSummaryType.hiddenItems ||
+ type === CollectionSummaryType.incomingShareViewer ||
+ type === CollectionSummaryType.incomingShareCollaborator ||
+ type === CollectionSummaryType.outgoingShare ||
+ type === CollectionSummaryType.sharedOnlyViaLink ||
+ type === CollectionSummaryType.archived ||
+ type === CollectionSummaryType.pinned
+ );
+};
+const showShareQuickOption = (type: CollectionSummaryType) => {
+ return (
+ type === CollectionSummaryType.folder ||
+ type === CollectionSummaryType.album ||
+ type === CollectionSummaryType.outgoingShare ||
+ type === CollectionSummaryType.sharedOnlyViaLink ||
+ type === CollectionSummaryType.archived ||
+ type === CollectionSummaryType.incomingShareViewer ||
+ type === CollectionSummaryType.incomingShareCollaborator ||
+ type === CollectionSummaryType.pinned
+ );
+};
diff --git a/web/apps/photos/src/utils/collection.ts b/web/apps/photos/src/utils/collection.ts
index a85e36e677..6030a548b1 100644
--- a/web/apps/photos/src/utils/collection.ts
+++ b/web/apps/photos/src/utils/collection.ts
@@ -96,11 +96,6 @@ const MOVE_TO_NOT_ALLOWED_COLLECTION = new Set([
CollectionSummaryType.hiddenItems,
]);
-const OPTIONS_NOT_HAVING_COLLECTION_TYPES = new Set([
- CollectionSummaryType.all,
- CollectionSummaryType.archive,
-]);
-
const HIDE_FROM_COLLECTION_BAR_TYPES = new Set([
CollectionSummaryType.trash,
CollectionSummaryType.archive,
@@ -432,39 +427,6 @@ export const isSystemCollection = (type: CollectionSummaryType) => {
return SYSTEM_COLLECTION_TYPES.has(type);
};
-export const shouldShowOptions = (type: CollectionSummaryType) => {
- return !OPTIONS_NOT_HAVING_COLLECTION_TYPES.has(type);
-};
-export const showEmptyTrashQuickOption = (type: CollectionSummaryType) => {
- return type === CollectionSummaryType.trash;
-};
-export const showDownloadQuickOption = (type: CollectionSummaryType) => {
- return (
- type === CollectionSummaryType.folder ||
- type === CollectionSummaryType.favorites ||
- type === CollectionSummaryType.album ||
- type === CollectionSummaryType.uncategorized ||
- type === CollectionSummaryType.hiddenItems ||
- type === CollectionSummaryType.incomingShareViewer ||
- type === CollectionSummaryType.incomingShareCollaborator ||
- type === CollectionSummaryType.outgoingShare ||
- type === CollectionSummaryType.sharedOnlyViaLink ||
- type === CollectionSummaryType.archived ||
- type === CollectionSummaryType.pinned
- );
-};
-export const showShareQuickOption = (type: CollectionSummaryType) => {
- return (
- type === CollectionSummaryType.folder ||
- type === CollectionSummaryType.album ||
- type === CollectionSummaryType.outgoingShare ||
- type === CollectionSummaryType.sharedOnlyViaLink ||
- type === CollectionSummaryType.archived ||
- type === CollectionSummaryType.incomingShareViewer ||
- type === CollectionSummaryType.incomingShareCollaborator ||
- type === CollectionSummaryType.pinned
- );
-};
export const shouldBeShownOnCollectionBar = (type: CollectionSummaryType) => {
return !HIDE_FROM_COLLECTION_BAR_TYPES.has(type);
};