29e48e16ba
fixes https://github.com/twentyhq/twenty/issues/22251 **Summary** - Fixes #22251 — NavigationMenuItem with type PAGE_LAYOUT returns 404 "Off track" for custom standalone pages - Makes type a required field in PageLayoutManifest instead of relying on a fallback default to RECORD_PAGE - Adds PageLayoutType enum to twenty-shared and exports it from the SDK for app developers - Adds build-time validation in definePageLayout to reject manifests missing type - Updates the CLI add command to prompt users to select a page layout type interactively **Root cause** When definePageLayout was called without type, the manifest converter defaulted to RECORD_PAGE. The frontend route guard at /page/:id then rejected it (only STANDALONE_PAGE is allowed), producing a 404. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/twentyhq/twenty/pull/22450?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
27 lines
534 B
TypeScript
27 lines
534 B
TypeScript
import { type PageLayoutType } from 'twenty-shared/types';
|
|
import { v4 as uuidv4 } from 'uuid';
|
|
|
|
export const getPageLayoutBaseFile = ({
|
|
name,
|
|
type,
|
|
}: {
|
|
name: string;
|
|
type: PageLayoutType;
|
|
}) => {
|
|
return `import { definePageLayout, PageLayoutType } from 'twenty-sdk/define';
|
|
|
|
export default definePageLayout({
|
|
universalIdentifier: '${uuidv4()}',
|
|
name: '${name}',
|
|
type: PageLayoutType.${type},
|
|
tabs: [
|
|
{
|
|
universalIdentifier: '${uuidv4()}',
|
|
title: 'Overview',
|
|
widgets: [],
|
|
},
|
|
],
|
|
});
|
|
`;
|
|
};
|