Skip to content

Commit

Permalink
Simplify code, use standard attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
viown committed Jan 15, 2025
1 parent 23c9e75 commit d076b38
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/apps/dashboard/features/logs/components/LogItemList.tsx
Original file line number Diff line number Diff line change
@@ -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, useTheme } from '@mui/material';
import { useApi } from 'hooks/useApi';
import datetime from 'scripts/datetime';

Expand All @@ -12,6 +12,8 @@ const LogItemList: FunctionComponent<LogItemProps> = ({ logs }: LogItemProps) =>
const { api } = useApi();
const theme = useTheme();

console.log(theme);

const getLogFileUrl = (logFile: LogFile) => {
if (!api) return '';

Expand All @@ -29,24 +31,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>
);
};

Expand Down

0 comments on commit d076b38

Please sign in to comment.