fix collection option for non album user collections
This commit is contained in:
parent
af82ca1dd5
commit
61325a4a6c
|
@ -58,7 +58,12 @@ export default function CollectionInfoWithOptions({
|
||||||
fileCount={fileCount}
|
fileCount={fileCount}
|
||||||
endIcon={<EndIcon type={type} />}
|
endIcon={<EndIcon type={type} />}
|
||||||
/>
|
/>
|
||||||
{shouldShowOptions(type) && <CollectionOptions {...props} />}
|
{shouldShowOptions(type) && (
|
||||||
|
<CollectionOptions
|
||||||
|
{...props}
|
||||||
|
collectionSummaryType={type}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</SpaceBetweenFlex>
|
</SpaceBetweenFlex>
|
||||||
</CollectionInfoBarWrapper>
|
</CollectionInfoBarWrapper>
|
||||||
);
|
);
|
||||||
|
|
|
@ -16,13 +16,13 @@ import { VISIBILITY_STATE } from 'types/magicMetadata';
|
||||||
import { AppContext } from 'pages/_app';
|
import { AppContext } from 'pages/_app';
|
||||||
import OverflowMenu from 'components/OverflowMenu/menu';
|
import OverflowMenu from 'components/OverflowMenu/menu';
|
||||||
import MoreVertIcon from '@mui/icons-material/MoreVert';
|
import MoreVertIcon from '@mui/icons-material/MoreVert';
|
||||||
import { CollectionType, TRASH_SECTION } from 'constants/collection';
|
import { CollectionSummaryType } from 'constants/collection';
|
||||||
import { TrashCollectionOption } from './TrashCollectionOption';
|
import { TrashCollectionOption } from './TrashCollectionOption';
|
||||||
|
|
||||||
interface CollectionOptionsProps {
|
interface CollectionOptionsProps {
|
||||||
setCollectionNamerAttributes: SetCollectionNamerAttributes;
|
setCollectionNamerAttributes: SetCollectionNamerAttributes;
|
||||||
activeCollection: Collection;
|
activeCollection: Collection;
|
||||||
activeCollectionID: number;
|
collectionSummaryType: CollectionSummaryType;
|
||||||
showCollectionShareModal: () => void;
|
showCollectionShareModal: () => void;
|
||||||
redirectToAll: () => void;
|
redirectToAll: () => void;
|
||||||
}
|
}
|
||||||
|
@ -44,15 +44,12 @@ export enum CollectionActions {
|
||||||
const CollectionOptions = (props: CollectionOptionsProps) => {
|
const CollectionOptions = (props: CollectionOptionsProps) => {
|
||||||
const {
|
const {
|
||||||
activeCollection,
|
activeCollection,
|
||||||
activeCollectionID,
|
collectionSummaryType,
|
||||||
redirectToAll,
|
redirectToAll,
|
||||||
setCollectionNamerAttributes,
|
setCollectionNamerAttributes,
|
||||||
showCollectionShareModal,
|
showCollectionShareModal,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
if (!activeCollectionID) {
|
|
||||||
return <></>;
|
|
||||||
}
|
|
||||||
const { startLoading, finishLoading, setDialogMessage } =
|
const { startLoading, finishLoading, setDialogMessage } =
|
||||||
useContext(AppContext);
|
useContext(AppContext);
|
||||||
const { syncWithRemote } = useContext(GalleryContext);
|
const { syncWithRemote } = useContext(GalleryContext);
|
||||||
|
@ -205,21 +202,20 @@ const CollectionOptions = (props: CollectionOptionsProps) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<OverflowMenu
|
<OverflowMenu
|
||||||
ariaControls={`collection-options-${activeCollectionID}`}
|
ariaControls={'collection-options'}
|
||||||
triggerButtonIcon={<MoreVertIcon />}
|
triggerButtonIcon={<MoreVertIcon />}
|
||||||
triggerButtonProps={{
|
triggerButtonProps={{
|
||||||
sx: {
|
sx: {
|
||||||
background: (theme) => theme.palette.fill.dark,
|
background: (theme) => theme.palette.fill.dark,
|
||||||
},
|
},
|
||||||
}}>
|
}}>
|
||||||
{activeCollection?.type === CollectionType.album && (
|
{collectionSummaryType === CollectionSummaryType.trash ? (
|
||||||
<AlbumCollectionOption
|
<TrashCollectionOption
|
||||||
IsArchived={IsArchived(activeCollection)}
|
|
||||||
handleCollectionAction={handleCollectionAction}
|
handleCollectionAction={handleCollectionAction}
|
||||||
/>
|
/>
|
||||||
)}
|
) : (
|
||||||
{activeCollectionID === TRASH_SECTION && (
|
<AlbumCollectionOption
|
||||||
<TrashCollectionOption
|
IsArchived={IsArchived(activeCollection)}
|
||||||
handleCollectionAction={handleCollectionAction}
|
handleCollectionAction={handleCollectionAction}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
Loading…
Reference in a new issue