mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-05-07 03:59:35 +00:00
0dcc613843
- Created new test files for `page-renderer.layout.test.ts`, `page-renderer.lifecycle.test.ts`, and `page-renderer.permissions.test.ts` to cover various functionalities of the PageRenderer class. - Implemented tests for registering pages, loading pages from the database, filtering pages by level, and checking permissions based on user roles. - Removed the old `page-renderer.test.ts` file to streamline test organization and improve maintainability. refactor(schema): reorganize schema utility functions and add tests - Introduced a new structure for schema utility functions, grouping them into directories based on their functionality (e.g., `field`, `model`, `record`). - Added tests for schema utilities, including validation, serialization, and migration functions. - Created mock data for testing schema-related functionalities, ensuring comprehensive coverage of edge cases and expected behaviors. - Added backward compatibility for schema utilities through a new entry point. chore: clean up unused code and improve code organization - Removed redundant code and improved the organization of schema utility functions for better readability and maintainability. - Ensured all functions are properly imported and exported from their respective directories.
100 lines
2.0 KiB
TypeScript
100 lines
2.0 KiB
TypeScript
import type { ComponentInstance } from '@/lib/types/builder-types'
|
|
|
|
export const buildHeaderActions = (): ComponentInstance[] => [
|
|
{
|
|
id: 'header_login_btn',
|
|
type: 'Button',
|
|
props: {
|
|
children: 'Login',
|
|
variant: 'default',
|
|
size: 'sm',
|
|
},
|
|
children: [],
|
|
},
|
|
]
|
|
|
|
export const buildProfileCard = (): ComponentInstance => ({
|
|
id: 'comp_profile',
|
|
type: 'Card',
|
|
props: {
|
|
className: 'p-6',
|
|
},
|
|
children: [
|
|
{
|
|
id: 'comp_profile_header',
|
|
type: 'Heading',
|
|
props: {
|
|
level: 2,
|
|
children: 'User Profile',
|
|
className: 'text-2xl font-bold mb-4',
|
|
},
|
|
children: [],
|
|
},
|
|
{
|
|
id: 'comp_profile_content',
|
|
type: 'Container',
|
|
props: {
|
|
className: 'space-y-4',
|
|
},
|
|
children: [
|
|
{
|
|
id: 'comp_profile_bio',
|
|
type: 'Textarea',
|
|
props: {
|
|
placeholder: 'Tell us about yourself...',
|
|
className: 'min-h-32',
|
|
},
|
|
children: [],
|
|
},
|
|
{
|
|
id: 'comp_profile_save',
|
|
type: 'Button',
|
|
props: {
|
|
children: 'Save Profile',
|
|
variant: 'default',
|
|
},
|
|
children: [],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
})
|
|
|
|
export const buildCommentsCard = (): ComponentInstance => ({
|
|
id: 'comp_comments',
|
|
type: 'Card',
|
|
props: {
|
|
className: 'p-6',
|
|
},
|
|
children: [
|
|
{
|
|
id: 'comp_comments_header',
|
|
type: 'Heading',
|
|
props: {
|
|
level: 2,
|
|
children: 'Community Comments',
|
|
className: 'text-2xl font-bold mb-4',
|
|
},
|
|
children: [],
|
|
},
|
|
{
|
|
id: 'comp_comments_input',
|
|
type: 'Textarea',
|
|
props: {
|
|
placeholder: 'Share your thoughts...',
|
|
className: 'mb-4',
|
|
},
|
|
children: [],
|
|
},
|
|
{
|
|
id: 'comp_comments_post',
|
|
type: 'Button',
|
|
props: {
|
|
children: 'Post Comment',
|
|
variant: 'default',
|
|
},
|
|
children: [],
|
|
},
|
|
],
|
|
})
|