11import type { FieldPath } from 'juststore'
2- import { Clock , Cpu , HardDrive , type LucideIcon , MemoryStick } from 'lucide-react'
2+ import { Clock , Cpu , HardDrive , type LucideIcon , MemoryStick , Wifi } from 'lucide-react'
33import { Suspense } from 'react'
44import { Card , CardContent , CardHeader , CardTitle } from '@/components/ui/card'
5- import { useIsMobile } from '@/hooks/use-mobile'
65import { formatDuration } from '@/lib/format'
76import SystemStatsProvider from './SystemStatsProvider'
87import SystemStatValue from './SystemStatValue'
@@ -33,8 +32,10 @@ function SystemStatsMobile() {
3332}
3433
3534function SystemStatsDesktop ( ) {
35+ const hasSecondaryDisk = Boolean ( store . systemInfo . secondaryPartitionUsageDesc . use ( ) )
36+
3637 return (
37- < div className = "hidden sm:grid grid-cols-2 gap-2 px-1 sm:grid-cols-4 sm:gap-4" >
38+ < div className = "hidden sm:grid grid-cols-2 gap-2 px-1 sm:grid-cols-5 sm:gap-4" >
3839 { statsProps . map ( stat => (
3940 < Card key = { stat . key } size = "sm" className = "h-full" >
4041 < CardHeader >
@@ -46,11 +47,28 @@ function SystemStatsDesktop() {
4647 </ div >
4748 </ CardHeader >
4849 < CardContent className = "space-y-1.5 sm:space-y-2" >
49- < SystemStatValue
50- valueKey = { stat . key }
51- descriptionKey = { stat . descriptionKey }
52- type = { stat . type }
53- />
50+ { stat . key === 'rootPartitionUsage' ? (
51+ < >
52+ < SystemStatValue
53+ valueKey = { stat . key }
54+ descriptionKey = { stat . descriptionKey }
55+ type = { stat . type }
56+ />
57+ { hasSecondaryDisk && (
58+ < SystemStatValue
59+ valueKey = "secondaryPartitionUsage"
60+ descriptionKey = "secondaryPartitionUsageDesc"
61+ type = "progress"
62+ />
63+ ) }
64+ </ >
65+ ) : (
66+ < SystemStatValue
67+ valueKey = { stat . key }
68+ descriptionKey = { stat . descriptionKey }
69+ type = { stat . type }
70+ />
71+ ) }
5472 </ CardContent >
5573 </ Card >
5674 ) ) }
@@ -62,7 +80,7 @@ type StatProp = {
6280 label : string
6381 mobileLabel : string
6482 icon : LucideIcon
65- mobileValueMode ?: 'percent' | 'description' | 'duration'
83+ mobileValueMode ?: 'percent' | 'description' | 'duration' | 'text'
6684 type : 'text' | 'progress' | 'duration'
6785 color : string
6886 key : FieldPath < Store [ 'systemInfo' ] >
@@ -77,6 +95,9 @@ function MobileStatRow({ stat }: { stat: StatProp }) {
7795 if ( stat . mobileValueMode === 'duration' ) {
7896 return formatDuration ( Number ( value ) , { unit : 's' } )
7997 }
98+ if ( stat . mobileValueMode === 'text' ) {
99+ return String ( value )
100+ }
80101 return `${ value } %`
81102 } ) ( )
82103
@@ -130,4 +151,13 @@ const statsProps: StatProp[] = [
130151 key : 'rootPartitionUsage' ,
131152 descriptionKey : 'rootPartitionUsageDesc' ,
132153 } ,
154+ {
155+ label : 'Network' ,
156+ mobileLabel : 'Net' ,
157+ icon : Wifi ,
158+ mobileValueMode : 'text' ,
159+ type : 'text' ,
160+ color : 'bg-chart-4' ,
161+ key : 'networkSpeedSummary' ,
162+ } ,
133163] as const
0 commit comments