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:
@ -8,6 +8,7 @@ import {
|
|||||||
IconRotate2,
|
IconRotate2,
|
||||||
IconTag,
|
IconTag,
|
||||||
MenuItem,
|
MenuItem,
|
||||||
|
useIcons,
|
||||||
} from 'twenty-ui';
|
} from 'twenty-ui';
|
||||||
|
|
||||||
import { useObjectNamePluralFromSingular } from '@/object-metadata/hooks/useObjectNamePluralFromSingular';
|
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 { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator';
|
||||||
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
|
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
|
||||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||||
|
import { useGetCurrentView } from '@/views/hooks/useGetCurrentView';
|
||||||
import { ViewType } from '@/views/types/ViewType';
|
import { ViewType } from '@/views/types/ViewType';
|
||||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||||
|
|
||||||
@ -41,6 +43,12 @@ export const ObjectOptionsDropdownMenuContent = () => {
|
|||||||
|
|
||||||
const isViewGroupEnabled = useIsFeatureEnabled('IS_VIEW_GROUPS_ENABLED');
|
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({
|
const { objectNamePlural } = useObjectNamePluralFromSingular({
|
||||||
objectNameSingular: objectMetadataItem.nameSingular,
|
objectNameSingular: objectMetadataItem.nameSingular,
|
||||||
});
|
});
|
||||||
@ -84,8 +92,8 @@ export const ObjectOptionsDropdownMenuContent = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DropdownMenuHeader StartIcon={IconList}>
|
<DropdownMenuHeader StartIcon={CurrentViewIcon ?? IconList}>
|
||||||
{objectMetadataItem.labelPlural}
|
{currentView?.name}
|
||||||
</DropdownMenuHeader>
|
</DropdownMenuHeader>
|
||||||
{/** TODO: Should be removed when view settings contains more options */}
|
{/** TODO: Should be removed when view settings contains more options */}
|
||||||
{viewType === ViewType.Kanban && (
|
{viewType === ViewType.Kanban && (
|
||||||
|
|||||||
Reference in New Issue
Block a user