From f4ef51fbe5c38c2e94ff311af7a631180938f049 Mon Sep 17 00:00:00 2001 From: Suhotra Dey <50608734+Lucifer4255@users.noreply.github.com> Date: Tue, 10 Dec 2024 13:49:46 +0530 Subject: [PATCH] Fix : Small fixes for the options menu (#8983) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix #8789 : fixed options menu with current view hook to fetch the view name --------- Co-authored-by: Félix Malfait --- .../components/ObjectOptionsDropdownMenuContent.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownMenuContent.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownMenuContent.tsx index b9f2d078c..f4cfe784f 100644 --- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownMenuContent.tsx +++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownMenuContent.tsx @@ -8,6 +8,7 @@ import { IconRotate2, IconTag, MenuItem, + useIcons, } from 'twenty-ui'; import { useObjectNamePluralFromSingular } from '@/object-metadata/hooks/useObjectNamePluralFromSingular'; @@ -27,6 +28,7 @@ import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/Drop import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator'; import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys'; import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2'; +import { useGetCurrentView } from '@/views/hooks/useGetCurrentView'; import { ViewType } from '@/views/types/ViewType'; import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; @@ -41,6 +43,12 @@ export const ObjectOptionsDropdownMenuContent = () => { const isViewGroupEnabled = useIsFeatureEnabled('IS_VIEW_GROUPS_ENABLED'); + const { getIcon } = useIcons(); + const { currentViewWithCombinedFiltersAndSorts: currentView } = + useGetCurrentView(); + + const CurrentViewIcon = currentView?.icon ? getIcon(currentView.icon) : null; + const { objectNamePlural } = useObjectNamePluralFromSingular({ objectNameSingular: objectMetadataItem.nameSingular, }); @@ -84,8 +92,8 @@ export const ObjectOptionsDropdownMenuContent = () => { return ( <> - - {objectMetadataItem.labelPlural} + + {currentView?.name} {/** TODO: Should be removed when view settings contains more options */} {viewType === ViewType.Kanban && (