Fix : Small fixes for the options menu (#8983)

Fix #8789 : fixed options menu with current view hook to fetch the view
name

---------

Co-authored-by: Félix Malfait <felix@twenty.com>
This commit is contained in:
Suhotra Dey
2024-12-10 13:49:46 +05:30
committed by GitHub
parent 0654d814c6
commit f4ef51fbe5

View File

@ -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 (
<>
<DropdownMenuHeader StartIcon={IconList}>
{objectMetadataItem.labelPlural}
<DropdownMenuHeader StartIcon={CurrentViewIcon ?? IconList}>
{currentView?.name}
</DropdownMenuHeader>
{/** TODO: Should be removed when view settings contains more options */}
{viewType === ViewType.Kanban && (