This repository has been archived on 2025-03-19. You can view files and clone it, but cannot push or open issues or pull requests.
feishin/src/renderer/hooks/use-should-pad-titlebar.tsx
2023-03-28 23:59:51 -07:00

21 lines
788 B
TypeScript

import { useLocation } from 'react-router';
import { AppRoute } from '/@/renderer/router/routes';
import { useSidebarRightExpanded } from '/@/renderer/store';
import { useGeneralSettings } from '/@/renderer/store/settings.store';
import { Platform } from '/@/renderer/types';
export const useShouldPadTitlebar = () => {
const location = useLocation();
const isSidebarExpanded = useSidebarRightExpanded();
const isQueuePage = location.pathname === AppRoute.NOW_PLAYING;
const { sideQueueType, windowBarStyle } = useGeneralSettings();
const conditions = [
windowBarStyle === Platform.WEB,
!(isSidebarExpanded && sideQueueType === 'sideQueue' && !isQueuePage),
];
const shouldPadTitlebar = conditions.every((condition) => condition);
return shouldPadTitlebar;
};