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 React, { FunctionComponent } from 'react';
|
||||||
import type { LogFile } from '@jellyfin/sdk/lib/generated-client/models/log-file';
|
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 { useApi } from 'hooks/useApi';
|
||||||
import datetime from 'scripts/datetime';
|
import datetime from 'scripts/datetime';
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ type LogItemProps = {
|
||||||
|
|
||||||
const LogItemList: FunctionComponent<LogItemProps> = ({ logs }: LogItemProps) => {
|
const LogItemList: FunctionComponent<LogItemProps> = ({ logs }: LogItemProps) => {
|
||||||
const { api } = useApi();
|
const { api } = useApi();
|
||||||
const theme = useTheme();
|
|
||||||
|
|
||||||
const getLogFileUrl = (logFile: LogFile) => {
|
const getLogFileUrl = (logFile: LogFile) => {
|
||||||
if (!api) return '';
|
if (!api) return '';
|
||||||
|
@ -29,24 +28,22 @@ const LogItemList: FunctionComponent<LogItemProps> = ({ logs }: LogItemProps) =>
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box sx={{ backgroundColor: theme.palette.background.paper }}>
|
<List sx={{ bgcolor: 'background.paper' }}>
|
||||||
<List>
|
{logs.map(log => {
|
||||||
{logs.map(log => {
|
return (
|
||||||
return (
|
<ListItem key={log.Name} disablePadding>
|
||||||
<ListItem key={log.Name} disablePadding>
|
<ListItemButton href={getLogFileUrl(log)} target='_blank'>
|
||||||
<ListItemButton href={getLogFileUrl(log)} target='_blank'>
|
<ListItemText
|
||||||
<ListItemText
|
primary={log.Name}
|
||||||
primary={log.Name}
|
primaryTypographyProps={{ variant: 'h3' }}
|
||||||
primaryTypographyProps={{ variant: 'h3' }}
|
secondary={getDate(log)}
|
||||||
secondary={getDate(log)}
|
secondaryTypographyProps={{ variant: 'body1' }}
|
||||||
secondaryTypographyProps={{ variant: 'body1' }}
|
/>
|
||||||
/>
|
</ListItemButton>
|
||||||
</ListItemButton>
|
</ListItem>
|
||||||
</ListItem>
|
);
|
||||||
);
|
})}
|
||||||
})}
|
</List>
|
||||||
</List>
|
|
||||||
</Box>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -121,9 +121,9 @@ const Logs = () => {
|
||||||
</Button>
|
</Button>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Form>
|
</Form>
|
||||||
<Stack className='serverLogs readOnlyContent' spacing={1} sx={{ mt: 1 }}>
|
<Box className='serverLogs readOnlyContent' sx={{ mt: 1 }}>
|
||||||
<LogItemList logs={logs} />
|
<LogItemList logs={logs} />
|
||||||
</Stack>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</Page>
|
</Page>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue