@@ -11,29 +11,16 @@ type Props = {
1111 onClick : ( typeId : number ) => void ;
1212} ;
1313
14- function getHealthColor ( percent : number ) {
15- if ( percent >= 80 ) return { _light : 'rgba(22, 163, 74, 0.8)' , _dark : 'rgba(34, 197, 94, 0.9)' } ;
16- if ( percent >= 50 ) return { _light : 'rgba(217, 119, 6, 0.8)' , _dark : 'rgba(245, 158, 11, 0.9)' } ;
17- return { _light : 'rgba(220, 38, 38, 0.8)' , _dark : 'rgba(248, 113, 113, 0.9)' } ;
18- }
19-
20- function getHealthBarColor ( percent : number ) {
21- if ( percent >= 80 ) return { _light : 'rgba(22, 163, 74, 0.6)' , _dark : 'rgba(34, 197, 94, 0.7)' } ;
22- if ( percent >= 50 ) return { _light : 'rgba(217, 119, 6, 0.6)' , _dark : 'rgba(245, 158, 11, 0.7)' } ;
23- return { _light : 'rgba(220, 38, 38, 0.6)' , _dark : 'rgba(248, 113, 113, 0.7)' } ;
24- }
25-
2614const TEETypeCard = ( { type, isSelected, isLoading, onClick } : Props ) => {
27- const activePercent = type . totalNodes > 0 ? Math . round ( ( type . activeNodes / type . totalNodes ) * 100 ) : 0 ;
2815
2916 const handleClick = React . useCallback ( ( ) => {
3017 onClick ( type . typeId ) ;
3118 } , [ onClick , type . typeId ] ) ;
3219
3320 return (
3421 < Flex
35- px = { 3 }
36- py = { 2.5 }
22+ px = { 4 }
23+ py = { 3 }
3724 cursor = "pointer"
3825 position = "relative"
3926 overflow = "hidden"
@@ -54,7 +41,7 @@ const TEETypeCard = ({ type, isSelected, isLoading, onClick }: Props) => {
5441 onClick = { handleClick }
5542 role = "group"
5643 alignItems = "center"
57- gap = { 3 }
44+ gap = { 4 }
5845 >
5946 { /* Active indicator bar at top */ }
6047 < Box
@@ -71,7 +58,7 @@ const TEETypeCard = ({ type, isSelected, isLoading, onClick }: Props) => {
7158 />
7259
7360 { /* Name + Stats */ }
74- < Flex alignItems = "baseline" gap = { 2 } flexShrink = { 0 } >
61+ < Flex alignItems = "baseline" gap = { 3 } >
7562 < Skeleton loading = { isLoading } w = "fit-content" >
7663 < Text
7764 fontSize = "13px"
@@ -95,38 +82,6 @@ const TEETypeCard = ({ type, isSelected, isLoading, onClick }: Props) => {
9582 </ Text >
9683 </ Skeleton >
9784 </ Flex >
98-
99- { /* Health bar */ }
100- < Box flex = { 1 } minW = "40px" >
101- < Box
102- h = "2px"
103- bg = { { _light : 'rgba(0, 0, 0, 0.04)' , _dark : 'rgba(255, 255, 255, 0.04)' } }
104- borderRadius = "full"
105- overflow = "hidden"
106- >
107- < Skeleton loading = { isLoading } h = "100%" >
108- < Box
109- h = "100%"
110- w = { `${ activePercent } %` }
111- bg = { getHealthBarColor ( activePercent ) }
112- borderRadius = "full"
113- transition = "width 0.5s ease"
114- />
115- </ Skeleton >
116- </ Box >
117- </ Box >
118-
119- { /* Health percentage */ }
120- < Skeleton loading = { isLoading } w = "fit-content" flexShrink = { 0 } >
121- < Text
122- fontSize = "11px"
123- fontWeight = { 600 }
124- color = { getHealthColor ( activePercent ) }
125- fontFamily = "system-ui, -apple-system, sans-serif"
126- >
127- { activePercent } %
128- </ Text >
129- </ Skeleton >
13085 </ Flex >
13186 ) ;
13287} ;
0 commit comments