feishin/src/renderer/hooks/use-should-pad-titlebar.tsx

16 lines
666 B
TypeScript
Raw Normal View History

import { useLocation } from 'react-router';
import { AppRoute } from '/@/renderer/router/routes';
2022-12-19 15:59:14 -08:00
import { useSidebarRightExpanded } from '/@/renderer/store';
import { useGeneralSettings } from '/@/renderer/store/settings.store';
export const useShouldPadTitlebar = () => {
const location = useLocation();
2022-12-19 15:59:14 -08:00
const isSidebarExpanded = useSidebarRightExpanded();
const isQueuePage = location.pathname === AppRoute.NOW_PLAYING;
2022-12-19 15:59:14 -08:00
const { sideQueueType } = useGeneralSettings();
// If the sidebar is expanded, the sidebar queue is enabled, and the user is not on the queue page
return !(isSidebarExpanded && sideQueueType === 'sideQueue' && !isQueuePage);
2022-12-19 15:59:14 -08:00
};