Skip to content

armgit / ente

Public Imported from GitHub
0

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

chore: refactored and moved around the components

Abhinavf02c7877cd05
diff --git a/apps/photos/src/components/Collections/CollectionInfoWithOptions.tsx b/apps/photos/src/components/Collections/CollectionInfoWithOptions.tsx
index ee929e897f..8fc1c454a0 100644
--- a/apps/photos/src/components/Collections/CollectionInfoWithOptions.tsx
+++ b/apps/photos/src/components/Collections/CollectionInfoWithOptions.tsx
@@ -1,5 +1,5 @@
import { CollectionInfo } from './CollectionInfo';
-import React, { useState } from 'react';
+import React, { Dispatch, SetStateAction } from 'react';
import { Collection, CollectionSummary } from 'types/collection';
import CollectionOptions from 'components/Collections/CollectionOptions';
import { SetCollectionNamerAttributes } from 'components/Collections/CollectionNamer';
@@ -12,7 +12,6 @@ import ArchiveOutlined from '@mui/icons-material/ArchiveOutlined';
import PeopleIcon from '@mui/icons-material/People';
import LinkIcon from '@mui/icons-material/Link';
import { SetCollectionDownloadProgressAttributes } from 'types/gallery';
-import AlbumCastDialog from './CollectionOptions/AlbumCastDialog';
interface Iprops {
activeCollection: Collection;
@@ -24,6 +23,7 @@ interface Iprops {
) => SetCollectionDownloadProgressAttributes;
isActiveCollectionDownloadInProgress: () => boolean;
setActiveCollectionID: (collectionID: number) => void;
+ setShowAlbumCastDialog: Dispatch<SetStateAction<boolean>>;
}
export default function CollectionInfoWithOptions({
@@ -54,8 +54,6 @@ export default function CollectionInfoWithOptions({
}
};
- const [showAlbumCastDialog, setShowAlbumCastDialog] = useState(false);
-
return (
<>
<CollectionInfoBarWrapper>
@@ -68,17 +66,11 @@ export default function CollectionInfoWithOptions({
{shouldShowOptions(type) && (
<CollectionOptions
{...props}
- setShowAlbumCastDialog={setShowAlbumCastDialog}
collectionSummaryType={type}
/>
)}
</SpaceBetweenFlex>
</CollectionInfoBarWrapper>
- <AlbumCastDialog
- currentCollectionId={props.activeCollection?.id}
- show={showAlbumCastDialog}
- onHide={() => setShowAlbumCastDialog(false)}
- />
</>
);
}
diff --git a/apps/photos/src/components/Collections/CollectionOptions/index.tsx b/apps/photos/src/components/Collections/CollectionOptions/index.tsx
index 341535c3d4..489b98c6cb 100644
--- a/apps/photos/src/components/Collections/CollectionOptions/index.tsx
+++ b/apps/photos/src/components/Collections/CollectionOptions/index.tsx
@@ -197,7 +197,7 @@ const CollectionOptions = (props: CollectionOptionsProps) => {
};
};
- const showCastAlbumDialog = async () => {
+ const showCastAlbumDialog = () => {
setShowAlbumCastDialog(true);
};
diff --git a/apps/photos/src/components/Collections/index.tsx b/apps/photos/src/components/Collections/index.tsx
index 6a3e6de0c4..a1b1ddef99 100644
--- a/apps/photos/src/components/Collections/index.tsx
+++ b/apps/photos/src/components/Collections/index.tsx
@@ -22,6 +22,7 @@ import {
isCollectionDownloadCompleted,
} from './CollectionDownloadProgress';
import { SetCollectionDownloadProgressAttributes } from 'types/gallery';
+import AlbumCastDialog from './CollectionOptions/AlbumCastDialog';
interface Iprops {
activeCollection: Collection;
@@ -57,6 +58,8 @@ export default function Collections(props: Iprops) {
setCollectionDownloadProgressAttributesList,
] = useState<CollectionDownloadProgressAttributes[]>([]);
+ const [showAlbumCastDialog, setShowAlbumCastDialog] = useState(false);
+
const [collectionListSortBy, setCollectionListSortBy] =
useLocalState<COLLECTION_LIST_SORT_BY>(
LS_KEYS.COLLECTION_SORT_BY,
@@ -141,6 +144,7 @@ export default function Collections(props: Iprops) {
isActiveCollectionDownloadInProgress
}
setActiveCollectionID={setActiveCollectionID}
+ setShowAlbumCastDialog={setShowAlbumCastDialog}
/>
),
itemType: ITEM_TYPE.HEADER,
@@ -199,6 +203,11 @@ export default function Collections(props: Iprops) {
attributesList={collectionDownloadProgressAttributesList}
setAttributesList={setCollectionDownloadProgressAttributesList}
/>
+ <AlbumCastDialog
+ currentCollectionId={props.activeCollection?.id}
+ show={showAlbumCastDialog}
+ onHide={() => setShowAlbumCastDialog(false)}
+ />
</>
);
}