mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Simplify code, use standard attributes
This commit is contained in:
parent
23c9e75dd2
commit
1dede0ce2b
2 changed files with 19 additions and 22 deletions
|
@ -1,6 +1,6 @@
|
|||
import React, { FunctionComponent } from 'react';
|
||||
import type { LogFile } from '@jellyfin/sdk/lib/generated-client/models/log-file';
|
||||
import { Box, List, ListItem, ListItemButton, ListItemText, useTheme } from '@mui/material';
|
||||
import { List, ListItem, ListItemButton, ListItemText } from '@mui/material';
|
||||
import { useApi } from 'hooks/useApi';
|
||||
import datetime from 'scripts/datetime';
|
||||
|
||||
|
@ -10,7 +10,6 @@ type LogItemProps = {
|
|||
|
||||
const LogItemList: FunctionComponent<LogItemProps> = ({ logs }: LogItemProps) => {
|
||||
const { api } = useApi();
|
||||
const theme = useTheme();
|
||||
|
||||
const getLogFileUrl = (logFile: LogFile) => {
|
||||
if (!api) return '';
|
||||
|
@ -29,24 +28,22 @@ const LogItemList: FunctionComponent<LogItemProps> = ({ logs }: LogItemProps) =>
|
|||
};
|
||||
|
||||
return (
|
||||
<Box sx={{ backgroundColor: theme.palette.background.paper }}>
|
||||
<List>
|
||||
{logs.map(log => {
|
||||
return (
|
||||
<ListItem key={log.Name} disablePadding>
|
||||
<ListItemButton href={getLogFileUrl(log)} target='_blank'>
|
||||
<ListItemText
|
||||
primary={log.Name}
|
||||
primaryTypographyProps={{ variant: 'h3' }}
|
||||
secondary={getDate(log)}
|
||||
secondaryTypographyProps={{ variant: 'body1' }}
|
||||
/>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
);
|
||||
})}
|
||||
</List>
|
||||
</Box>
|
||||
<List sx={{ bgcolor: 'background.paper' }}>
|
||||
{logs.map(log => {
|
||||
return (
|
||||
<ListItem key={log.Name} disablePadding>
|
||||
<ListItemButton href={getLogFileUrl(log)} target='_blank'>
|
||||
<ListItemText
|
||||
primary={log.Name}
|
||||
primaryTypographyProps={{ variant: 'h3' }}
|
||||
secondary={getDate(log)}
|
||||
secondaryTypographyProps={{ variant: 'body1' }}
|
||||
/>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
);
|
||||
})}
|
||||
</List>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -121,9 +121,9 @@ const Logs = () => {
|
|||
</Button>
|
||||
</Stack>
|
||||
</Form>
|
||||
<Stack className='serverLogs readOnlyContent' spacing={1} sx={{ mt: 1 }}>
|
||||
<Box className='serverLogs readOnlyContent' sx={{ mt: 1 }}>
|
||||
<LogItemList logs={logs} />
|
||||
</Stack>
|
||||
</Box>
|
||||
</Box>
|
||||
</Page>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue