code refactoring
This commit is contained in:
@@ -66,54 +66,55 @@ const LiveStreamMonitorView: React.FC = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<LivestreamSpeedDial onOpen={() => setOpenDialog(s => !s)} onStopAll={stopAll} />
|
<LivestreamSpeedDial onOpen={() => setOpenDialog(s => !s)} onStopAll={stopAll} />
|
||||||
{progress && Object.keys(progress).length === 0 ?
|
{
|
||||||
<NoLivestreams /> :
|
!progress || Object.keys(progress).length === 0 ?
|
||||||
<Container maxWidth="xl" sx={{ mt: 4, mb: 8 }}>
|
<NoLivestreams /> :
|
||||||
<Paper sx={{
|
<Container maxWidth="xl" sx={{ mt: 4, mb: 8 }}>
|
||||||
p: 2.5,
|
<Paper sx={{
|
||||||
display: 'flex',
|
p: 2.5,
|
||||||
flexDirection: 'column',
|
display: 'flex',
|
||||||
minHeight: '80vh',
|
flexDirection: 'column',
|
||||||
}}>
|
minHeight: '80vh',
|
||||||
<TableContainer component={Box}>
|
}}>
|
||||||
<Table sx={{ minWidth: '100%' }}>
|
<TableContainer component={Box}>
|
||||||
<TableHead>
|
<Table sx={{ minWidth: '100%' }}>
|
||||||
<TableRow>
|
<TableHead>
|
||||||
<TableCell>Livestream URL</TableCell>
|
<TableRow>
|
||||||
<TableCell align="right">Status</TableCell>
|
<TableCell>Livestream URL</TableCell>
|
||||||
<TableCell align="right">Time to live</TableCell>
|
<TableCell align="right">Status</TableCell>
|
||||||
<TableCell align="right">Starts on</TableCell>
|
<TableCell align="right">Time to live</TableCell>
|
||||||
<TableCell align="right">Actions</TableCell>
|
<TableCell align="right">Starts on</TableCell>
|
||||||
</TableRow>
|
<TableCell align="right">Actions</TableCell>
|
||||||
</TableHead>
|
|
||||||
<TableBody>
|
|
||||||
{progress && Object.keys(progress).map(k => (
|
|
||||||
<TableRow
|
|
||||||
key={k}
|
|
||||||
sx={{ '&:last-child td, &:last-child th': { border: 0 } }}
|
|
||||||
>
|
|
||||||
<TableCell>{k}</TableCell>
|
|
||||||
<TableCell align='right'>
|
|
||||||
{mapStatusToChip(progress[k].Status)}
|
|
||||||
</TableCell>
|
|
||||||
<TableCell align='right'>
|
|
||||||
{formatMicro(Number(progress[k].WaitTime))}
|
|
||||||
</TableCell>
|
|
||||||
<TableCell align='right'>
|
|
||||||
{new Date(progress[k].LiveDate).toLocaleString()}
|
|
||||||
</TableCell>
|
|
||||||
<TableCell align='right'>
|
|
||||||
<Button variant='contained' size='small' onClick={() => stop(k)}>
|
|
||||||
Stop
|
|
||||||
</Button>
|
|
||||||
</TableCell>
|
|
||||||
</TableRow>
|
</TableRow>
|
||||||
))}
|
</TableHead>
|
||||||
</TableBody>
|
<TableBody>
|
||||||
</Table>
|
{progress && Object.keys(progress).map(k => (
|
||||||
</TableContainer>
|
<TableRow
|
||||||
</Paper>
|
key={k}
|
||||||
</Container>
|
sx={{ '&:last-child td, &:last-child th': { border: 0 } }}
|
||||||
|
>
|
||||||
|
<TableCell>{k}</TableCell>
|
||||||
|
<TableCell align='right'>
|
||||||
|
{mapStatusToChip(progress[k].Status)}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align='right'>
|
||||||
|
{formatMicro(Number(progress[k].WaitTime))}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align='right'>
|
||||||
|
{new Date(progress[k].LiveDate).toLocaleString()}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align='right'>
|
||||||
|
<Button variant='contained' size='small' onClick={() => stop(k)}>
|
||||||
|
Stop
|
||||||
|
</Button>
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
))}
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
</TableContainer>
|
||||||
|
</Paper>
|
||||||
|
</Container>
|
||||||
}
|
}
|
||||||
<LivestreamDialog
|
<LivestreamDialog
|
||||||
open={openDialog}
|
open={openDialog}
|
||||||
|
|||||||
Reference in New Issue
Block a user