refactor windowbar to prevent unnecessary renders

This commit is contained in:
jeffvli
2025-11-04 21:29:42 -08:00
parent 515496ab85
commit 83efd6e8c5
2 changed files with 26 additions and 25 deletions
+2 -17
View File
@@ -10,7 +10,7 @@ import { CommandPalette } from '/@/renderer/features/search/components/command-p
import { MainContent } from '/@/renderer/layouts/default-layout/main-content';
import { PlayerBar } from '/@/renderer/layouts/default-layout/player-bar';
import { AppRoute } from '/@/renderer/router/routes';
import { useAppStore, useCommandPalette } from '/@/renderer/store';
import { useCommandPalette } from '/@/renderer/store';
import {
useGeneralSettings,
useHotkeySettings,
@@ -48,8 +48,6 @@ export const DefaultLayout = ({ shell }: DefaultLayoutProps) => {
const settings = useGeneralSettings();
const { setSettings } = useSettingsStoreActions();
const { privateMode } = useAppStore();
const updateZoom = (increase: number) => {
const newVal = settings.zoomFactor + increase;
if (newVal > 300 || newVal < 50 || !isElectron()) return;
@@ -76,19 +74,6 @@ export const DefaultLayout = ({ shell }: DefaultLayoutProps) => {
...(isElectron() ? zoomHotkeys : []),
]);
// const title = useMemo(() => {
// const statusString = playerStatus === PlayerStatus.PAUSED ? '(Paused) ' : '';
// const queueString = length ? `(${index + 1} / ${length}) ` : '';
// const privateModeString = privateMode ? '(Private mode)' : '';
// const title = `${
// length
// ? `${statusString}${queueString}${currentSong?.name}${currentSong?.artistName ? ` — ${currentSong?.artistName} — Feishin` : ''}`
// : 'Feishin'
// }${privateMode ? ` ${privateModeString}` : ''}`;
// document.title = title;
// return title;
// }, [currentSong?.artistName, currentSong?.name, index, length, playerStatus, privateMode]);
return (
<>
<div
@@ -98,7 +83,7 @@ export const DefaultLayout = ({ shell }: DefaultLayoutProps) => {
})}
id="default-layout"
>
{windowBarStyle !== Platform.WEB && <WindowBar title="" />}
<WindowBar />
<MainContent shell={shell} />
<PlayerBar />
</div>