Apply review feedback
This commit is contained in:
@@ -10,6 +10,8 @@ type IProps = {
|
||||
};
|
||||
|
||||
const AlertsLogWidget = ({ alerts }: IProps) => {
|
||||
if (alerts?.length == 0) return null;
|
||||
|
||||
return (
|
||||
<Widget
|
||||
title={globalize.translate('Alerts')}
|
||||
|
||||
@@ -26,7 +26,7 @@ const ActivityListItem = ({ item, displayShortOverview }: IProps) => {
|
||||
}, [ item ]);
|
||||
|
||||
return (
|
||||
<ListItem disablePadding key={item.Id}>
|
||||
<ListItem disablePadding>
|
||||
<ListItemButton>
|
||||
<ListItemAvatar>
|
||||
<Avatar sx={{ bgcolor: 'primary.main' }}>
|
||||
|
||||
@@ -27,10 +27,10 @@ const useLiveSessions = () => {
|
||||
for (const session of newSessions) {
|
||||
const sessionIndex = currentSessions.findIndex((value) => value.DeviceId === session.DeviceId);
|
||||
if (sessionIndex == -1) {
|
||||
return [ ...currentSessions, session ];
|
||||
};
|
||||
currentSessions[sessionIndex] = session;
|
||||
return currentSessions;
|
||||
currentSessions.push(session);
|
||||
} else {
|
||||
currentSessions[sessionIndex] = session;
|
||||
}
|
||||
}
|
||||
return currentSessions;
|
||||
} else {
|
||||
|
||||
@@ -42,7 +42,7 @@ const getSessionNowPlayingStreamInfo = (session: SessionInfo): string => {
|
||||
line.push(session.TranscodingInfo.VideoCodec.toUpperCase());
|
||||
}
|
||||
|
||||
if (session.TranscodingInfo.AudioCodec && session.TranscodingInfo.AudioCodec != session.TranscodingInfo.Container) {
|
||||
if (session.TranscodingInfo.AudioCodec && session.TranscodingInfo.AudioCodec !== session.TranscodingInfo.Container) {
|
||||
line.push(session.TranscodingInfo.AudioCodec.toUpperCase());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ import Events, { Event } from 'utils/events';
|
||||
import serverNotifications from 'scripts/serverNotifications';
|
||||
import { SessionMessageType } from '@jellyfin/sdk/lib/generated-client/models/session-message-type';
|
||||
|
||||
const FALLBACK_POLL_INTERVAL_MS = 10000;
|
||||
|
||||
const useLiveTasks = (params: ScheduledTasksApiGetTasksRequest) => {
|
||||
const { __legacyApiClient__ } = useApi();
|
||||
const tasksQuery = useTasks(params);
|
||||
@@ -25,7 +27,7 @@ const useLiveTasks = (params: ScheduledTasksApiGetTasksRequest) => {
|
||||
queryKey: [ QUERY_KEY ]
|
||||
});
|
||||
}
|
||||
}, 1e4);
|
||||
}, FALLBACK_POLL_INTERVAL_MS);
|
||||
|
||||
__legacyApiClient__?.sendMessage(SessionMessageType.ScheduledTasksInfoStart, '1000,1000');
|
||||
Events.on(serverNotifications, SessionMessageType.ScheduledTasksInfo, onScheduledTasksUpdate);
|
||||
|
||||
@@ -23,7 +23,6 @@ import RunningTasksWidget from '../components/widgets/RunningTasksWidget';
|
||||
import DevicesWidget from '../components/widgets/DevicesWidget';
|
||||
import useLiveSessions from '../features/sessions/hooks/useLiveSessions';
|
||||
import { useStartTask } from '../features/tasks/api/useStartTask';
|
||||
import Link from '@mui/material/Link';
|
||||
import ItemCountsWidget from '../components/widgets/ItemCountsWidget';
|
||||
import { useItemCounts } from '../features/metrics/api/useItemCounts';
|
||||
|
||||
@@ -41,11 +40,11 @@ export const Component = () => {
|
||||
const { data: devices } = useLiveSessions();
|
||||
|
||||
const dayBefore = useMemo(() => (
|
||||
subSeconds(new Date(), 24 * 60 * 60 * 1000).toISOString()
|
||||
subSeconds(new Date(), 24 * 60 * 60).toISOString()
|
||||
), []);
|
||||
|
||||
const weekBefore = useMemo(() => (
|
||||
subSeconds(new Date(), 7 * 24 * 60 * 60 * 1000).toISOString()
|
||||
subSeconds(new Date(), 7 * 24 * 60 * 60).toISOString()
|
||||
), []);
|
||||
|
||||
const { data: logs, isPending: isLogsPending } = useLogEntries({
|
||||
@@ -160,31 +159,17 @@ export const Component = () => {
|
||||
</Grid>
|
||||
) : (
|
||||
<>
|
||||
<Grid size={{ xs: 12, lg: 12 }}>
|
||||
<AlertsLogWidget alerts={alerts?.Items} />
|
||||
</Grid>
|
||||
{(alerts?.Items && alerts.Items.length > 0) && (
|
||||
<Grid size={{ xs: 12, lg: 12 }}>
|
||||
<AlertsLogWidget alerts={alerts?.Items} />
|
||||
</Grid>
|
||||
)}
|
||||
<Grid size={{ xs: 12, lg: 12 }}>
|
||||
<ServerPathWidget systemStorage={systemStorage} />
|
||||
</Grid>
|
||||
</>
|
||||
)}
|
||||
</Grid>
|
||||
|
||||
<Stack
|
||||
alignItems='center'
|
||||
marginTop={4}
|
||||
>
|
||||
<Link
|
||||
href='https://jellyfin.org'
|
||||
target='_blank'
|
||||
rel='noopener noreferrer'
|
||||
sx={{
|
||||
fontWeight: 'bold'
|
||||
}}
|
||||
>
|
||||
Jellyfin
|
||||
</Link>
|
||||
</Stack>
|
||||
</Box>
|
||||
</Page>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user