mirror of
https://github.com/multica-ai/multica.git
synced 2026-08-13 11:30:58 +02:00
Adds a `toggleChat` shortcut action (default Mod+J, rebindable in Settings -> Shortcuts) so the pop-up chat window can be opened and dismissed without a mouse, and focuses the composer whenever the window opens so you can start typing immediately. The shortcut deliberately does not claim the chord where the overlay cannot exist -- on the Chat tab, or when the Settings -> Chat preference is off -- since flipping a hidden `isOpen` would read as a dead keypress and then surprise the user on the next navigation. That route rule now lives in one predicate shared with the overlay itself. Focus is requested only on a real closed -> open transition: ChatWindow stays mounted while closed and `isOpen` is restored from storage, so treating mount as an open event would steal focus on page load. Co-authored-by: Bohan-J <bohan@devv.ai> Co-authored-by: multica-agent <github@multica.ai>
19 lines
994 B
TypeScript
19 lines
994 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { isFloatingChatRouteSuppressed } from "./floating-chat-visibility";
|
|
|
|
describe("floating chat route suppression", () => {
|
|
it("suppresses the overlay on the Chat tab and its sub-routes", () => {
|
|
expect(isFloatingChatRouteSuppressed("/acme/chat", "/acme/chat")).toBe(true);
|
|
expect(isFloatingChatRouteSuppressed("/acme/chat/session-1", "/acme/chat")).toBe(true);
|
|
});
|
|
|
|
it("keeps the overlay on every other route, including prefix look-alikes", () => {
|
|
expect(isFloatingChatRouteSuppressed("/acme/issues", "/acme/chat")).toBe(false);
|
|
// A sibling route that merely starts with the same characters is not the
|
|
// Chat tab — matching on the bare prefix would hide chat from it.
|
|
expect(isFloatingChatRouteSuppressed("/acme/chatter", "/acme/chat")).toBe(false);
|
|
// Another workspace's chat tab is a different route too.
|
|
expect(isFloatingChatRouteSuppressed("/other/chat", "/acme/chat")).toBe(false);
|
|
});
|
|
});
|