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:
@@ -14,7 +14,9 @@
|
||||
{
|
||||
"title": "OpenPylon",
|
||||
"width": 1200,
|
||||
"height": 800
|
||||
"height": 800,
|
||||
"minWidth": 800,
|
||||
"minHeight": 600
|
||||
}
|
||||
],
|
||||
"security": {
|
||||
|
||||
12
src/App.tsx
12
src/App.tsx
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user