From 2822664a5e35ee4a461364e652623e5c853bfb6a Mon Sep 17 00:00:00 2001 From: Ananddubey01 Date: Tue, 24 Jan 2023 12:35:46 +0530 Subject: [PATCH 1/8] IconButton: Changed padding from 8 pixel to 12 pixel --- src/themes/darkThemeOptions.tsx | 47 +++++++++++++-------------------- 1 file changed, 18 insertions(+), 29 deletions(-) diff --git a/src/themes/darkThemeOptions.tsx b/src/themes/darkThemeOptions.tsx index 8bc6ed49e..d0f616da3 100644 --- a/src/themes/darkThemeOptions.tsx +++ b/src/themes/darkThemeOptions.tsx @@ -232,20 +232,7 @@ const darkThemeOptions = createTheme({ MuiSvgIcon: { styleOverrides: { root: ({ ownerState }) => { - switch (ownerState.color) { - case 'primary': - return { - color: '#ffffff', - }; - case 'secondary': - return { - color: 'rgba(255,255,255,0.24)', - }; - case 'disabled': - return { - color: 'rgba(255, 255, 255, 0.16)', - }; - } + return { ...setColor(ownerState) }; }, }, }, @@ -253,21 +240,7 @@ const darkThemeOptions = createTheme({ MuiIconButton: { styleOverrides: { root: ({ ownerState }) => { - switch (ownerState.color) { - case 'primary': - return { - color: '#ffffff', - }; - case 'secondary': - return { - color: 'rgba(255,255,255,0.24)', - }; - } - if (ownerState.disabled) { - return { - color: 'rgba(255, 255, 255, 0.16)', - }; - } + return { ...setColor(ownerState), padding: '12px' }; }, }, }, @@ -403,3 +376,19 @@ const darkThemeOptions = createTheme({ }); export default darkThemeOptions; +function setColor(ownerState) { + switch (ownerState.color) { + case 'primary': + return { + color: '#ffffff', + }; + case 'secondary': + return { + color: 'rgba(255,255,255,0.24)', + }; + case 'disabled': + return { + color: 'rgba(255, 255, 255, 0.16)', + }; + } +} From 40a590a49103b57ffa050740d5149eaa4b629e60 Mon Sep 17 00:00:00 2001 From: Ananddubey01 Date: Tue, 24 Jan 2023 12:51:22 +0530 Subject: [PATCH 2/8] Removed sharing details quick option from incomingShare type albums --- .../Collections/CollectionOptions/QuickOptions.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/components/Collections/CollectionOptions/QuickOptions.tsx b/src/components/Collections/CollectionOptions/QuickOptions.tsx index dfe2599b6..a368e783c 100644 --- a/src/components/Collections/CollectionOptions/QuickOptions.tsx +++ b/src/components/Collections/CollectionOptions/QuickOptions.tsx @@ -24,16 +24,14 @@ export function QuickOptions({ {!( collectionSummaryType === CollectionSummaryType.trash || - collectionSummaryType === CollectionSummaryType.favorites + collectionSummaryType === CollectionSummaryType.favorites || + collectionSummaryType === CollectionSummaryType.incomingShare ) && ( From 3f949310614e4878f0bdd8630af879615ff22912 Mon Sep 17 00:00:00 2001 From: Ananddubey01 Date: Tue, 24 Jan 2023 13:58:23 +0530 Subject: [PATCH 3/8] changed overflow menu width to 220px --- src/components/OverflowMenu/menu.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/OverflowMenu/menu.tsx b/src/components/OverflowMenu/menu.tsx index 3e44c5f5f..67c6e6ed3 100644 --- a/src/components/OverflowMenu/menu.tsx +++ b/src/components/OverflowMenu/menu.tsx @@ -20,6 +20,7 @@ const StyledMenu = styled(Menu)` & .MuiList-root { padding: 0; border: none; + width: 220px; } `; From 09e9b5da2fa3209beb11a6233244ce10b458779e Mon Sep 17 00:00:00 2001 From: Ananddubey01 Date: Tue, 24 Jan 2023 14:02:59 +0530 Subject: [PATCH 4/8] changed function name from isSharedByMe/isSharedWithMe to isOutgointShare/isIncomingShare --- src/utils/collection/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/collection/index.ts b/src/utils/collection/index.ts index da8b01b48..e9cd3d048 100644 --- a/src/utils/collection/index.ts +++ b/src/utils/collection/index.ts @@ -242,10 +242,10 @@ export const isCollectionHidden = (collection: Collection) => export const isQuickLinkCollection = (collection: Collection) => collection.magicMetadata?.data.subType === SUB_TYPE.QUICK_LINK_COLLECTION; -export function isSharedByMe(collection: Collection): boolean { +export function isOutgoingShare(collection: Collection): boolean { return collection.sharees?.length > 0; } -export function isSharedWithMe(collection: Collection, user: User) { +export function isIncomingShare(collection: Collection, user: User) { return collection.owner.id !== user.id; } export function isSharedOnlyViaLink(collection: Collection) { From aebbe9ce77e122263761186bc3da639eaecde62c Mon Sep 17 00:00:00 2001 From: Ananddubey01 Date: Tue, 24 Jan 2023 14:04:24 +0530 Subject: [PATCH 5/8] changed function name from isSharedByMe/isSharedWithMe to isOutgointShare/isIncomingShare --- src/services/collectionService.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/services/collectionService.ts b/src/services/collectionService.ts index 78c5ba3ad..89d3fc035 100644 --- a/src/services/collectionService.ts +++ b/src/services/collectionService.ts @@ -50,8 +50,8 @@ import { User } from 'types/user'; import { getNonHiddenCollections, isQuickLinkCollection, - isSharedByMe, - isSharedWithMe, + isOutgoingShare, + isIncomingShare, isSharedOnlyViaLink, } from 'utils/collection'; import ComlinkCryptoWorker from 'utils/comlink/ComlinkCryptoWorker'; @@ -827,9 +827,9 @@ export function getCollectionSummaries( latestFile: collectionLatestFiles.get(collection.id), fileCount: collectionFilesCount.get(collection.id), updationTime: collection.updationTime, - type: isSharedWithMe(collection, user) + type: isIncomingShare(collection, user) ? CollectionSummaryType.incomingShare - : isSharedByMe(collection) + : isOutgoingShare(collection) ? CollectionSummaryType.outgoingShare : isSharedOnlyViaLink(collection) ? CollectionSummaryType.sharedOnlyViaLink From 92732786efe5e08ae98475011bbc3ca49e9da5e4 Mon Sep 17 00:00:00 2001 From: Ananddubey01 Date: Tue, 24 Jan 2023 18:38:48 +0530 Subject: [PATCH 6/8] commented out sharing details quick option for incomingShare type albums --- src/components/Collections/CollectionOptions/QuickOptions.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/Collections/CollectionOptions/QuickOptions.tsx b/src/components/Collections/CollectionOptions/QuickOptions.tsx index a368e783c..2fa85f27e 100644 --- a/src/components/Collections/CollectionOptions/QuickOptions.tsx +++ b/src/components/Collections/CollectionOptions/QuickOptions.tsx @@ -29,6 +29,9 @@ export function QuickOptions({ ) && ( Date: Tue, 24 Jan 2023 18:53:09 +0530 Subject: [PATCH 7/8] Fixed empty trash delete quick option bug --- src/components/Collections/CollectionOptions/QuickOptions.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Collections/CollectionOptions/QuickOptions.tsx b/src/components/Collections/CollectionOptions/QuickOptions.tsx index 2fa85f27e..b2397bda1 100644 --- a/src/components/Collections/CollectionOptions/QuickOptions.tsx +++ b/src/components/Collections/CollectionOptions/QuickOptions.tsx @@ -70,7 +70,7 @@ export function QuickOptions({ From e960967409fc6eed4f438b10771c5dbbf5308460 Mon Sep 17 00:00:00 2001 From: Ananddubey01 Date: Tue, 24 Jan 2023 19:37:12 +0530 Subject: [PATCH 8/8] Implemented overflow menu for favorites albums --- .../FavoritiesCollectionOption.tsx | 26 +++++++++ .../Collections/CollectionOptions/index.tsx | 57 ++++++++++--------- 2 files changed, 57 insertions(+), 26 deletions(-) create mode 100644 src/components/Collections/CollectionOptions/FavoritiesCollectionOption.tsx diff --git a/src/components/Collections/CollectionOptions/FavoritiesCollectionOption.tsx b/src/components/Collections/CollectionOptions/FavoritiesCollectionOption.tsx new file mode 100644 index 000000000..a468aa610 --- /dev/null +++ b/src/components/Collections/CollectionOptions/FavoritiesCollectionOption.tsx @@ -0,0 +1,26 @@ +import { OverflowMenuOption } from 'components/OverflowMenu/option'; +import React from 'react'; + +import FileDownloadOutlinedIcon from '@mui/icons-material/FileDownloadOutlined'; +import constants from 'utils/strings/constants'; +import { CollectionActions } from '.'; + +interface Iprops { + handleCollectionAction: ( + action: CollectionActions, + loader?: boolean + ) => (...args: any[]) => Promise; +} + +export function FavoritiesCollectionOption({ handleCollectionAction }: Iprops) { + return ( + } + onClick={handleCollectionAction( + CollectionActions.CONFIRM_DOWNLOAD, + false + )}> + {constants.DOWNLOAD_COLLECTION} + + ); +} diff --git a/src/components/Collections/CollectionOptions/index.tsx b/src/components/Collections/CollectionOptions/index.tsx index baec851b9..a7e68184d 100644 --- a/src/components/Collections/CollectionOptions/index.tsx +++ b/src/components/Collections/CollectionOptions/index.tsx @@ -18,6 +18,7 @@ import OverflowMenu from 'components/OverflowMenu/menu'; import { CollectionSummaryType } from 'constants/collection'; import { TrashCollectionOption } from './TrashCollectionOption'; import { SharedCollectionOption } from './SharedCollectionOption'; +import { FavoritiesCollectionOption } from './FavoritiesCollectionOption'; import { QuickOptions } from './QuickOptions'; import MoreHoriz from '@mui/icons-material/MoreHoriz'; import { HorizontalFlex } from 'components/Container'; @@ -239,32 +240,36 @@ const CollectionOptions = (props: CollectionOptionsProps) => { handleCollectionAction={handleCollectionAction} collectionSummaryType={collectionSummaryType} /> - {!(collectionSummaryType === CollectionSummaryType.favorites) && ( - } - triggerButtonProps={{ - sx: { - background: (theme) => theme.palette.fill.dark, - }, - }}> - {collectionSummaryType === CollectionSummaryType.trash ? ( - - ) : collectionSummaryType === - CollectionSummaryType.incomingShare ? ( - - ) : ( - - )} - - )} + + } + triggerButtonProps={{ + sx: { + background: (theme) => theme.palette.fill.dark, + }, + }}> + {collectionSummaryType === CollectionSummaryType.trash ? ( + + ) : collectionSummaryType === + CollectionSummaryType.favorites ? ( + + ) : collectionSummaryType === + CollectionSummaryType.incomingShare ? ( + + ) : ( + + )} + ); };