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
11 changes: 0 additions & 11 deletions apps/tauri/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@ function onNewConnection() {
});
}

function onNewConnectionFromUrl() {
status.setQueryMetrics({
message: "New connection from URL — form lands next",
busy: false,
});
}

function onNewFolder() {
status.setQueryMetrics({
message: "New folder — LocalDb folders land next",
Expand Down Expand Up @@ -126,12 +119,8 @@ onUnmounted(() => {
<template>
<div class="app-frame" data-testid="main-screen">
<TitleBar
@new-connection="onNewConnection"
@new-connection-from-url="onNewConnectionFromUrl"
@open-sqlite="onOpenSqlite"
@open-preferences="onOpenPreferences"
@open-tour="onOpenTour"
@launch-demo="onLaunchDemo"
/>
<QueryaDivider />
<div class="body">
Expand Down
61 changes: 61 additions & 0 deletions apps/tauri/src/stores/preferences.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { defineStore } from "pinia";
import { reactive, watch } from "vue";

const STORAGE_KEY = "querya.preferences.v1";

export type PrefsState = {
checkUpdatesOnStartup: boolean;
updateChannel: "stable" | "dev";
confirmDestructive: boolean;
editorFontSize: number;
pgTimeoutSec: number | null;
mysqlTimeoutSec: number | null;
sqliteTimeoutSec: number | null;
historyMax: number;
maxResultRows: number;
mcpEnabled: boolean;
extensionsSideload: boolean;
};

const defaults: PrefsState = {
checkUpdatesOnStartup: true,
updateChannel: "stable",
confirmDestructive: true,
editorFontSize: 13,
pgTimeoutSec: 30,
mysqlTimeoutSec: 30,
sqliteTimeoutSec: 30,
historyMax: 200,
maxResultRows: 5000,
mcpEnabled: false,
extensionsSideload: true,
};

function load(): PrefsState {
try {
const raw = localStorage.getItem(STORAGE_KEY);
if (!raw) return { ...defaults };
return { ...defaults, ...JSON.parse(raw) };
} catch {
return { ...defaults };
}
}

/** App preferences — Flutter PreferencesDialog shape, localStorage for now. */
export const usePreferencesStore = defineStore("preferences", () => {
const state = reactive<PrefsState>(load());

watch(
state,
() => {
localStorage.setItem(STORAGE_KEY, JSON.stringify(state));
},
{ deep: true },
);

function reset() {
Object.assign(state, defaults);
}

return { state, reset };
});
Loading
Loading