From 91d17f2a3e1467a3d6e5d5c150085b0e6b410f40 Mon Sep 17 00:00:00 2001 From: Balaji Krishnamurthy Date: Tue, 19 Nov 2024 22:10:00 +0530 Subject: [PATCH 1/3] Add object names to favorites --- .../CurrentWorkspaceMemberFavorites.tsx | 2 ++ ...CurrentWorkspaceMemberFavoritesFolders.tsx | 2 ++ .../components/NavigationDrawerItem.tsx | 30 +++++++++++++++++++ .../components/NavigationDrawerSubItem.tsx | 3 ++ 4 files changed, 37 insertions(+) diff --git a/packages/twenty-front/src/modules/favorites/components/CurrentWorkspaceMemberFavorites.tsx b/packages/twenty-front/src/modules/favorites/components/CurrentWorkspaceMemberFavorites.tsx index d33dfdbd5e17..ceb2f87dffce 100644 --- a/packages/twenty-front/src/modules/favorites/components/CurrentWorkspaceMemberFavorites.tsx +++ b/packages/twenty-front/src/modules/favorites/components/CurrentWorkspaceMemberFavorites.tsx @@ -174,6 +174,8 @@ export const CurrentWorkspaceMemberFavorites = ({ /> } isDraggable + isFavorite + objectName={favorite.objectNameSingular} /> } /> diff --git a/packages/twenty-front/src/modules/favorites/components/CurrentWorkspaceMemberFavoritesFolders.tsx b/packages/twenty-front/src/modules/favorites/components/CurrentWorkspaceMemberFavoritesFolders.tsx index 0e59927a036f..b81af3cfe40b 100644 --- a/packages/twenty-front/src/modules/favorites/components/CurrentWorkspaceMemberFavoritesFolders.tsx +++ b/packages/twenty-front/src/modules/favorites/components/CurrentWorkspaceMemberFavoritesFolders.tsx @@ -124,6 +124,8 @@ export const CurrentWorkspaceMemberFavoritesFolders = () => { /> } isDraggable={true} + isFavorite + objectName={favorite.objectNameSingular} /> } /> diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx index 4c6936dd0a5c..8330b5164bf6 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx @@ -1,3 +1,4 @@ +import { ProcessedFavorite } from '@/favorites/utils/sortFavorites'; import { useIsSettingsPage } from '@/navigation/hooks/useIsSettingsPage'; import { NavigationDrawerAnimatedCollapseWrapper } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerAnimatedCollapseWrapper'; import { NavigationDrawerItemBreadcrumb } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItemBreadcrumb'; @@ -38,6 +39,8 @@ export type NavigationDrawerItemProps = { keyboard?: string[]; rightOptions?: ReactNode; isDraggable?: boolean; + isFavorite?: boolean; + objectName?: string | undefined; }; type StyledItemProps = Pick< @@ -129,6 +132,25 @@ const StyledItemLabel = styled.span` white-space: nowrap; `; +const StyledItemLabelWithObjectName = styled.span` + color: ${({ theme }) => theme.font.color.light}; + font-weight: ${({ theme }) => theme.font.weight.regular}; + text-overflow: ellipsis; + white-space: nowrap; +`; +type CreateLabelWithObjectNameProps = ProcessedFavorite; + +export const CreateLabelWithObjectName = ( + favorite: CreateLabelWithObjectNameProps, +) => { + return ( + favorite.labelIdentifier + + ' . ' + + String(favorite.objectNameSingular?.charAt(0).toUpperCase()) + + favorite.objectNameSingular?.slice(1) + ); +}; + const StyledItemCount = styled.span` align-items: center; background-color: ${({ theme }) => theme.color.blue}; @@ -199,6 +221,8 @@ export const NavigationDrawerItem = ({ subItemState, rightOptions, isDraggable, + isFavorite, + objectName, }: NavigationDrawerItemProps) => { const theme = useTheme(); const isMobile = useIsMobile(); @@ -254,6 +278,12 @@ export const NavigationDrawerItem = ({ {label} + {isFavorite && objectName && ( + + {' '} + ยท {objectName.charAt(0).toUpperCase() + objectName.slice(1)} + + )} diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSubItem.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSubItem.tsx index 6bc3ca67a9b6..758f47c5376e 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSubItem.tsx +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSubItem.tsx @@ -19,6 +19,7 @@ export const NavigationDrawerSubItem = ({ subItemState, rightOptions, isDraggable, + objectName, }: NavigationDrawerSubItemProps) => { return ( ); }; From 2729574daf3077dfe700989ca74b7feef7c9d1ac Mon Sep 17 00:00:00 2001 From: Balaji Krishnamurthy <107975017+BKM14@users.noreply.github.com> Date: Wed, 20 Nov 2024 11:36:56 +0530 Subject: [PATCH 2/3] Remove unused method --- .../components/NavigationDrawerItem.tsx | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx index 8330b5164bf6..0711e8604288 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx @@ -138,18 +138,6 @@ const StyledItemLabelWithObjectName = styled.span` text-overflow: ellipsis; white-space: nowrap; `; -type CreateLabelWithObjectNameProps = ProcessedFavorite; - -export const CreateLabelWithObjectName = ( - favorite: CreateLabelWithObjectNameProps, -) => { - return ( - favorite.labelIdentifier + - ' . ' + - String(favorite.objectNameSingular?.charAt(0).toUpperCase()) + - favorite.objectNameSingular?.slice(1) - ); -}; const StyledItemCount = styled.span` align-items: center; From ad0d0dbcddb3f007e78ec592a74bd54e4e561e14 Mon Sep 17 00:00:00 2001 From: Balaji Krishnamurthy <107975017+BKM14@users.noreply.github.com> Date: Wed, 20 Nov 2024 12:17:06 +0530 Subject: [PATCH 3/3] Remove unused import --- .../navigation-drawer/components/NavigationDrawerItem.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx index 0711e8604288..e41c2f3243f4 100644 --- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx +++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx @@ -1,4 +1,3 @@ -import { ProcessedFavorite } from '@/favorites/utils/sortFavorites'; import { useIsSettingsPage } from '@/navigation/hooks/useIsSettingsPage'; import { NavigationDrawerAnimatedCollapseWrapper } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerAnimatedCollapseWrapper'; import { NavigationDrawerItemBreadcrumb } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItemBreadcrumb';