Skip to content

Commit 60cffd4

Browse files
committed
Update Dashboard with minor tweaks and component refinements
1 parent ab892aa commit 60cffd4

File tree

1 file changed

+89
-14
lines changed

1 file changed

+89
-14
lines changed

thingconnect.pulse.client/src/pages/Dashboard.tsx

Lines changed: 89 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import type { LiveStatusParams } from '@/api/types';
99
import { Activity, AlertTriangle, CheckCircle, XCircle } from 'lucide-react';
1010

1111
import type { LiveStatusItem } from '@/api/types';
12+
import { text } from 'stream/consumers';
1213

1314
type GroupedEndpoints =
1415
| LiveStatusItem[]
@@ -223,20 +224,94 @@ export default function Dashboard() {
223224
<VStack align='stretch' gap='6' mb='8'>
224225
<Heading size='xl'>System Overview</Heading>
225226
<Grid templateColumns={{ base: '1fr', md: 'repeat(2,1fr)', lg: 'repeat(4,1fr)' }} gap='6'>
226-
<StatCard
227-
icon={Activity}
228-
title='Total Endpoints'
229-
value={statusCounts.total}
230-
color='blue'
231-
/>
232-
<StatCard icon={CheckCircle} title='Online' value={statusCounts.up} color='green' />
233-
<StatCard icon={XCircle} title='Offline' value={statusCounts.down} color='red' />
234-
<StatCard
235-
icon={AlertTriangle}
236-
title='Flapping'
237-
value={statusCounts.flapping}
238-
color='yellow'
239-
/>
227+
{[
228+
{
229+
icon: Activity,
230+
title: 'TOTAL',
231+
subtitle: 'Total endpoints configured',
232+
value: statusCounts.total,
233+
textColor : 'blue.500',
234+
color: 'blue.600',
235+
bg: 'blue.100',
236+
darkColor : 'blue.200',
237+
darkBg : 'blue.800'
238+
},
239+
{
240+
icon: CheckCircle,
241+
title: 'ONLINE',
242+
subtitle: 'Currently operational',
243+
value: statusCounts.up,
244+
textColor : 'green.500',
245+
color: 'green.600',
246+
bg: 'green.100',
247+
darkColor : 'green.200',
248+
darkBg : 'green.800'
249+
},
250+
{
251+
icon: XCircle,
252+
title: 'OFFLINE',
253+
subtitle: 'Currently down',
254+
value: statusCounts.down,
255+
textColor : 'red.500',
256+
color: 'red.600',
257+
bg: 'red.100',
258+
darkColor : 'red.200',
259+
darkBg : 'red.800'
260+
},
261+
{
262+
icon: AlertTriangle,
263+
title: 'FLAPPING',
264+
subtitle: 'Unstable state changes',
265+
value: statusCounts.flapping,
266+
textColor : 'yellow.500',
267+
color: 'yellow.600',
268+
bg: 'yellow.100',
269+
darkColor : 'yellow.200',
270+
darkBg : 'yellow.800'
271+
},
272+
].map(stat => (
273+
<Box
274+
key={stat.title}
275+
p='6'
276+
borderRadius='xl'
277+
boxShadow='sm'
278+
_hover={{
279+
boxShadow: 'md',
280+
transform: 'translateY(-2px)',
281+
transition: 'all 0.2s',
282+
}}
283+
>
284+
<VStack align='flex-start' gap='4'>
285+
<HStack justifyContent={'space-between'} w={'full'}>
286+
<Text fontSize='sm' fontWeight='semibold' color='gray.500'>
287+
{stat.title}
288+
</Text>
289+
<Box>
290+
<Box
291+
bg={stat.bg}
292+
color={stat.color}
293+
_dark={{bg: stat.darkBg, color: stat.color}}
294+
boxSize='12'
295+
display='flex'
296+
alignItems='center'
297+
justifyContent='center'
298+
borderRadius='full'
299+
>
300+
<stat.icon size={28} />
301+
</Box>
302+
</Box>
303+
</HStack>
304+
<Box>
305+
<Text fontSize='3xl' fontWeight='bold' color={stat.textColor}>
306+
{stat.value}
307+
</Text>
308+
<Text fontSize='sm' color='gray.500'>
309+
{stat.subtitle}
310+
</Text>
311+
</Box>
312+
</VStack>
313+
</Box>
314+
))}
240315
</Grid>
241316
</VStack>
242317

0 commit comments

Comments
 (0)