2023-02-07 22:47:23 -08:00
|
|
|
import { useLocation } from 'react-router';
|
|
|
|
|
import { AppRoute } from '/@/renderer/router/routes';
|
2023-03-31 05:06:54 -07:00
|
|
|
import { useSidebarRightExpanded, useGeneralSettings, useWindowSettings } from '/@/renderer/store';
|
2023-03-28 23:59:51 -07:00
|
|
|
import { Platform } from '/@/renderer/types';
|
2022-12-19 15:59:14 -08:00
|
|
|
|
|
|
|
|
export const useShouldPadTitlebar = () => {
|
2023-02-07 22:47:23 -08:00
|
|
|
const location = useLocation();
|
2022-12-19 15:59:14 -08:00
|
|
|
const isSidebarExpanded = useSidebarRightExpanded();
|
2023-02-07 22:47:23 -08:00
|
|
|
const isQueuePage = location.pathname === AppRoute.NOW_PLAYING;
|
2023-03-31 05:06:54 -07:00
|
|
|
const { sideQueueType } = useGeneralSettings();
|
|
|
|
|
const { windowBarStyle } = useWindowSettings();
|
2022-12-19 15:59:14 -08:00
|
|
|
|
2023-03-28 23:59:51 -07:00
|
|
|
const conditions = [
|
|
|
|
|
windowBarStyle === Platform.WEB,
|
|
|
|
|
!(isSidebarExpanded && sideQueueType === 'sideQueue' && !isQueuePage),
|
|
|
|
|
];
|
2023-02-07 22:47:23 -08:00
|
|
|
|
2023-03-28 23:59:51 -07:00
|
|
|
const shouldPadTitlebar = conditions.every((condition) => condition);
|
|
|
|
|
|
|
|
|
|
return shouldPadTitlebar;
|
2022-12-19 15:59:14 -08:00
|
|
|
};
|