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
18 changes: 15 additions & 3 deletions apps/tauri/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
} from "./motion";
import QueryaGlass from "./ui/QueryaGlass.vue";
import TitleBar from "./ui/TitleBar.vue";
import SidebarShell from "./ui/SidebarShell.vue";

const shell = useShellStore();
const motion = provideQueryaMotion();
Expand Down Expand Up @@ -62,10 +63,12 @@ function setMotion(level: QueryaMotionLevel) {
<template>
<div class="app-frame">
<TitleBar />
<main class="workspace">
<div class="body">
<SidebarShell />
<main class="workspace">
<div class="hero">
<header class="brand">Querya</header>
<p class="tagline">Tauri 2 + Vue 3 — tokens + Fluid + custom title bar</p>
<p class="tagline">Tauri 2 + Vue 3 — shell chrome (title + sidebar)</p>
<p class="meta" data-testid="backend-info">{{ backend }}</p>
<p class="meta">
springs: {{ springsOn ? "on" : "off" }} · level: {{ motionLevel }}
Expand Down Expand Up @@ -161,7 +164,8 @@ function setMotion(level: QueryaMotionLevel) {
</p>
</QueryaGlass>
</div>
</main>
</main>
</div>
</div>
</template>

Expand All @@ -175,8 +179,16 @@ function setMotion(level: QueryaMotionLevel) {
color: var(--q-foreground);
}

.body {
flex: 1;
min-height: 0;
display: flex;
flex-direction: row;
}

.workspace {
flex: 1;
min-width: 0;
min-height: 0;
overflow: auto;
}
Expand Down
49 changes: 47 additions & 2 deletions apps/tauri/src/stores/shell.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,58 @@
import { defineStore } from "pinia";
import { ref } from "vue";

/** Placeholder shell store — UI chrome lands in later issues. */
const SIDEBAR_KEY = "querya.sidebar.width";
const SIDEBAR_OPEN_KEY = "querya.sidebar.open";
const MIN_WIDTH = 180;
const MAX_WIDTH = 420;
const DEFAULT_WIDTH = 240;

function readWidth(): number {
const raw = Number(localStorage.getItem(SIDEBAR_KEY));
if (Number.isFinite(raw) && raw >= MIN_WIDTH && raw <= MAX_WIDTH) return raw;
return DEFAULT_WIDTH;
}

function readOpen(): boolean {
const raw = localStorage.getItem(SIDEBAR_OPEN_KEY);
if (raw === null) return true;
return raw !== "0";
}

/** Shell chrome store — sidebar / ready flags for later connection tree. */
export const useShellStore = defineStore("shell", () => {
const ready = ref(false);
const sidebarOpen = ref(readOpen());
const sidebarWidth = ref(readWidth());

function markReady() {
ready.value = true;
}

return { ready, markReady };
function setSidebarOpen(open: boolean) {
sidebarOpen.value = open;
localStorage.setItem(SIDEBAR_OPEN_KEY, open ? "1" : "0");
}

function toggleSidebar() {
setSidebarOpen(!sidebarOpen.value);
}

function setSidebarWidth(width: number) {
const next = Math.min(MAX_WIDTH, Math.max(MIN_WIDTH, Math.round(width)));
sidebarWidth.value = next;
localStorage.setItem(SIDEBAR_KEY, String(next));
}

return {
ready,
markReady,
sidebarOpen,
sidebarWidth,
setSidebarOpen,
toggleSidebar,
setSidebarWidth,
minSidebarWidth: MIN_WIDTH,
maxSidebarWidth: MAX_WIDTH,
};
});
160 changes: 160 additions & 0 deletions apps/tauri/src/ui/SidebarShell.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
<script setup lang="ts">
import { computed, onUnmounted, ref } from "vue";
import { useShellStore } from "../stores/shell";
import { useQueryaMotion } from "../motion";

const shell = useShellStore();
const motion = useQueryaMotion();
const dragging = ref(false);

const panelStyle = computed(() => ({
width: shell.sidebarOpen ? `${shell.sidebarWidth}px` : "0px",
transitionProperty: dragging.value ? "none" : "width",
transitionDuration: `${motion.duration("sidebarCubic")}ms`,
transitionTimingFunction: motion.easing("standard"),
}));

function onResizeStart(e: PointerEvent) {
if (!shell.sidebarOpen) return;
e.preventDefault();
dragging.value = true;
const startX = e.clientX;
const startW = shell.sidebarWidth;

const onMove = (ev: PointerEvent) => {
shell.setSidebarWidth(startW + (ev.clientX - startX));
};
const onUp = () => {
dragging.value = false;
window.removeEventListener("pointermove", onMove);
window.removeEventListener("pointerup", onUp);
};
window.addEventListener("pointermove", onMove);
window.addEventListener("pointerup", onUp);
}

onUnmounted(() => {
dragging.value = false;
});
</script>

<template>
<aside
class="sidebar"
data-testid="sidebar-shell"
:class="{ open: shell.sidebarOpen, dragging }"
:style="panelStyle"
:aria-hidden="!shell.sidebarOpen"
>
<div class="inner q-glass">
<div class="head">
<span class="label">Connections</span>
<button
type="button"
class="icon-btn"
aria-label="Collapse sidebar"
@click="shell.setSidebarOpen(false)"
>
⟨
</button>
</div>
<div class="body">
<p class="empty">No connections yet</p>
<p class="hint">SQLite / Postgres land in later issues</p>
</div>
</div>
<div
class="resizer"
role="separator"
aria-orientation="vertical"
aria-label="Resize sidebar"
@pointerdown="onResizeStart"
/>
</aside>
</template>

<style scoped>
.sidebar {
position: relative;
flex: 0 0 auto;
height: 100%;
min-width: 0;
overflow: hidden;
}

.inner {
height: 100%;
display: flex;
flex-direction: column;
border-radius: 0;
border-top: 0;
border-bottom: 0;
border-left: 0;
min-width: 180px;
}

.head {
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--q-space-2);
padding: var(--q-space-3) var(--q-space-3) var(--q-space-2);
border-bottom: 1px solid var(--q-border);
}

.label {
font-size: var(--q-text-xs);
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
color: var(--q-muted-foreground);
}

.icon-btn {
appearance: none;
border: 0;
background: transparent;
color: var(--q-muted-foreground);
width: 1.75rem;
height: 1.75rem;
border-radius: var(--q-radius-sm);
cursor: pointer;
}

.icon-btn:hover {
background: var(--q-accent);
color: var(--q-foreground);
}

.body {
flex: 1;
padding: var(--q-space-4) var(--q-space-3);
}

.empty {
margin: 0;
font-size: var(--q-text-sm);
color: var(--q-foreground);
}

.hint {
margin: var(--q-space-1) 0 0;
font-size: var(--q-text-xs);
color: var(--q-muted-foreground);
}

.resizer {
position: absolute;
top: 0;
right: 0;
width: 5px;
height: 100%;
cursor: col-resize;
z-index: 2;
}

.resizer:hover,
.dragging .resizer {
background: color-mix(in srgb, var(--q-primary) 35%, transparent);
}
</style>
48 changes: 45 additions & 3 deletions apps/tauri/src/ui/TitleBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { computed, onMounted, onUnmounted, ref } from "vue";
import { getCurrentWindow } from "@tauri-apps/api/window";
import { detectPlatform, type QueryaPlatform } from "./platform";
import { useQueryaMotion } from "../motion";
import { useShellStore } from "../stores/shell";

const props = withDefaults(
defineProps<{
Expand All @@ -12,6 +13,7 @@ const props = withDefaults(
);

const motion = useQueryaMotion();
const shell = useShellStore();
const platform = ref<QueryaPlatform>(detectPlatform());
const maximized = ref(false);

Expand Down Expand Up @@ -113,9 +115,22 @@ onUnmounted(() => {
/>
</div>

<div class="brand" data-tauri-drag-region>
<span class="mark" aria-hidden="true" />
<span class="title">{{ props.title }}</span>
<div class="brand-row">
<button
type="button"
class="sidebar-toggle"
data-no-drag
data-testid="sidebar-toggle"
:aria-pressed="shell.sidebarOpen"
:aria-label="shell.sidebarOpen ? 'Hide sidebar' : 'Show sidebar'"
@click="shell.toggleSidebar()"
>
☰
</button>
<div class="brand" data-tauri-drag-region>
<span class="mark" aria-hidden="true" />
<span class="title">{{ props.title }}</span>
</div>
</div>

<div
Expand Down Expand Up @@ -169,6 +184,33 @@ onUnmounted(() => {
z-index: 20;
}

.brand-row {
display: inline-flex;
align-items: center;
justify-content: center;
gap: var(--q-space-2);
min-width: 0;
}

.sidebar-toggle {
appearance: none;
border: 0;
background: transparent;
color: var(--q-muted-foreground);
width: 1.75rem;
height: 1.75rem;
border-radius: var(--q-radius-sm);
cursor: pointer;
font-size: 0.9rem;
line-height: 1;
}

.sidebar-toggle:hover,
.sidebar-toggle[aria-pressed="true"] {
background: var(--q-accent);
color: var(--q-foreground);
}

.brand {
display: inline-flex;
align-items: center;
Expand Down
Loading