@@ -23,8 +23,14 @@ import { useAppStore } from '@/layouts/MainLayout/providers/AppProvider';
23
23
import { EditTileType , ImportDashboardType , Tile as TileType } from '@/@types/parseable/api/dashboards' ;
24
24
import { templates } from './assets/templates' ;
25
25
26
- const { toggleCreateDashboardModal, toggleCreateTileModal, toggleDuplicateTileModal, toggleDeleteTileModal, handlePaging, toggleImportDashboardModal } =
27
- dashboardsStoreReducers ;
26
+ const {
27
+ toggleCreateDashboardModal,
28
+ toggleCreateTileModal,
29
+ toggleDuplicateTileModal,
30
+ toggleDeleteTileModal,
31
+ handlePaging,
32
+ toggleImportDashboardModal,
33
+ } = dashboardsStoreReducers ;
28
34
29
35
const TilesView = ( props : { onLayoutChange : ( layout : Layout [ ] ) => void } ) => {
30
36
const [ activeDashboard , setDashbaordsStore ] = useDashboardsStore ( ( store ) => store . activeDashboard ) ;
@@ -66,7 +72,7 @@ const TilesView = (props: { onLayoutChange: (layout: Layout[]) => void }) => {
66
72
if ( showNoTilesView ) return < NoTilesView /> ;
67
73
68
74
return (
69
- < Stack ref = { scrollRef } className = { classes . tilesViewConatiner } style = { { overflowY : 'scroll' } } >
75
+ < Stack ref = { scrollRef } className = { classes . tilesViewContainer } style = { { overflowY : 'scroll' } } >
70
76
< GridLayout
71
77
className = "layout"
72
78
layout = { layout }
@@ -151,7 +157,10 @@ const DeleteTileModal = () => {
151
157
) ;
152
158
} ;
153
159
154
- const DashboardTemplates = ( props : { onImport : ( template : ImportDashboardType ) => void ; isImportingDashboard : boolean } ) => {
160
+ const DashboardTemplates = ( props : {
161
+ onImport : ( template : ImportDashboardType ) => void ;
162
+ isImportingDashboard : boolean ;
163
+ } ) => {
155
164
return (
156
165
< Stack gap = { 0 } mt = { 6 } >
157
166
{ _ . map ( templates , ( template ) => {
@@ -174,12 +183,12 @@ const DashboardTemplates = (props: {onImport: (template: ImportDashboardType) =>
174
183
} ) }
175
184
</ Stack >
176
185
) ;
177
- }
186
+ } ;
178
187
179
188
const ImportDashboardModal = ( ) => {
180
189
const [ importDashboardModalOpen , setDashboardStore ] = useDashboardsStore ( ( store ) => store . importDashboardModalOpen ) ;
181
190
const [ activeDashboard ] = useDashboardsStore ( ( store ) => store . activeDashboard ) ;
182
- const [ isStandAloneMode ] = useAppStore ( store => store . isStandAloneMode )
191
+ const [ isStandAloneMode ] = useAppStore ( ( store ) => store . isStandAloneMode ) ;
183
192
const [ file , setFile ] = useState < File | null > ( null ) ;
184
193
const closeModal = useCallback ( ( ) => {
185
194
setDashboardStore ( ( store ) => toggleImportDashboardModal ( store , false ) ) ;
@@ -208,9 +217,9 @@ const ImportDashboardModal = () => {
208
217
const newDashboard : ImportDashboardType = JSON . parse ( target . result ) ;
209
218
if ( _ . isEmpty ( newDashboard ) ) return ;
210
219
211
- return makePostCall ( newDashboard )
220
+ return makePostCall ( newDashboard ) ;
212
221
} catch ( error ) {
213
- console . log ( " error" , error )
222
+ console . log ( ' error' , error ) ;
214
223
}
215
224
} ;
216
225
reader . readAsText ( file ) ;
@@ -336,13 +345,13 @@ const InvalidDashboardView = () => {
336
345
} ;
337
346
338
347
const findTileByTileId = ( tiles : TileType [ ] , tileId : string | null ) => {
339
- return _ . find ( tiles , tile => tile . tile_id === tileId )
340
- }
348
+ return _ . find ( tiles , ( tile ) => tile . tile_id === tileId ) ;
349
+ } ;
341
350
342
351
const DuplicateTileModal = ( ) => {
343
- const [ duplicateTileModalOpen , setDashboardsStore ] = useDashboardsStore ( store => store . duplicateTileModalOpen )
344
- const [ editTileId ] = useDashboardsStore ( store => store . editTileId ) ;
345
- const [ activeDashboard ] = useDashboardsStore ( store => store . activeDashboard )
352
+ const [ duplicateTileModalOpen , setDashboardsStore ] = useDashboardsStore ( ( store ) => store . duplicateTileModalOpen ) ;
353
+ const [ editTileId ] = useDashboardsStore ( ( store ) => store . editTileId ) ;
354
+ const [ activeDashboard ] = useDashboardsStore ( ( store ) => store . activeDashboard ) ;
346
355
const [ inputValue , setInputValue ] = useState < string > ( '' ) ;
347
356
const onClose = useCallback ( ( ) => {
348
357
setDashboardsStore ( ( store ) => toggleDuplicateTileModal ( store , false , null ) ) ;
@@ -399,7 +408,9 @@ const DuplicateTileModal = () => {
399
408
</ Button >
400
409
</ Box >
401
410
< Box >
402
- < Button onClick = { handleSubmit } loading = { isUpdatingDashboard } disabled = { _ . isEmpty ( inputValue ) } > Done</ Button >
411
+ < Button onClick = { handleSubmit } loading = { isUpdatingDashboard } disabled = { _ . isEmpty ( inputValue ) } >
412
+ Done
413
+ </ Button >
403
414
</ Box >
404
415
</ Stack >
405
416
</ Stack >
@@ -422,9 +433,9 @@ const Dashboard = () => {
422
433
return (
423
434
< Stack style = { { flex : 1 } } gap = { 0 } >
424
435
< DeleteTileModal />
425
- < DuplicateTileModal />
436
+ < DuplicateTileModal />
426
437
< Toolbar layoutRef = { layoutRef } />
427
- < ImportDashboardModal />
438
+ < ImportDashboardModal />
428
439
{ activeDashboard ? < TilesView onLayoutChange = { onLayoutChange } /> : < InvalidDashboardView /> }
429
440
</ Stack >
430
441
) ;
0 commit comments