Wholesale JS -> TS migration of the frontend — stores, utils, actions,
and all Svelte component scripts adopt type annotations. Compile-time
surfaces (app.d.ts, lib/types/) added for shared DTO types.
Build plumbing:
- package.json: dev:frontend script that runs svelte-kit sync first
- tauri.conf.json: beforeDevCommand points at dev:frontend
- run.sh: dropped the sed-hack that temporarily blanked beforeDevCommand;
now relies on npm run dev:frontend to avoid double-Vite
- jsconfig.json: allowImportingTsExtensions
Preserves all Group 1 behaviour:
- page.svelte.ts keeps loadHistory / loadTasks Tauri-first, no
localStorage; saveTranscriptMeta + mapTranscriptRow + mapTaskRow
intact; update_task_cmd and update_transcript_meta_cmd invocations
carry the correct payload shape.
- Toasts, preferences stores typed without behaviour change.
- Viewer still routes segment edits through saveTranscriptMeta; the
Task 1.5 TODO markers are gone.
taskExtractor.ts is functionally improved during the migration:
- multi-task matches in the same sentence
- list-style shopping-verb expansion (get bread, milk, and cheese)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
81 lines
2.8 KiB
Svelte
81 lines
2.8 KiB
Svelte
<script lang="ts">
|
|
import { getCurrentWindow } from "@tauri-apps/api/window";
|
|
import { settings } from "$lib/stores/page.svelte.js";
|
|
|
|
let { compact = false } = $props();
|
|
|
|
let maximised = $state(false);
|
|
|
|
async function handleMinimise() {
|
|
await getCurrentWindow().minimize();
|
|
}
|
|
|
|
async function handleMaximise() {
|
|
await getCurrentWindow().toggleMaximize();
|
|
maximised = await getCurrentWindow().isMaximized();
|
|
}
|
|
|
|
async function handleClose() {
|
|
await getCurrentWindow().hide();
|
|
}
|
|
|
|
function handleDragStart(e: PointerEvent) {
|
|
if (e.button !== 0) return;
|
|
if ((e.target as HTMLElement | null)?.closest("button")) return;
|
|
try { (e.currentTarget as HTMLElement | null)?.setPointerCapture?.(e.pointerId); } catch {}
|
|
getCurrentWindow().startDragging();
|
|
}
|
|
|
|
// Track maximise state
|
|
$effect(() => {
|
|
let unlisten: (() => void) | undefined;
|
|
getCurrentWindow().onResized(async () => {
|
|
maximised = await getCurrentWindow().isMaximized();
|
|
}).then((fn) => unlisten = fn);
|
|
return () => unlisten?.();
|
|
});
|
|
</script>
|
|
|
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
<div
|
|
class="flex items-center select-none bg-sidebar border-b border-border-subtle
|
|
{compact ? 'h-[28px]' : 'h-[32px]'}"
|
|
onpointerdown={handleDragStart}
|
|
>
|
|
{#if !compact}
|
|
<!-- Left spacer: aligns with sidebar width -->
|
|
<div
|
|
class="transition-all {settings.sidebarCollapsed ? 'w-[48px] min-w-[48px]' : 'w-[210px] min-w-[210px]'}"
|
|
style="transition-duration: var(--duration-ui)"
|
|
></div>
|
|
{/if}
|
|
|
|
<!-- Centre: drag area -->
|
|
<div class="flex-1"></div>
|
|
|
|
<!-- Window controls -->
|
|
<div class="flex items-center h-full">
|
|
<button class="titlebar-btn hover:bg-hover" onclick={handleMinimise} aria-label="Minimise">
|
|
<svg class="w-3 h-3" viewBox="0 0 12 12" aria-hidden="true">
|
|
<rect y="5" width="12" height="1.5" rx="0.5" fill="currentColor" />
|
|
</svg>
|
|
</button>
|
|
<button class="titlebar-btn hover:bg-hover" onclick={handleMaximise} aria-label="Maximise">
|
|
{#if maximised}
|
|
<svg class="w-3 h-3" viewBox="0 0 12 12" aria-hidden="true">
|
|
<path d="M3 1h8v8h-2v2H1V3h2V1zm1 1v1h5v5h1V2H4zm-2 2v6h6V4H2z" fill="currentColor" />
|
|
</svg>
|
|
{:else}
|
|
<svg class="w-3 h-3" viewBox="0 0 12 12" aria-hidden="true">
|
|
<rect x="1" y="1" width="10" height="10" rx="1" fill="none" stroke="currentColor" stroke-width="1.5" />
|
|
</svg>
|
|
{/if}
|
|
</button>
|
|
<button class="titlebar-btn hover:bg-danger/20 hover:text-danger" onclick={handleClose} aria-label="Close">
|
|
<svg class="w-3 h-3" viewBox="0 0 12 12" aria-hidden="true">
|
|
<path d="M1 1l10 10M11 1L1 11" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
</div>
|