closes https://github.com/twentyhq/core-team-issues/issues/2182 https://github.com/user-attachments/assets/babf154c-9cda-40ff-b2e8-5053e447c35f
33 lines
821 B
TypeScript
33 lines
821 B
TypeScript
import {
|
|
type GridPosition,
|
|
WidgetConfigurationType,
|
|
WidgetType,
|
|
} from '~/generated/graphql';
|
|
import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget';
|
|
|
|
export const createDefaultFrontComponentWidget = (
|
|
id: string,
|
|
pageLayoutTabId: string,
|
|
title: string,
|
|
frontComponentId: string,
|
|
gridPosition: GridPosition,
|
|
): PageLayoutWidget => {
|
|
return {
|
|
__typename: 'PageLayoutWidget',
|
|
id,
|
|
pageLayoutTabId,
|
|
title,
|
|
type: WidgetType.FRONT_COMPONENT,
|
|
configuration: {
|
|
__typename: 'FrontComponentConfiguration',
|
|
configurationType: WidgetConfigurationType.FRONT_COMPONENT,
|
|
frontComponentId,
|
|
},
|
|
gridPosition,
|
|
objectMetadataId: null,
|
|
createdAt: new Date().toISOString(),
|
|
updatedAt: new Date().toISOString(),
|
|
deletedAt: null,
|
|
};
|
|
};
|