feat: add window close handler, configure minimum window size

Flush pending board saves on window close via Tauri's onCloseRequested.
Set minimum window dimensions to 800x600.
This commit is contained in:
Your Name
2026-02-15 19:24:00 +02:00
parent 4638ce046c
commit 07a4275e8c
2 changed files with 15 additions and 1 deletions

View File

@@ -1,5 +1,7 @@
import { useState, useEffect, useCallback } from "react";
import { getCurrentWindow } from "@tauri-apps/api/window";
import { useAppStore } from "@/stores/app-store";
import { useBoardStore } from "@/stores/board-store";
import { AppShell } from "@/components/layout/AppShell";
import { BoardList } from "@/components/boards/BoardList";
import { BoardView } from "@/components/board/BoardView";
@@ -18,6 +20,16 @@ export default function App() {
init();
}, [init]);
// Flush pending board saves before the app window closes
useEffect(() => {
const unlisten = getCurrentWindow().onCloseRequested(async () => {
useBoardStore.getState().closeBoard();
});
return () => {
unlisten.then((fn) => fn());
};
}, []);
// Listen for custom event to open settings from TopBar or command palette
useEffect(() => {
function handleOpenSettings() {