Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 44 additions & 36 deletions apps/tauri/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { computed, onMounted, onUnmounted, ref } from "vue";
import { invoke } from "@tauri-apps/api/core";
import { open } from "@tauri-apps/plugin-dialog";
import { open as pickSqliteFile } from "@tauri-apps/plugin-dialog";
import { storeToRefs } from "pinia";
import { useShellStore } from "./stores/shell";
import { useShellStatusStore } from "./stores/shellStatus";
Expand Down Expand Up @@ -53,7 +53,7 @@ const showTable = computed(() => surface.value === "tableObject");

async function onOpenSqlite() {
try {
const selected = await open({
const selected = await pickSqliteFile({
multiple: false,
directory: false,
title: "Open SQLite database",
Expand All @@ -74,8 +74,6 @@ function onNewConnection() {
}

async function onConnectSqliteFromDialog(payload: SqliteConnectPayload) {
// Close first — connect is async and must not leave the modal stuck open.
newConnectionOpen.value = false;
try {
await connections.connectSqlite(payload.path, { name: payload.name });
} catch {
Expand Down Expand Up @@ -206,38 +204,41 @@ onUnmounted(() => {
</script>

<template>
<div class="app-frame" data-testid="main-screen">
<TitleBar
@open-sqlite="onOpenSqlite"
@open-preferences="onOpenPreferences"
@open-palette="onOpenPalette"
@open-quick-switcher="onOpenQuickSwitcher"
@open-tour="onOpenTour"
@open-about="onOpenAbout"
@check-updates="onCheckUpdates"
/>
<QueryaDivider />
<div class="body">
<ConnectionsPanel
@new-connection="onNewConnection"
@new-folder="onNewFolder"
<!-- Dialogs sit outside `.app-frame` so UI zoom cannot kill scrim blur. -->
<div class="shell" data-testid="main-screen">
<div class="app-frame">
<TitleBar
@open-sqlite="onOpenSqlite"
@open-preferences="onOpenPreferences"
@open-palette="onOpenPalette"
@open-quick-switcher="onOpenQuickSwitcher"
@open-tour="onOpenTour"
@open-about="onOpenAbout"
@check-updates="onCheckUpdates"
/>
<main class="workspace">
<div class="workspace-body">
<WorkspaceEmptyHero
v-if="showEmpty"
@new-connection="onNewConnection"
@open-sqlite="onOpenSqlite"
@launch-demo="onLaunchDemo"
@open-tour="onOpenTour"
@open-recent="onOpenRecent"
/>
<ConnectionHome v-else-if="showHome" />
<TableObjectView v-else-if="showTable" />
</div>
</main>
<QueryaDivider />
<div class="body">
<ConnectionsPanel
@new-connection="onNewConnection"
@new-folder="onNewFolder"
/>
<main class="workspace">
<div class="workspace-body">
<WorkspaceEmptyHero
v-if="showEmpty"
@new-connection="onNewConnection"
@open-sqlite="onOpenSqlite"
@launch-demo="onLaunchDemo"
@open-tour="onOpenTour"
@open-recent="onOpenRecent"
/>
<ConnectionHome v-else-if="showHome" />
<TableObjectView v-else-if="showTable" />
</div>
</main>
</div>
<StatusBar @open-preferences="onOpenPreferences" />
</div>
<StatusBar @open-preferences="onOpenPreferences" />

<PreferencesDialog :open="prefsOpen" @close="prefsOpen = false" />
<CommandPalette
Expand All @@ -259,21 +260,28 @@ onUnmounted(() => {
@create="onCreateFolder"
/>
<NewConnectionDialog
:open="newConnectionOpen"
@close="newConnectionOpen = false"
v-model:open="newConnectionOpen"
@connect-sqlite="onConnectSqliteFromDialog"
/>
</div>
</template>

<style scoped>
.shell {
height: 100%;
min-height: 100%;
}

.app-frame {
height: 100%;
min-height: 100%;
display: flex;
flex-direction: column;
background: var(--q-canvas);
color: var(--q-foreground);
/* Flutter ui_scale — keep off modal ancestors (backdrop-filter / bokeh). */
zoom: var(--q-ui-scale);
transition: zoom var(--q-motion-slow) var(--q-motion-ease);
}

.body {
Expand Down
6 changes: 3 additions & 3 deletions apps/tauri/src/styles/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ body {
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
/* Whole-chrome scale from Preferences → Appearance (Flutter ui_scale). */
zoom: var(--q-ui-scale);
transition: zoom var(--q-motion-slow) var(--q-motion-ease);
}

/* UI scale lives on `.app-frame` (see App.vue) — not body/#app — so modal
* scrims outside that subtree keep working backdrop-filter (bokeh). */
5 changes: 3 additions & 2 deletions apps/tauri/src/styles/glass.css
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,14 @@
* + dim tint. Tint only fades; blur stays fixed so enter/exit stay cheap (#1341).
*/
:root {
--q-modal-scrim-blur: 8px;
--q-modal-scrim-blur: 12px;
--q-modal-scrim-tint: color-mix(in srgb, #000 32%, transparent);
}

:root[data-platform="linux"],
:root[data-platform="windows"] {
--q-modal-scrim-blur: 6px;
/* WebKitGTK/WebView2: a bit softer than macOS, still clearly frosted. */
--q-modal-scrim-blur: 10px;
}

:root[data-motion="off"],
Expand Down
59 changes: 31 additions & 28 deletions apps/tauri/src/ui/NewConnectionDialog.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<script setup lang="ts">
import { computed, nextTick, onUnmounted, ref, watch } from "vue";
import { open } from "@tauri-apps/plugin-dialog";
// Must not be named `open` — it would shadow the `open` prop/model in the
// template and make `v-if="open"` always truthy (Save connected, dialog stuck).
import { open as pickSqliteFile } from "@tauri-apps/plugin-dialog";

export type BuiltInDriverId =
| "postgresql"
Expand Down Expand Up @@ -64,12 +66,16 @@ const CATEGORY_ITEMS: { id: Category; label: string }[] = [
{ id: "nosql", label: "NoSQL" },
];

const props = defineProps<{ open: boolean }>();
/** Flutter: dialog owns dismiss via Navigator.pop — we mirror with v-model. */
const open = defineModel<boolean>("open", { required: true });
const emit = defineEmits<{
close: [];
connectSqlite: [payload: SqliteConnectPayload];
}>();

function dismiss() {
open.value = false;
}

type Step = "pick" | "sqlite" | "stub";

const step = ref<Step>("pick");
Expand Down Expand Up @@ -120,15 +126,12 @@ function reset() {
stubDriver.value = null;
}

watch(
() => props.open,
async (v) => {
if (!v) return;
reset();
await nextTick();
searchEl.value?.focus();
},
);
watch(open, async (v) => {
if (!v) return;
reset();
await nextTick();
searchEl.value?.focus();
});

watch([category, search], () => {
if (
Expand Down Expand Up @@ -172,7 +175,7 @@ function goBack() {

async function browseSqlite() {
try {
const selectedPath = await open({
const selectedPath = await pickSqliteFile({
multiple: false,
directory: false,
title: "Select SQLite database",
Expand Down Expand Up @@ -205,41 +208,40 @@ function submitSqlite() {
error.value = "Database file path is required.";
return;
}
// Close before connect so the scrim never outlives a successful Save.
emit("close");
// Flutter sqlite form: Navigator.pop after accept — dismiss first, then save.
dismiss();
emit("connectSqlite", { driver: "sqlite", name: n, path: p });
}

function onKey(e: KeyboardEvent) {
if (!props.open) return;
if (!open.value) return;
if (e.key === "Escape") {
e.preventDefault();
if (step.value !== "pick") goBack();
else emit("close");
else dismiss();
} else if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
e.preventDefault();
if (step.value === "pick" && canNext.value) goNext();
else if (step.value === "sqlite" && canSaveSqlite.value) submitSqlite();
}
}

watch(
() => props.open,
(v) => {
if (v) window.addEventListener("keydown", onKey, true);
else window.removeEventListener("keydown", onKey, true);
},
);
watch(open, (v) => {
if (v) window.addEventListener("keydown", onKey, true);
else window.removeEventListener("keydown", onKey, true);
});

onUnmounted(() => window.removeEventListener("keydown", onKey, true));
</script>

<template>
<!-- Teleport outside #app zoom so backdrop-filter (bokeh) can sample the UI. -->
<Teleport to="body">
<div
v-if="open"
class="overlay q-modal-scrim"
data-testid="new-connection-dialog"
@click.self="emit('close')"
@click.self="dismiss"
>
<!-- Step 1: Select your database (Flutter parity) -->
<div
Expand Down Expand Up @@ -346,7 +348,7 @@ onUnmounted(() => window.removeEventListener("keydown", onKey, true));
</div>

<footer>
<button type="button" class="btn ghost" @click="emit('close')">
<button type="button" class="btn ghost" @click="dismiss">
Cancel
</button>
<button
Expand Down Expand Up @@ -407,7 +409,7 @@ onUnmounted(() => window.removeEventListener("keydown", onKey, true));

<footer>
<button type="button" class="btn ghost" @click="goBack">Back</button>
<button type="button" class="btn ghost" @click="emit('close')">
<button type="button" class="btn ghost" @click="dismiss">
Cancel
</button>
<button
Expand Down Expand Up @@ -453,12 +455,13 @@ onUnmounted(() => window.removeEventListener("keydown", onKey, true));
</div>
<footer>
<button type="button" class="btn ghost" @click="goBack">Back</button>
<button type="button" class="btn primary" @click="emit('close')">
<button type="button" class="btn primary" @click="dismiss">
Close
</button>
</footer>
</div>
</div>
</Teleport>
</template>

<style scoped>
Expand Down
Loading