b9bdb12b3c
- DIsplay the tab bar only if more than 1 tabs can be displayed - Remove the selfDisplayMode feature: the first tab is now considered to be the pinned tab on record pages https://github.com/user-attachments/assets/3f61931d-fde4-4065-b646-5b3a7bdebcc0
35 lines
826 B
TypeScript
35 lines
826 B
TypeScript
import { type DraftPageLayout } from '@/page-layout/types/draft-page-layout';
|
|
import { type PageLayout } from '@/page-layout/types/PageLayout';
|
|
import { PageLayoutType } from '~/generated/graphql';
|
|
|
|
type GetTabsByDisplayModeParams = {
|
|
pageLayout: PageLayout | DraftPageLayout;
|
|
isMobile: boolean;
|
|
isInRightDrawer: boolean;
|
|
};
|
|
|
|
export const getTabsByDisplayMode = ({
|
|
pageLayout,
|
|
isMobile,
|
|
isInRightDrawer,
|
|
}: GetTabsByDisplayModeParams) => {
|
|
if (
|
|
isMobile ||
|
|
isInRightDrawer ||
|
|
pageLayout.type !== PageLayoutType.RECORD_PAGE
|
|
) {
|
|
return {
|
|
tabsToRenderInTabList: pageLayout.tabs,
|
|
pinnedLeftTab: undefined,
|
|
};
|
|
}
|
|
|
|
const tabsToRenderInTabList = pageLayout.tabs.slice(1);
|
|
const pinnedLeftTab = pageLayout.tabs[0];
|
|
|
|
return {
|
|
tabsToRenderInTabList,
|
|
pinnedLeftTab,
|
|
};
|
|
};
|