From 5e2981f06e2a39f9e2ac63d21eae8337c0a3f228 Mon Sep 17 00:00:00 2001 From: Marie Stoppa Date: Thu, 4 Jul 2024 11:12:40 +0200 Subject: [PATCH] Navigate to field settings page on Go to Settings --- .../view-picker/hooks/useGetAvailableFieldsForKanban.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/twenty-front/src/modules/views/view-picker/hooks/useGetAvailableFieldsForKanban.ts b/packages/twenty-front/src/modules/views/view-picker/hooks/useGetAvailableFieldsForKanban.ts index d5044bd19639..9b4ddbe2c5fb 100644 --- a/packages/twenty-front/src/modules/views/view-picker/hooks/useGetAvailableFieldsForKanban.ts +++ b/packages/twenty-front/src/modules/views/view-picker/hooks/useGetAvailableFieldsForKanban.ts @@ -6,6 +6,7 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadat import { navigationMemorizedUrlState } from '@/ui/navigation/states/navigationMemorizedUrlState'; import { useViewStates } from '@/views/hooks/internal/useViewStates'; import { FieldMetadataType } from '~/generated-metadata/graphql'; +import { isDefined } from '~/utils/isDefined'; export const useGetAvailableFieldsForKanban = () => { const { viewObjectMetadataIdState } = useViewStates(); @@ -31,7 +32,13 @@ export const useGetAvailableFieldsForKanban = () => { const navigateToSelectSettings = useCallback(() => { setNavigationMemorizedUrl(location.pathname + location.search); - navigate(`/settings/objects/${objectMetadataItem?.namePlural}`); + if (isDefined(objectMetadataItem?.namePlural)) { + navigate( + `/settings/objects/${objectMetadataItem?.namePlural}/new-field/step-2`, + ); + } else { + navigate(`/settings/objects`); + } }, [ navigate, objectMetadataItem?.namePlural,