refactor: enhance command palette modularity (#1909)

This commit is contained in:
Prateek Shourya
2024-12-11 20:27:33 +05:30
committed by GitHub
parent 001011b0e7
commit 73305e9dd1
6 changed files with 81 additions and 3 deletions

View File

@@ -1 +1,3 @@
export * from "ce/components/command-palette/modals";
export * from "./workspace-level";
export * from "./project-level";
export * from "./issue-level";

View File

@@ -0,0 +1,9 @@
import { observer } from "mobx-react";
// ce components
import { IssueLevelModals as BaseIssueLevelModals } from "@/ce/components/command-palette/modals/issue-level";
export const IssueLevelModals = observer(() => (
<>
<BaseIssueLevelModals />
</>
));

View File

@@ -0,0 +1,12 @@
import { observer } from "mobx-react";
// ce components
import {
ProjectLevelModals as BaseProjectLevelModals,
TProjectLevelModalsProps,
} from "@/ce/components/command-palette/modals/project-level";
export const ProjectLevelModals = observer((props: TProjectLevelModalsProps) => (
<>
<BaseProjectLevelModals {...props} />
</>
));

View File

@@ -0,0 +1,12 @@
import { observer } from "mobx-react";
// ce components
import {
WorkspaceLevelModals as BaseWorkspaceLevelModals,
TWorkspaceLevelModalsProps,
} from "@/ce/components/command-palette/modals/workspace-level";
export const WorkspaceLevelModals = observer((props: TWorkspaceLevelModalsProps) => (
<>
<BaseWorkspaceLevelModals {...props} />
</>
));

View File

@@ -1 +1,33 @@
export * from "ce/helpers/command-palette";
// types
import { TCommandPaletteActionList, TCommandPaletteShortcut, TCommandPaletteShortcutList } from "@plane/types";
// ce helpers
import {
getGlobalShortcutsList as getGlobalShortcutsListCE,
getWorkspaceShortcutsList as getWorkspaceShortcutsListCE,
getProjectShortcutsList as getProjectShortcutsListCE,
getNavigationShortcutsList as getNavigationShortcutsListCE,
getCommonShortcutsList as getCommonShortcutsListCE,
} from "@/ce/helpers/command-palette";
export const getGlobalShortcutsList: () => TCommandPaletteActionList = () => ({
...getGlobalShortcutsListCE(),
});
export const getWorkspaceShortcutsList: () => TCommandPaletteActionList = () => ({
...getWorkspaceShortcutsListCE(),
});
export const getProjectShortcutsList: () => TCommandPaletteActionList = () => ({
...getProjectShortcutsListCE(),
});
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export const handleAdditionalKeyDownEvents = (e: KeyboardEvent) => null;
export const getNavigationShortcutsList = (): TCommandPaletteShortcut[] => [...getNavigationShortcutsListCE()];
export const getCommonShortcutsList = (platform: string): TCommandPaletteShortcut[] => [
...getCommonShortcutsListCE(platform),
];
export const getAdditionalShortcutsList = (): TCommandPaletteShortcutList[] => [];

View File

@@ -1 +1,12 @@
export * from "ce/store/command-palette.store";
import { makeObservable } from "mobx";
// types / constants
import { BaseCommandPaletteStore, IBaseCommandPaletteStore } from "@/store/base-command-palette.store";
export type ICommandPaletteStore = IBaseCommandPaletteStore;
export class CommandPaletteStore extends BaseCommandPaletteStore implements ICommandPaletteStore {
constructor() {
super();
makeObservable(this, {});
}
}