diff --git a/client/src/pages/dashboard/components/DashboardGrid/DashboardGrid.tsx b/client/src/pages/dashboard/components/DashboardGrid/DashboardGrid.tsx index d6a0485..2dd73de 100644 --- a/client/src/pages/dashboard/components/DashboardGrid/DashboardGrid.tsx +++ b/client/src/pages/dashboard/components/DashboardGrid/DashboardGrid.tsx @@ -1,3 +1,4 @@ +import { GRID_WIDTH, GRID_H_SNAP } from '../../constants' import { useDashboardContext } from '../../contexts/DashboardContext' import { normalizeBoxes } from '../../utils/normalizeBoxes' import { NoDashboard } from '../NoDashboard' @@ -6,9 +7,29 @@ import { GeneralBox } from './components/GeneralBox' export const DashboardGrid = () => { const { isDashboardSelected, boxes, setBoxes } = useDashboardContext() + const addNewBox = () => { + const box = { + id: new Date().getTime().toString(), + x: 0, + y: 0, + w: GRID_WIDTH / 2, + h: GRID_H_SNAP * 20, + } + + setBoxes((previous) => [box, ...previous]) + } + return isDashboardSelected ? (