Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
fix(web): animate command palette when closing (#5169)
Taras36f4314ab768
diff --git a/apps/web/src/components/CommandPalette.logic.test.ts b/apps/web/src/components/CommandPalette.logic.test.tsindex 9bae9c58a..d521c1193 100644--- a/apps/web/src/components/CommandPalette.logic.test.ts+++ b/apps/web/src/components/CommandPalette.logic.test.ts@@ -59,7 +59,7 @@ describe("reduceCommandPaletteUiState", () => {expect(reduceCommandPaletteUiState(contentOpen, { _tag: "ToggleMode", mode: "content" }),- ).toEqual({ open: false, mode: "command", openIntent: null });+ ).toEqual({ open: false, mode: "content", openIntent: null });});it("switches between open modes without closing", () => {@@ -93,7 +93,7 @@ describe("reduceCommandPaletteUiState", () => {});});- it("resets to command mode for dialog-driven opens and closes", () => {+ it("preserves the mode on close and resets it on open", () => {const filesOpen = reduceCommandPaletteUiState(closedState, {_tag: "ToggleMode",mode: "files",@@ -101,7 +101,7 @@ describe("reduceCommandPaletteUiState", () => {expect(reduceCommandPaletteUiState(filesOpen, { _tag: "SetOpen", open: false })).toEqual({open: false,- mode: "command",+ mode: "files",openIntent: null,});expect(reduceCommandPaletteUiState(filesOpen, { _tag: "SetOpen", open: true })).toEqual({diff --git a/apps/web/src/components/CommandPalette.logic.ts b/apps/web/src/components/CommandPalette.logic.tsindex 1fddb4f92..688a8a8ea 100644--- a/apps/web/src/components/CommandPalette.logic.ts+++ b/apps/web/src/components/CommandPalette.logic.ts@@ -60,14 +60,12 @@ export function reduceCommandPaletteUiState(): CommandPaletteUiState {switch (action._tag) {case "SetOpen":- return {- open: action.open,- mode: "command",- openIntent: action.open ? state.openIntent : null,- };+ return action.open+ ? { open: true, mode: "command", openIntent: state.openIntent }+ : { ...state, open: false, openIntent: null };case "ToggleMode":return state.open && state.mode === action.mode- ? { open: false, mode: "command", openIntent: null }+ ? { ...state, open: false, openIntent: null }: { open: true, mode: action.mode, openIntent: null };case "OpenAddProject":return { open: true, mode: "command", openIntent: { kind: "add-project" } };diff --git a/apps/web/src/components/CommandPalette.tsx b/apps/web/src/components/CommandPalette.tsxindex 4a90f1a50..b96eac7b0 100644--- a/apps/web/src/components/CommandPalette.tsx+++ b/apps/web/src/components/CommandPalette.tsx@@ -501,7 +501,6 @@ export function CommandPalette({ children }: { children: ReactNode }) {>{children}<CommandPaletteDialog- open={state.open}mode={state.mode}openIntent={state.openIntent}setOpen={setOpen}@@ -514,7 +513,6 @@ export function CommandPalette({ children }: { children: ReactNode }) {}function CommandPaletteDialog(props: {- readonly open: boolean;readonly mode: SearchOverlayMode;readonly openIntent: CommandPaletteOpenIntent | null;readonly setOpen: (open: boolean) => void;@@ -523,10 +521,6 @@ function CommandPaletteDialog(props: {}) {const composerHandleRef = useComposerHandleContext();- if (!props.open) {- return null;- }-return (<CommandDialogPopuparia-label={