Skip to content

The open alternative to Salesforce, designed for AI.

450 merge first second tab on side panel (#10757)

martmullf79165ff2833
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 7d0ae3ec1b2..a4d175e41de 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<SingleTabProps[]>((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];
+ }, []),
};
};