Add example in create-twenty-app (#18043)
- add interactive mode to create-twenty-app - by default create an example for each entities <img width="1181" height="168" alt="image" src="https://github.com/user-attachments/assets/a2490d8f-66a1-4cd5-bf41-57166cc20a1e" />
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import kebabCase from 'lodash.kebabcase';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
export const getNavigationMenuItemBaseFile = ({
|
||||
name,
|
||||
universalIdentifier = v4(),
|
||||
}: {
|
||||
name: string;
|
||||
universalIdentifier?: string;
|
||||
}) => {
|
||||
const kebabCaseName = kebabCase(name);
|
||||
|
||||
return `import { defineNavigationMenuItem } from 'twenty-sdk';
|
||||
|
||||
export default defineNavigationMenuItem({
|
||||
universalIdentifier: '${universalIdentifier}',
|
||||
name: '${kebabCaseName}',
|
||||
icon: 'IconList',
|
||||
position: 0,
|
||||
// Link to a view:
|
||||
// viewUniversalIdentifier: '...',
|
||||
// Or link to an object:
|
||||
// targetObjectUniversalIdentifier: '...',
|
||||
// Or link to an external URL:
|
||||
// link: 'https://example.com',
|
||||
});
|
||||
`;
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
import kebabCase from 'lodash.kebabcase';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
export const getViewBaseFile = ({
|
||||
name,
|
||||
universalIdentifier = v4(),
|
||||
}: {
|
||||
name: string;
|
||||
universalIdentifier?: string;
|
||||
}) => {
|
||||
const kebabCaseName = kebabCase(name);
|
||||
|
||||
return `import { defineView } from 'twenty-sdk';
|
||||
|
||||
export default defineView({
|
||||
universalIdentifier: '${universalIdentifier}',
|
||||
name: '${kebabCaseName}',
|
||||
objectUniversalIdentifier: 'fill-later',
|
||||
icon: 'IconList',
|
||||
position: 0,
|
||||
// fields: [
|
||||
// {
|
||||
// universalIdentifier: '...',
|
||||
// fieldMetadataUniversalIdentifier: '...',
|
||||
// position: 0,
|
||||
// isVisible: true,
|
||||
// },
|
||||
// ],
|
||||
// filters: [
|
||||
// {
|
||||
// universalIdentifier: '...',
|
||||
// fieldMetadataUniversalIdentifier: '...',
|
||||
// operand: 'Contains',
|
||||
// value: '',
|
||||
// },
|
||||
// ],
|
||||
});
|
||||
`;
|
||||
};
|
||||
Reference in New Issue
Block a user