Skip to content

Commit

Permalink
Backport pull request #5806 from jellyfin-web/release-10.9.z
Browse files Browse the repository at this point in the history
Fix dashboard body class sometimes missing

Original-merge: f3bb9f2

Merged-by: thornbill <thornbill@users.noreply.github.com>

Backported-by: Bill Thornton <thornbill@users.noreply.github.com>
  • Loading branch information
thornbill committed Jul 21, 2024
1 parent e5d2f8f commit 0084cc8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 10 additions & 1 deletion src/apps/dashboard/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import AppBar from '@mui/material/AppBar';
import Box from '@mui/material/Box';
import { type Theme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
import React, { FC, useCallback, useState } from 'react';
import React, { FC, useCallback, useEffect, useState } from 'react';
import { Outlet, useLocation } from 'react-router-dom';

import AppBody from 'components/AppBody';
Expand Down Expand Up @@ -33,6 +33,15 @@ export const Component: FC = () => {
setIsDrawerActive(!isDrawerActive);
}, [ isDrawerActive, setIsDrawerActive ]);

// Update body class
useEffect(() => {
document.body.classList.add('dashboardDocument');

return () => {
document.body.classList.remove('dashboardDocument');
};
}, []);

return (
<Box sx={{ display: 'flex' }}>
<ElevationScroll elevate={false}>
Expand Down
3 changes: 0 additions & 3 deletions src/scripts/libraryMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -581,23 +581,20 @@ function updateMenuForPageType(isDashboardPage, isLibraryPage) {

if (isLibraryPage) {
bodyClassList.add('libraryDocument');
bodyClassList.remove('dashboardDocument');
bodyClassList.remove('hideMainDrawer');

if (navDrawerInstance) {
navDrawerInstance.setEdgeSwipeEnabled(true);
}
} else if (isDashboardPage) {
bodyClassList.remove('libraryDocument');
bodyClassList.add('dashboardDocument');
bodyClassList.remove('hideMainDrawer');

if (navDrawerInstance) {
navDrawerInstance.setEdgeSwipeEnabled(true);
}
} else {
bodyClassList.remove('libraryDocument');
bodyClassList.remove('dashboardDocument');
bodyClassList.add('hideMainDrawer');

if (navDrawerInstance) {
Expand Down

0 comments on commit 0084cc8

Please sign in to comment.