11import { useTranslation } from "react-i18next" ;
2- import { Power , Thermometer , Zap , Activity , Settings } from "lucide-react" ;
2+ import {
3+ Power ,
4+ Thermometer ,
5+ Zap ,
6+ Activity ,
7+ Settings ,
8+ Wifi ,
9+ } from "lucide-react" ;
310
411import { Badge } from "@/components/ui/badge" ;
512import {
@@ -15,6 +22,7 @@ import {
1522 isCoverComponent ,
1623 isSystemComponent ,
1724 isCloudComponent ,
25+ isZigbeeComponent ,
1826} from "@/types/api" ;
1927import type { DeviceStatus , Component } from "@/types/api" ;
2028
@@ -241,7 +249,7 @@ export function DeviceComponents({
241249 < CardHeader className = "pb-3" >
242250 < CardTitle className = "flex items-center space-x-2 text-base" >
243251 < Settings className = "h-4 w-4" />
244- < span > { t ( "deviceDetail.components.system" ) } </ span >
252+ < span > System </ span >
245253 </ CardTitle >
246254 < CardDescription >
247255 { t ( "deviceDetail.components.system.description" ) }
@@ -333,6 +341,59 @@ export function DeviceComponents({
333341 ) ;
334342 }
335343
344+ if ( isZigbeeComponent ( component ) ) {
345+ const getStatusVariant = ( networkState : string ) => {
346+ switch ( networkState . toLowerCase ( ) ) {
347+ case "joined" :
348+ return "default" ;
349+ case "joining" :
350+ return "secondary" ;
351+ default :
352+ return "destructive" ;
353+ }
354+ } ;
355+
356+ const getStatusLabel = ( networkState : string ) => {
357+ switch ( networkState . toLowerCase ( ) ) {
358+ case "joined" :
359+ return t ( "deviceDetail.components.zigbee.joined" ) ;
360+ case "joining" :
361+ return t ( "deviceDetail.components.zigbee.joining" ) ;
362+ default :
363+ return t ( "deviceDetail.components.zigbee.disconnected" ) ;
364+ }
365+ } ;
366+
367+ return (
368+ < Card key = { component . key } className = "border-l-4 border-l-orange-500" >
369+ < CardHeader className = "pb-3" >
370+ < CardTitle className = "flex items-center justify-between text-base" >
371+ < div className = "flex items-center space-x-2" >
372+ < Wifi className = "h-4 w-4" />
373+ < span > Zigbee</ span >
374+ </ div >
375+ < Badge variant = { getStatusVariant ( component . status . network_state ) } >
376+ { getStatusLabel ( component . status . network_state ) }
377+ </ Badge >
378+ </ CardTitle >
379+ < CardDescription >
380+ { t ( "deviceDetail.components.zigbee.description" ) }
381+ </ CardDescription >
382+ </ CardHeader >
383+ < CardContent className = "pt-0" >
384+ < div className = "space-y-2 text-sm" >
385+ < div className = "flex items-center justify-between" >
386+ < span > { t ( "deviceDetail.components.zigbee.networkState" ) } </ span >
387+ < span className = "font-medium" >
388+ { component . status . network_state }
389+ </ span >
390+ </ div >
391+ </ div >
392+ </ CardContent >
393+ </ Card >
394+ ) ;
395+ }
396+
336397 // Generic component fallback
337398 return (
338399 < Card key = { component . key } className = "border-l-4 border-l-gray-300" >
0 commit comments