mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-08 04:50:12 +02:00
52 lines
1.5 KiB
TypeScript
52 lines
1.5 KiB
TypeScript
import clsx from 'clsx';
|
|
import isElectron from 'is-electron';
|
|
import { lazy } from 'react';
|
|
|
|
import styles from './default-layout.module.css';
|
|
|
|
import { ContextMenuController } from '/@/renderer/features/context-menu/context-menu-controller';
|
|
import { MainContent } from '/@/renderer/layouts/default-layout/main-content';
|
|
import { PlayerBar } from '/@/renderer/layouts/default-layout/player-bar';
|
|
import { useSettingsStore, useWindowSettings } from '/@/renderer/store/settings.store';
|
|
import { Platform, PlayerType } from '/@/shared/types/types';
|
|
|
|
if (!isElectron()) {
|
|
useSettingsStore.getState().actions.setSettings({
|
|
playback: {
|
|
...useSettingsStore.getState().playback,
|
|
type: PlayerType.WEB,
|
|
},
|
|
});
|
|
}
|
|
|
|
const WindowBar = lazy(() =>
|
|
import('/@/renderer/layouts/window-bar').then((module) => ({
|
|
default: module.WindowBar,
|
|
})),
|
|
);
|
|
|
|
interface DefaultLayoutProps {
|
|
shell?: boolean;
|
|
}
|
|
|
|
export const DefaultLayout = ({ shell }: DefaultLayoutProps) => {
|
|
const { windowBarStyle } = useWindowSettings();
|
|
|
|
return (
|
|
<>
|
|
<div
|
|
className={clsx(styles.layout, {
|
|
[styles.macos]: windowBarStyle === Platform.MACOS,
|
|
[styles.windows]: windowBarStyle === Platform.WINDOWS,
|
|
})}
|
|
id="default-layout"
|
|
>
|
|
<WindowBar />
|
|
<MainContent shell={shell} />
|
|
<PlayerBar />
|
|
</div>
|
|
<ContextMenuController.Root />
|
|
</>
|
|
);
|
|
};
|