Update pageLayout* data models for backend recordPageLayout refactor (#17446)
<img width="814" height="356" alt="Screenshot 2026-01-26 at 16 09 27" src="https://github.com/user-attachments/assets/91d95a1d-cc33-4bf0-a63e-4d1815030983" />
This commit is contained in:
@@ -2,11 +2,14 @@ import { type PageLayoutTabLayoutMode } from '@/page-layout/types/PageLayoutTabL
|
||||
import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget';
|
||||
import { type PageLayoutTab as PageLayoutTabGenerated } from '~/generated/graphql';
|
||||
|
||||
export type PageLayoutTab = Omit<PageLayoutTabGenerated, 'widgets'> & {
|
||||
export type PageLayoutTab = Omit<
|
||||
PageLayoutTabGenerated,
|
||||
'widgets' | 'layoutMode'
|
||||
> & {
|
||||
widgets: PageLayoutWidget[];
|
||||
/**
|
||||
* Only available behind IS_RECORD_PAGE_LAYOUT_ENABLED for now.
|
||||
*/
|
||||
layoutMode?: PageLayoutTabLayoutMode;
|
||||
icon?: string;
|
||||
icon?: string | null;
|
||||
};
|
||||
|
||||
@@ -9,11 +9,14 @@ export const transformPageLayout = (
|
||||
...pageLayout,
|
||||
tabs: (pageLayout.tabs ?? [])
|
||||
.toSorted((a, b) => a.position - b.position)
|
||||
.map(
|
||||
(tab): PageLayoutTab => ({
|
||||
...tab,
|
||||
.map((tab): PageLayoutTab => {
|
||||
// TODO: remove this once the frontend consumes the new type
|
||||
const { layoutMode: _layoutMode, ...tabWithoutLayoutMode } = tab;
|
||||
|
||||
return {
|
||||
...tabWithoutLayoutMode,
|
||||
widgets: tab.widgets ?? [],
|
||||
}),
|
||||
),
|
||||
};
|
||||
}),
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user