From 735590da5f879b613504392fe6afd0e24a8815c8 Mon Sep 17 00:00:00 2001 From: ZhuchkaTriplesix Date: Sun, 15 Nov 2026 10:32:15 +0300 Subject: [PATCH] =?UTF-8?q?feat(ui):=20built-ins=20=E2=80=94=20command=20p?= =?UTF-8?q?alette,=20tour,=20about,=20quick=20switcher?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add Ctrl/Cmd+P palette with a core command registry, Ctrl/Cmd+K object switcher (demo-aware), Welcome Tour and About dialogs, Help menu entries, and empty-hero recents — no new DB connection work. --- apps/tauri/src/App.vue | 92 ++++++++- apps/tauri/src/commands/registry.test.ts | 43 ++++ apps/tauri/src/commands/registry.ts | 111 ++++++++++ apps/tauri/src/ui/AboutDialog.vue | 122 +++++++++++ apps/tauri/src/ui/CommandPalette.vue | 175 ++++++++++++++++ apps/tauri/src/ui/QuickSwitcher.vue | 211 +++++++++++++++++++ apps/tauri/src/ui/TitleBar.vue | 10 + apps/tauri/src/ui/TitleBarMenus.vue | 55 ++++- apps/tauri/src/ui/WelcomeTourDialog.vue | 247 +++++++++++++++++++++++ apps/tauri/src/ui/WorkspaceEmptyHero.vue | 98 ++++++++- 10 files changed, 1154 insertions(+), 10 deletions(-) create mode 100644 apps/tauri/src/commands/registry.test.ts create mode 100644 apps/tauri/src/commands/registry.ts create mode 100644 apps/tauri/src/ui/AboutDialog.vue create mode 100644 apps/tauri/src/ui/CommandPalette.vue create mode 100644 apps/tauri/src/ui/QuickSwitcher.vue create mode 100644 apps/tauri/src/ui/WelcomeTourDialog.vue diff --git a/apps/tauri/src/App.vue b/apps/tauri/src/App.vue index 3604fe60..abfb57ea 100644 --- a/apps/tauri/src/App.vue +++ b/apps/tauri/src/App.vue @@ -9,6 +9,7 @@ import { useConnectionsStore } from "./stores/connections"; import { useShellNavStore } from "./stores/shellNav"; import { initTheme } from "./theme/queryaTheme"; import { provideQueryaMotion } from "./motion"; +import { buildCoreCommands, type AppCommand } from "./commands/registry"; import TitleBar from "./ui/TitleBar.vue"; import ConnectionsPanel from "./ui/ConnectionsPanel.vue"; import StatusBar from "./ui/StatusBar.vue"; @@ -17,13 +18,23 @@ import QueryaDivider from "./ui/QueryaDivider.vue"; import ConnectionHome from "./ui/ConnectionHome.vue"; import TableObjectView from "./ui/TableObjectView.vue"; import PreferencesDialog from "./ui/PreferencesDialog.vue"; +import CommandPalette from "./ui/CommandPalette.vue"; +import QuickSwitcher from "./ui/QuickSwitcher.vue"; +import WelcomeTourDialog from "./ui/WelcomeTourDialog.vue"; +import AboutDialog from "./ui/AboutDialog.vue"; const shell = useShellStore(); const status = useShellStatusStore(); const connections = useConnectionsStore(); const nav = useShellNavStore(); const { surface } = storeToRefs(nav); + const prefsOpen = ref(false); +const paletteOpen = ref(false); +const switcherOpen = ref(false); +const tourOpen = ref(false); +const aboutOpen = ref(false); + provideQueryaMotion(); const showEmpty = computed(() => surface.value === "empty"); @@ -67,27 +78,76 @@ function onLaunchDemo() { } function onOpenTour() { - status.setQueryMetrics({ message: "Tour stub", busy: false }); + tourOpen.value = true; } function onOpenPreferences() { prefsOpen.value = true; } +function onOpenPalette() { + paletteOpen.value = true; +} + +function onOpenQuickSwitcher() { + switcherOpen.value = true; +} + +function onOpenAbout() { + aboutOpen.value = true; +} + +function onCheckUpdates() { + status.setQueryMetrics({ + message: "Updater stub — check for updates lands with packaging epic", + busy: false, + }); +} + +function onGoHome() { + if (nav.selectedConnectionId) nav.clearObject(); + else nav.reset(); +} + +function onOpenRecent(id: string) { + connections.select(id); +} + +const commands = computed(() => + buildCoreCommands({ + openPreferences: onOpenPreferences, + toggleSidebar: () => shell.toggleSidebar(), + openTour: onOpenTour, + openAbout: onOpenAbout, + openPalette: onOpenPalette, + openQuickSwitcher: onOpenQuickSwitcher, + launchDemo: onLaunchDemo, + openSqlite: () => void onOpenSqlite(), + newConnection: onNewConnection, + checkUpdates: onCheckUpdates, + goHome: onGoHome, + }), +); + function onKeydown(e: KeyboardEvent) { const mod = e.metaKey || e.ctrlKey; if (!mod) return; - if (e.key.toLowerCase() === "b") { + const key = e.key.toLowerCase(); + if (key === "b") { e.preventDefault(); shell.toggleSidebar(); - } - if (e.key === ",") { + } else if (e.key === ",") { e.preventDefault(); onOpenPreferences(); - } - if (e.key.toLowerCase() === "n") { + } else if (key === "n") { e.preventDefault(); onNewConnection(); + } else if (key === "p") { + e.preventDefault(); + onOpenPalette(); + } else if (key === "k") { + e.preventDefault(); + onOpenQuickSwitcher(); } } @@ -121,6 +181,11 @@ onUnmounted(() => {
@@ -136,6 +201,7 @@ onUnmounted(() => { @open-sqlite="onOpenSqlite" @launch-demo="onLaunchDemo" @open-tour="onOpenTour" + @open-recent="onOpenRecent" /> @@ -143,7 +209,21 @@ onUnmounted(() => {
+ + + + + diff --git a/apps/tauri/src/commands/registry.test.ts b/apps/tauri/src/commands/registry.test.ts new file mode 100644 index 00000000..04e8b4f5 --- /dev/null +++ b/apps/tauri/src/commands/registry.test.ts @@ -0,0 +1,43 @@ +import { describe, expect, it, vi } from "vitest"; +import { buildCoreCommands, filterCommands } from "./registry"; + +const noop = () => undefined; + +describe("command registry", () => { + const commands = buildCoreCommands({ + openPreferences: noop, + toggleSidebar: noop, + openTour: noop, + openAbout: noop, + openPalette: noop, + openQuickSwitcher: noop, + launchDemo: noop, + openSqlite: noop, + newConnection: noop, + checkUpdates: noop, + goHome: noop, + }); + + it("includes core built-ins", () => { + const ids = commands.map((c) => c.id); + expect(ids).toContain("prefs"); + expect(ids).toContain("palette"); + expect(ids).toContain("goto"); + expect(ids).toContain("tour"); + }); + + it("filters by title and keywords", () => { + expect(filterCommands(commands, "prefer").map((c) => c.id)).toContain( + "prefs", + ); + expect(filterCommands(commands, "table").map((c) => c.id)).toContain( + "goto", + ); + const run = vi.fn(); + const patched = commands.map((c) => + c.id === "demo" ? { ...c, run } : c, + ); + filterCommands(patched, "demo")[0]?.run(); + expect(run).toHaveBeenCalledOnce(); + }); +}); diff --git a/apps/tauri/src/commands/registry.ts b/apps/tauri/src/commands/registry.ts new file mode 100644 index 00000000..adae2ab5 --- /dev/null +++ b/apps/tauri/src/commands/registry.ts @@ -0,0 +1,111 @@ +export type AppCommand = { + id: string; + title: string; + subtitle?: string; + keywords?: string[]; + run: () => void; +}; + +export type CommandHandlers = { + openPreferences: () => void; + toggleSidebar: () => void; + openTour: () => void; + openAbout: () => void; + openPalette: () => void; + openQuickSwitcher: () => void; + launchDemo: () => void; + openSqlite: () => void; + newConnection: () => void; + checkUpdates: () => void; + goHome: () => void; +}; + +export function buildCoreCommands(h: CommandHandlers): AppCommand[] { + return [ + { + id: "prefs", + title: "Open Preferences", + subtitle: "Ctrl/Cmd+,", + keywords: ["settings", "preferences"], + run: h.openPreferences, + }, + { + id: "palette", + title: "Command Palette", + subtitle: "Ctrl/Cmd+P", + keywords: ["commands"], + run: h.openPalette, + }, + { + id: "goto", + title: "Go to Object…", + subtitle: "Ctrl/Cmd+K", + keywords: ["quick", "switcher", "table"], + run: h.openQuickSwitcher, + }, + { + id: "sidebar", + title: "Toggle Sidebar", + subtitle: "Ctrl/Cmd+B", + keywords: ["panel", "servers"], + run: h.toggleSidebar, + }, + { + id: "home", + title: "Go Home", + keywords: ["overview", "connection"], + run: h.goHome, + }, + { + id: "demo", + title: "Launch Demo Playground", + keywords: ["demo", "sample"], + run: h.launchDemo, + }, + { + id: "sqlite", + title: "Open SQLite File…", + keywords: ["file", "database"], + run: h.openSqlite, + }, + { + id: "new-conn", + title: "New Connection", + subtitle: "Ctrl/Cmd+N", + keywords: ["connect"], + run: h.newConnection, + }, + { + id: "tour", + title: "Welcome Tour", + keywords: ["onboarding", "help"], + run: h.openTour, + }, + { + id: "about", + title: "About Querya", + keywords: ["version"], + run: h.openAbout, + }, + { + id: "updates", + title: "Check for Updates…", + keywords: ["updater"], + run: h.checkUpdates, + }, + ]; +} + +export function filterCommands( + commands: AppCommand[], + query: string, +): AppCommand[] { + const q = query.trim().toLowerCase(); + if (!q) return commands; + return commands.filter((c) => { + const hay = [c.title, c.subtitle ?? "", ...(c.keywords ?? [])] + .join(" ") + .toLowerCase(); + return hay.includes(q); + }); +} diff --git a/apps/tauri/src/ui/AboutDialog.vue b/apps/tauri/src/ui/AboutDialog.vue new file mode 100644 index 00000000..9e95d701 --- /dev/null +++ b/apps/tauri/src/ui/AboutDialog.vue @@ -0,0 +1,122 @@ + + + + + diff --git a/apps/tauri/src/ui/CommandPalette.vue b/apps/tauri/src/ui/CommandPalette.vue new file mode 100644 index 00000000..9729f8f6 --- /dev/null +++ b/apps/tauri/src/ui/CommandPalette.vue @@ -0,0 +1,175 @@ + + + + + diff --git a/apps/tauri/src/ui/QuickSwitcher.vue b/apps/tauri/src/ui/QuickSwitcher.vue new file mode 100644 index 00000000..0c745849 --- /dev/null +++ b/apps/tauri/src/ui/QuickSwitcher.vue @@ -0,0 +1,211 @@ + + + + + diff --git a/apps/tauri/src/ui/TitleBar.vue b/apps/tauri/src/ui/TitleBar.vue index c1e9b653..dde34fa4 100644 --- a/apps/tauri/src/ui/TitleBar.vue +++ b/apps/tauri/src/ui/TitleBar.vue @@ -21,6 +21,11 @@ const props = withDefaults( const emit = defineEmits<{ openSqlite: []; openPreferences: []; + openPalette: []; + openQuickSwitcher: []; + openTour: []; + openAbout: []; + checkUpdates: []; }>(); const motion = useQueryaMotion(); @@ -143,7 +148,12 @@ onUnmounted(() => { diff --git a/apps/tauri/src/ui/TitleBarMenus.vue b/apps/tauri/src/ui/TitleBarMenus.vue index 924d362a..24db9b35 100644 --- a/apps/tauri/src/ui/TitleBarMenus.vue +++ b/apps/tauri/src/ui/TitleBarMenus.vue @@ -4,10 +4,15 @@ import { onMounted, onUnmounted, ref } from "vue"; const emit = defineEmits<{ openSqlite: []; openPreferences: []; + openPalette: []; + openQuickSwitcher: []; toggleSidebar: []; + openTour: []; + openAbout: []; + checkUpdates: []; }>(); -type MenuId = "file" | "edit" | "view" | null; +type MenuId = "file" | "edit" | "view" | "help" | null; const openMenu = ref(null); @@ -78,6 +83,20 @@ onUnmounted(() => { Edit + +
+ + +
diff --git a/apps/tauri/src/ui/WelcomeTourDialog.vue b/apps/tauri/src/ui/WelcomeTourDialog.vue new file mode 100644 index 00000000..2aff6ff6 --- /dev/null +++ b/apps/tauri/src/ui/WelcomeTourDialog.vue @@ -0,0 +1,247 @@ + + + + + diff --git a/apps/tauri/src/ui/WorkspaceEmptyHero.vue b/apps/tauri/src/ui/WorkspaceEmptyHero.vue index fba38d37..ed4dd105 100644 --- a/apps/tauri/src/ui/WorkspaceEmptyHero.vue +++ b/apps/tauri/src/ui/WorkspaceEmptyHero.vue @@ -1,10 +1,18 @@ @@ -118,11 +142,79 @@ const emit = defineEmits<{ background: transparent; } +.recents { + margin-top: var(--q-space-5); + width: min(22rem, 100%); + text-align: left; +} + +.recents h2 { + margin: 0 0 8px; + font-size: 11px; + font-weight: 700; + letter-spacing: 0.06em; + text-transform: uppercase; + color: var(--q-muted-foreground); +} + +.recents ul { + list-style: none; + margin: 0; + padding: 0; + display: flex; + flex-direction: column; + gap: 2px; +} + +.recent { + appearance: none; + width: 100%; + border: 0; + background: transparent; + display: flex; + justify-content: space-between; + gap: 8px; + padding: 8px 10px; + border-radius: var(--q-radius-control); + cursor: pointer; + color: var(--q-foreground); + font: inherit; + font-size: 13px; + text-align: left; +} + +.recent:hover { + background: var(--q-accent); +} + +.r-name { + font-weight: 500; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.r-meta { + flex-shrink: 0; + font-size: 11px; + color: var(--q-muted-foreground); + font-family: var(--q-font-mono); +} + .hint { margin: var(--q-space-4) 0 0; - max-width: 32rem; + max-width: 36rem; font-size: 12px; color: var(--q-muted-foreground); line-height: 1.45; } + +kbd { + font-family: var(--q-font-mono); + font-size: 11px; + padding: 1px 5px; + border-radius: 4px; + border: 1px solid var(--q-border); + background: var(--q-surface); +}