bfe1f47065
In this PR: - Pass `layoutMode` and `tabId` via PageLayoutContentContext provider - Getting `pageLayoutType` from the current page layout - Getting isInPinnedTab through `useIsInPinnedTab` hook ## Before <img width="3456" height="2160" alt="CleanShot 2025-11-06 at 14 22 44@2x" src="https://github.com/user-attachments/assets/763bb413-5739-45ef-85ed-82a72415886f" /> ## After <img width="3456" height="2162" alt="CleanShot 2025-11-06 at 14 20 38@2x" src="https://github.com/user-attachments/assets/eee6cccd-9d36-426e-a22f-400e8f7f9413" /> --------- Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
23 lines
738 B
TypeScript
23 lines
738 B
TypeScript
import { type PageLayoutTab } from '@/page-layout/types/PageLayoutTab';
|
|
import { type PageLayoutTabLayoutMode } from '@/page-layout/types/PageLayoutTabLayoutMode';
|
|
import { assertPageLayoutTabHasDefinedLayoutModeOrThrow } from '@/page-layout/utils/assertPageLayoutTabHasDefinedLayoutModeOrThrow';
|
|
import { PageLayoutType } from '~/generated/graphql';
|
|
|
|
type GetTabLayoutModeParams = {
|
|
tab: PageLayoutTab | undefined;
|
|
pageLayoutType: PageLayoutType;
|
|
};
|
|
|
|
export const getTabLayoutMode = ({
|
|
tab,
|
|
pageLayoutType,
|
|
}: GetTabLayoutModeParams): PageLayoutTabLayoutMode => {
|
|
if (pageLayoutType === PageLayoutType.RECORD_PAGE) {
|
|
assertPageLayoutTabHasDefinedLayoutModeOrThrow(tab);
|
|
|
|
return tab.layoutMode;
|
|
}
|
|
|
|
return 'grid';
|
|
};
|