Add global search state

This commit is contained in:
jeffvli 2023-05-18 02:09:07 -07:00 committed by Jeff
parent ccf5588435
commit 547fe7be38

View file

@ -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);