From f79165ff283393e95c788a9a346ddffb7613c50e Mon Sep 17 00:00:00 2001 From: martmull Date: Mon, 10 Mar 2025 17:40:27 +0100 Subject: [PATCH] 450 merge first second tab on side panel (#10757) Closes https://github.com/twentyhq/core-team-issues/issues/450 ## Before https://github.com/user-attachments/assets/9b3b8fe7-0cf6-49b7-9f1b-d263b8f65dde ## After https://github.com/user-attachments/assets/b8e48cae-0661-4fc2-912b-bf091d94bde6 --- .../hooks/useRecordShowContainerTabs.ts | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/packages/twenty-front/src/modules/object-record/record-show/hooks/useRecordShowContainerTabs.ts b/packages/twenty-front/src/modules/object-record/record-show/hooks/useRecordShowContainerTabs.ts index 7d0ae3ec1..a4d175e41 100644 --- a/packages/twenty-front/src/modules/object-record/record-show/hooks/useRecordShowContainerTabs.ts +++ b/packages/twenty-front/src/modules/object-record/record-show/hooks/useRecordShowContainerTabs.ts @@ -15,6 +15,7 @@ import { IconNotes, IconPrinter, IconSettings, + IconHome, } from 'twenty-ui'; import { FieldMetadataType } from '~/generated-metadata/graphql'; import { FeatureFlagKey } from '~/generated/graphql'; @@ -38,7 +39,7 @@ export const useRecordShowContainerTabs = ( tabs: { richText: { title: 'Note', - position: 0, + position: 101, Icon: IconNotes, cards: [{ type: CardType.RichTextCard }], hide: { @@ -58,7 +59,7 @@ export const useRecordShowContainerTabs = ( tabs: { richText: { title: 'Note', - position: 0, + position: 101, Icon: IconNotes, cards: [{ type: CardType.RichTextCard }], hide: { @@ -287,6 +288,27 @@ export const useRecordShowContainerTabs = ( requiredObjectsInactive || relationsDontExist, }; - }), + }) + // When isInRightDrawer === true, we merge first and second tab into first tab + .reduce((acc, tab, index, array) => { + if (isInRightDrawer && array.length > 1) { + if (index === 0) { + return [ + ...acc, + { + id: 'home', + title: 'Home', + Icon: IconHome, + cards: [...tab.cards, ...array[1].cards], + hide: false, + }, + ]; + } + if (index === 1) { + return acc; + } + } + return [...acc, tab]; + }, []), }; };