import { GridStack } from 'fily-publish-gridstack'; import { MutableRefObject, RefObject } from 'react'; import { AppType } from '../../../types/app'; import Widgets from '../../../widgets'; import { IWidget, IWidgetDefinition } from '../../../widgets/widgets'; import { WidgetWrapper } from '../../../widgets/WidgetWrapper'; import { appTileDefinition } from '../Tiles/Apps/AppTile'; import { GridstackTileWrapper } from '../Tiles/TileWrapper'; import { useGridstackStore } from './gridstack/store'; interface WrapperContentProps { apps: AppType[]; widgets: IWidget[]; refs: { wrapper: RefObject; items: MutableRefObject>>; gridstack: MutableRefObject; }; } export function WrapperContent({ apps, refs, widgets }: WrapperContentProps) { const shapeSize = useGridstackStore((x) => x.currentShapeSize); if (!shapeSize) return null; return ( <> {apps?.map((app) => { const { component: TileComponent, ...tile } = appTileDefinition; return ( ); })} {widgets.map((widget) => { const definition = Widgets[widget.id as keyof typeof Widgets] as | IWidgetDefinition | undefined; if (!definition) return null; return ( ); })} ); }