mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 10:23:33 +00:00
Add handlers to open command palette
This commit is contained in:
parent
822060b82c
commit
c85a7079eb
3 changed files with 33 additions and 5 deletions
|
|
@ -1,10 +1,17 @@
|
|||
import { lazy } from 'react';
|
||||
import isElectron from 'is-electron';
|
||||
import styled from 'styled-components';
|
||||
import { useWindowSettings, useSettingsStore } from '/@/renderer/store/settings.store';
|
||||
import {
|
||||
useWindowSettings,
|
||||
useSettingsStore,
|
||||
useHotkeySettings,
|
||||
} from '/@/renderer/store/settings.store';
|
||||
import { Platform, PlaybackType } from '/@/renderer/types';
|
||||
import { MainContent } from '/@/renderer/layouts/default-layout/main-content';
|
||||
import { PlayerBar } from '/@/renderer/layouts/default-layout/player-bar';
|
||||
import { useHotkeys } from '@mantine/hooks';
|
||||
import { CommandPalette } from '/@/renderer/features/search/components/command-palette';
|
||||
import { useCommandPalette } from '/@/renderer/store';
|
||||
|
||||
if (!isElectron()) {
|
||||
useSettingsStore.getState().actions.setSettings({
|
||||
|
|
@ -42,6 +49,10 @@ interface DefaultLayoutProps {
|
|||
|
||||
export const DefaultLayout = ({ shell }: DefaultLayoutProps) => {
|
||||
const { windowBarStyle } = useWindowSettings();
|
||||
const { opened, ...handlers } = useCommandPalette();
|
||||
const { bindings } = useHotkeySettings();
|
||||
|
||||
useHotkeys([[bindings.globalSearch.hotkey, () => handlers.open()]]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
@ -53,6 +64,7 @@ export const DefaultLayout = ({ shell }: DefaultLayoutProps) => {
|
|||
<MainContent shell={shell} />
|
||||
<PlayerBar />
|
||||
</Layout>
|
||||
<CommandPalette modalProps={{ handlers, opened }} />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue