11import DownloadIcon from '@mui/icons-material/Download' ;
22import MoreVertIcon from '@mui/icons-material/MoreVert' ;
3- import { CardActions , Stack , Tooltip } from '@mui/material' ;
3+ import { CardActions , Fade , Stack , Tooltip } from '@mui/material' ;
44import Card from '@mui/material/Card' ;
55import CardContent from '@mui/material/CardContent' ;
66import CardHeader from '@mui/material/CardHeader' ;
@@ -12,6 +12,7 @@ import Menu from '@mui/material/Menu';
1212import MenuItem from '@mui/material/MenuItem' ;
1313import Image from 'next/image' ;
1414import * as React from 'react' ;
15+ import { ClientImages } from '../misc/clientimages' ;
1516import { Client , ReleaseAsset } from '../misc/model' ;
1617import {
1718 ApplyConfigDialog ,
@@ -112,63 +113,71 @@ export default function ClientCard({
112113 const [ openOtaDialog , setOpenOtaDialog ] = React . useState < boolean > ( false ) ;
113114
114115 return (
115- < Card sx = { { maxWidth : 500 , minHeight : 230 , boxShadow : 4 } } >
116- < CardHeader
117- avatar = {
118- < Image
119- src = { 'static/' + client . platform + '.png' }
120- width = { 50 }
121- height = { 50 }
122- alt = { client . platform }
123- loading = "eager" > </ Image >
124- }
125- action = { < ClientMenu client = { client } > </ ClientMenu > }
126- title = { client . label || client . hostname }
127- subheader = { client . mac_addr }
128- sx = { { paddingBottom : 0 } }
129- />
130- < CardContent sx = { { paddingLeft : 1 , paddingBottom : 0 , minWidth : 'max-content' } } >
131- < List dense = { true } >
132- < ListItem sx = { { paddingTop : 0 , paddingBottom : 0 , maxWidth : 300 } } >
133- < ListItemText sx = { { margin : 0 } } primary = { 'Hostname: ' + client . hostname } />
134- </ ListItem >
135- < ListItem sx = { { paddingTop : 0 , paddingBottom : 0 , maxWidth : 300 } } >
136- < ListItemText sx = { { margin : 0 } } primary = { 'IP Address: ' + client . ip } />
137- </ ListItem >
138- < ListItem sx = { { paddingTop : 0 , paddingBottom : 0 , maxWidth : 300 } } >
139- < ListItemText sx = { { margin : 0 } } primary = { 'Platform: ' + client . platform } />
140- </ ListItem >
141- < ListItem sx = { { paddingTop : 0 , paddingBottom : 0 , maxWidth : 300 } } >
142- < ListItemText sx = { { margin : 0 } } primary = { 'Version: ' + client . version } />
143- </ ListItem >
144- </ List >
145- </ CardContent >
146- < CardActions sx = { { paddingLeft : 1 , paddingTop : 0 } } >
147- { latestReleaseAsset !== undefined &&
148- latestReleaseName !== undefined &&
149- latestReleaseName !== client . version && (
150- < Stack spacing = { 2 } sx = { { padding : 0 } } >
151- < Tooltip
152- style = { { boxShadow : 'none' } }
153- title = { 'Upgrade to ' + latestReleaseName }
154- enterTouchDelay = { 0 } >
155- < IconButton
156- edge = "end"
157- aria-label = "delete"
158- onClick = { ( ) => {
159- setOpenOtaDialog ( true ) ;
160- } } >
161- < DownloadIcon />
162- </ IconButton >
163- </ Tooltip >
164- < OtaDialog
165- client = { client }
166- open = { openOtaDialog }
167- selectedRelease = { latestReleaseAsset }
168- onClose = { ( ) => setOpenOtaDialog ( false ) } > </ OtaDialog >
169- </ Stack >
170- ) }
171- </ CardActions >
172- </ Card >
116+ < Fade in = { true } timeout = { 1000 } >
117+ < Card
118+ sx = { {
119+ maxWidth : 500 ,
120+ minHeight : 230 ,
121+ boxShadow : 4 ,
122+ } } >
123+ < CardHeader
124+ avatar = {
125+ < Image
126+ src = { ClientImages [ client . platform ] }
127+ width = { 50 }
128+ height = { 50 }
129+ alt = { client . platform }
130+ priority = { true }
131+ placeholder = "blur" > </ Image >
132+ }
133+ action = { < ClientMenu client = { client } > </ ClientMenu > }
134+ title = { client . label || client . hostname }
135+ subheader = { client . mac_addr }
136+ sx = { { paddingBottom : 0 } }
137+ />
138+ < CardContent sx = { { paddingLeft : 1 , paddingBottom : 0 , minWidth : 'max-content' } } >
139+ < List dense = { true } >
140+ < ListItem sx = { { paddingTop : 0 , paddingBottom : 0 , maxWidth : 300 } } >
141+ < ListItemText sx = { { margin : 0 } } primary = { 'Hostname: ' + client . hostname } />
142+ </ ListItem >
143+ < ListItem sx = { { paddingTop : 0 , paddingBottom : 0 , maxWidth : 300 } } >
144+ < ListItemText sx = { { margin : 0 } } primary = { 'IP Address: ' + client . ip } />
145+ </ ListItem >
146+ < ListItem sx = { { paddingTop : 0 , paddingBottom : 0 , maxWidth : 300 } } >
147+ < ListItemText sx = { { margin : 0 } } primary = { 'Platform: ' + client . platform } />
148+ </ ListItem >
149+ < ListItem sx = { { paddingTop : 0 , paddingBottom : 0 , maxWidth : 300 } } >
150+ < ListItemText sx = { { margin : 0 } } primary = { 'Version: ' + client . version } />
151+ </ ListItem >
152+ </ List >
153+ </ CardContent >
154+ < CardActions sx = { { paddingLeft : 1 , paddingTop : 0 } } >
155+ { latestReleaseAsset !== undefined &&
156+ latestReleaseName !== undefined &&
157+ latestReleaseName !== client . version && (
158+ < Stack spacing = { 2 } sx = { { padding : 0 } } >
159+ < Tooltip
160+ style = { { boxShadow : 'none' } }
161+ title = { 'Upgrade to ' + latestReleaseName }
162+ enterTouchDelay = { 0 } >
163+ < IconButton
164+ edge = "end"
165+ aria-label = "delete"
166+ onClick = { ( ) => {
167+ setOpenOtaDialog ( true ) ;
168+ } } >
169+ < DownloadIcon />
170+ </ IconButton >
171+ </ Tooltip >
172+ < OtaDialog
173+ client = { client }
174+ open = { openOtaDialog }
175+ selectedRelease = { latestReleaseAsset }
176+ onClose = { ( ) => setOpenOtaDialog ( false ) } > </ OtaDialog >
177+ </ Stack >
178+ ) }
179+ </ CardActions >
180+ </ Card >
181+ </ Fade >
173182 ) ;
174183}
0 commit comments