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
This commit is contained in:
@ -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];
|
||||
}, []),
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user