Add global search state
This commit is contained in:
parent
ccf5588435
commit
547fe7be38
1 changed files with 28 additions and 0 deletions
|
@ -18,7 +18,15 @@ type TitlebarProps = {
|
|||
outOfView: boolean;
|
||||
};
|
||||
|
||||
type CommandPaletteProps = {
|
||||
close: () => void;
|
||||
open: () => void;
|
||||
opened: boolean;
|
||||
toggle: () => void;
|
||||
};
|
||||
|
||||
export interface AppState {
|
||||
commandPalette: CommandPaletteProps;
|
||||
isReorderingQueue: boolean;
|
||||
platform: Platform;
|
||||
sidebar: SidebarProps;
|
||||
|
@ -52,6 +60,24 @@ export const useAppStore = create<AppSlice>()(
|
|||
});
|
||||
},
|
||||
},
|
||||
commandPalette: {
|
||||
close: () => {
|
||||
set((state) => {
|
||||
state.commandPalette.opened = false;
|
||||
});
|
||||
},
|
||||
open: () => {
|
||||
set((state) => {
|
||||
state.commandPalette.opened = true;
|
||||
});
|
||||
},
|
||||
opened: false,
|
||||
toggle: () => {
|
||||
set((state) => {
|
||||
state.commandPalette.opened = !state.commandPalette.opened;
|
||||
});
|
||||
},
|
||||
},
|
||||
isReorderingQueue: false,
|
||||
platform: Platform.WINDOWS,
|
||||
sidebar: {
|
||||
|
@ -88,3 +114,5 @@ export const useSidebarRightExpanded = () => useAppStore((state) => state.sideba
|
|||
export const useSetTitlebar = () => useAppStore((state) => state.actions.setTitleBar);
|
||||
|
||||
export const useTitlebarStore = () => useAppStore((state) => state.titlebar);
|
||||
|
||||
export const useCommandPalette = () => useAppStore((state) => state.commandPalette);
|
||||
|
|
Reference in a new issue