@@ -28,6 +28,7 @@ interface DiskMonitorWidgetProps {
2828 selectedDisks ?: DiskSelection [ ] ;
2929 showIcons ?: boolean ;
3030 showMountPath ?: boolean ;
31+ showName ?: boolean ;
3132 layout ?: '2x2' | '2x4' | '1x5' ;
3233 dualWidgetPosition ?: 'top' | 'bottom' ;
3334 } ;
@@ -43,6 +44,7 @@ export const DiskMonitorWidget = ({ config, editMode }: DiskMonitorWidgetProps)
4344 // Get config options with defaults
4445 const selectedDisks = config ?. selectedDisks || [ ] ;
4546 const showIcons = config ?. showIcons !== false ;
47+ const showName = config ?. showName !== false ;
4648 const isDualWidget = config ?. dualWidgetPosition !== undefined ;
4749 // Force 2x2 layout for dual widgets to maintain standard widget height
4850 const layout = isDualWidget ? '2x2' : ( config ?. layout || '2x2' ) ;
@@ -311,25 +313,55 @@ export const DiskMonitorWidget = ({ config, editMode }: DiskMonitorWidgetProps)
311313 padding : '0 !important' , // Remove all default padding
312314 maxWidth : '100%' ,
313315 width : '100%' ,
316+ display : 'flex' ,
317+ flexDirection : 'column' ,
314318 ...( layout === '2x4' || layout === '1x5' ? {
315319 minHeight : DUAL_WIDGET_CONTAINER_HEIGHT . sm
316320 } : { } )
317321 } } >
318322 < Box sx = { {
319- display : 'flex' ,
320- flexDirection : 'column' ,
321- height : '100%' ,
323+ flex : 1 ,
322324 color : 'white' ,
323325 width : '100%' ,
324- padding : 2
326+ padding : 2 ,
327+ display : 'flex' ,
328+ alignItems : 'center' ,
329+ justifyContent : 'center' ,
330+ position : 'relative'
325331 } } >
332+
333+ { /* Conditionally rendered title */ }
334+ { showName && (
335+ < Box
336+ sx = { {
337+ position : 'absolute' ,
338+ top : layout === '2x2' ? 0 : 2.5 ,
339+ left : 16 ,
340+ color : 'white' ,
341+ fontSize : '1.1rem' ,
342+ zIndex : 1 ,
343+ display : 'flex' ,
344+ alignItems : 'center' ,
345+ gap : 0.5
346+ } }
347+ >
348+ < PiHardDrivesFill size = { 18 } color = 'white' />
349+ < Typography
350+ variant = 'h6'
351+ sx = { {
352+ color : 'white' ,
353+ fontSize : '1.1rem' ,
354+ } }
355+ >
356+ Disk Monitor
357+ </ Typography >
358+ </ Box >
359+ ) }
326360 { error ? (
327361 < Box sx = { {
328362 display : 'flex' ,
329- justifyContent : 'center' ,
330- alignItems : 'center' ,
331363 flexDirection : 'column' ,
332- flex : 1
364+ alignItems : 'center'
333365 } } >
334366 < Typography variant = 'body2' sx = { { textAlign : 'center' , mb : 1 } } >
335367 Configuration Error
@@ -338,77 +370,61 @@ export const DiskMonitorWidget = ({ config, editMode }: DiskMonitorWidgetProps)
338370 { error }
339371 </ Typography >
340372 </ Box >
373+ ) : ( gridDisks . length === 0 || isLoading ) ? (
374+ < Box sx = { {
375+ color : 'rgba(255,255,255,0.5)' ,
376+ fontSize : '0.85rem'
377+ } } >
378+ { isLoading ? 'Loading disks...' : 'No disks configured' }
379+ </ Box >
341380 ) : (
342- < >
343- { /* Empty/Loading state - only show when no disks or loading */ }
344- { ( gridDisks . length === 0 || isLoading ) && (
345- < Box sx = { {
346- display : 'flex' ,
347- justifyContent : 'center' ,
348- alignItems : 'center' ,
349- color : 'rgba(255,255,255,0.5)' ,
350- fontSize : '0.85rem' ,
351- flex : 1
352- } } >
353- { isLoading ? 'Loading disks...' : 'No disks configured' }
354- </ Box >
355- ) }
356-
357- { /* Disk items in grid - only show when not loading and has disks */ }
358- { ! isLoading && gridDisks . length > 0 && (
359- < Box sx = { {
360- display : 'flex' ,
361- alignItems : 'center' ,
362- justifyContent : 'center' ,
363- flex : 1 ,
364- width : '100%'
365- } } >
366- < Box sx = { {
367- width : '100%' ,
368- maxWidth : '100%'
369- } } >
370- < Grid container spacing = { layout === '2x2' ? 0.75 : layout === '2x4' ? 1 : 1.25 } sx = { {
371- height : 'fit-content' ,
372- width : '100%'
373- } } >
374- { gridDisks . map ( ( disk , index ) => {
375- const getGridSize = ( ) => {
376- switch ( layout ) {
377- case '2x2' : return 6 ; // 2 columns
378- case '2x4' : return 6 ; // 2 columns
379- case '1x5' : return 12 ; // 1 column
380- default : return 6 ;
381- }
382- } ;
381+ < Box sx = { {
382+ width : '100%' ,
383+ height : layout === '2x4' || layout === '1x5' ? '100%' : 'auto' ,
384+ display : 'flex' ,
385+ alignItems : 'center' ,
386+ justifyContent : 'center' ,
387+ mt : 3
388+ } } >
389+ < Grid container spacing = { layout === '2x2' ? 0.75 : 1 } sx = { {
390+ width : '100%' ,
391+ maxWidth : '100%'
392+ } } >
393+ { gridDisks . map ( ( disk , index ) => {
394+ const getGridSize = ( ) => {
395+ switch ( layout ) {
396+ case '2x2' : return 6 ; // 2 columns
397+ case '2x4' : return 6 ; // 2 columns
398+ case '1x5' : return 12 ; // 1 column
399+ default : return 6 ;
400+ }
401+ } ;
383402
384- // Determine alignment based on position
385- const getAlignment = ( ) => {
386- if ( layout === '1x5' ) return 'flex-start' ; // All left aligned for single column
403+ // Determine alignment based on position
404+ const getAlignment = ( ) => {
405+ if ( layout === '1x5' ) return 'flex-start' ; // All left aligned for single column
387406
388- // For 2-column layouts (2x2, 2x4)
389- const isLeftColumn = index % 2 === 0 ;
390- return isLeftColumn ? 'flex-start' : 'flex-end' ;
391- } ;
407+ // For 2-column layouts (2x2, 2x4)
408+ const isLeftColumn = index % 2 === 0 ;
409+ return isLeftColumn ? 'flex-start' : 'flex-end' ;
410+ } ;
392411
393- // Find the disk configuration
394- const diskConfig = selectedDisks . find ( d => d . mount === disk . mount ) || { mount : disk . mount , customName : disk . customName } ;
412+ // Find the disk configuration
413+ const diskConfig = selectedDisks . find ( d => d . mount === disk . mount ) || { mount : disk . mount , customName : disk . customName } ;
395414
396- return (
397- < Grid key = { disk . mount } size = { getGridSize ( ) } sx = { {
398- display : 'flex' ,
399- justifyContent : getAlignment ( ) ,
400- alignItems : 'stretch' ,
401- minHeight : layout === '2x2' ? '60px' : layout === '1x5' ? '55px' : '70px'
402- } } >
403- < DiskItem disk = { disk } diskConfig = { diskConfig } />
404- </ Grid >
405- ) ;
406- } ) }
415+ return (
416+ < Grid key = { disk . mount } size = { getGridSize ( ) } sx = { {
417+ display : 'flex' ,
418+ justifyContent : getAlignment ( ) ,
419+ alignItems : 'stretch' ,
420+ // minHeight: layout === '2x2' ? '60px' : layout === '1x5' ? '100%' : '100%'
421+ } } >
422+ < DiskItem disk = { disk } diskConfig = { diskConfig } />
407423 </ Grid >
408- </ Box >
409- </ Box >
410- ) }
411- </ >
424+ ) ;
425+ } ) }
426+ </ Grid >
427+ </ Box >
412428 ) }
413429 </ Box >
414430 </ CardContent >
0 commit comments