import { Card } from '@mantine/core'; import { RefObject } from 'react'; import { Tiles } from '../../Tiles/tilesDefinitions'; import { GridstackTileWrapper } from '../../Tiles/TileWrapper'; import { useGridstack } from '../gridstack/use-gridstack'; interface DashboardSidebarProps { location: 'right' | 'left'; } export const DashboardSidebar = ({ location }: DashboardSidebarProps) => { const { refs, items, integrations } = useGridstack('sidebar', location); const minRow = useMinRowForFullHeight(refs.wrapper); return (
{items.map((app) => { const { component: TileComponent, ...tile } = Tiles['app']; return ( ); })} {Object.entries(integrations).map(([k, v]) => { const { component: TileComponent, ...tile } = Tiles[k as keyof typeof Tiles]; return ( ); })}
); }; const useMinRowForFullHeight = (wrapperRef: RefObject) => { return wrapperRef.current ? Math.floor(wrapperRef.current!.offsetHeight / 64) : 2; };