@@ -29,7 +29,7 @@ import PolarChart from '../components/ChartbrewCharts/PolarChart';
2929import DoughnutChart from '../components/ChartbrewCharts/DoughnutChart' ;
3030import Illo from '../components/Illo' ;
3131import KpiChart from '../components/ChartbrewCharts/KpiChart' ;
32- import { widthSize } from '../utils/layoutBreakpoints' ;
32+ import { widthSize , heightSize , cols , margin } from '../utils/layoutBreakpoints' ;
3333
3434const ResponsiveGridLayout = WidthProvider ( Responsive , { measureBeforeMount : true } ) ;
3535
@@ -45,7 +45,7 @@ function Dashboard() {
4545 const [ team , setTeam ] = useState ( { } ) ;
4646 const [ teams , setTeams ] = useState ( [ ] ) ;
4747 const [ dropdownTeam , setDropdownTeam ] = useState ( '' ) ;
48- const [ layouts , setLayouts ] = useState ( { xxs : [ ] , xs : [ ] , sm : [ ] , md : [ ] , lg : [ ] } ) ;
48+ const [ layouts , setLayouts ] = useState ( null ) ;
4949
5050 useEffect ( ( ) => {
5151 getSettings ( ) . then ( ( data ) => setStore ( data ) ) ;
@@ -87,7 +87,11 @@ function Dashboard() {
8787 useEffect ( ( ) => {
8888 if ( charts && charts . length > 0 ) {
8989 // set the grid layout
90- const newLayouts = { xxs : [ ] , xs : [ ] , sm : [ ] , md : [ ] , lg : [ ] } ;
90+ const newLayouts = Object . keys ( widthSize ) . reduce ( ( acc , key ) => {
91+ acc [ key ] = [ ] ;
92+ return acc ;
93+ } , { } ) ;
94+
9195 charts . forEach ( ( chart ) => {
9296 if ( chart . layout ) {
9397 Object . keys ( chart . layout ) . forEach ( ( key ) => {
@@ -305,9 +309,9 @@ function Dashboard() {
305309 < ResponsiveGridLayout
306310 className = "layout"
307311 layouts = { layouts }
308- margin = { { lg : [ 12 , 12 ] , md : [ 12 , 12 ] , sm : [ 12 , 12 ] , xs : [ 12 , 12 ] , xxs : [ 12 , 12 ] } }
312+ margin = { margin }
309313 breakpoints = { widthSize }
310- cols = { { lg : 12 , md : 10 , sm : 8 , xs : 6 , xxs : 4 } }
314+ cols = { cols }
311315 rowHeight = { 150 }
312316 isDraggable = { false }
313317 isResizable = { false }
0 commit comments