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",
|
"title": "OpenPylon",
|
||||||
"width": 1200,
|
"width": 1200,
|
||||||
"height": 800
|
"height": 800,
|
||||||
|
"minWidth": 800,
|
||||||
|
"minHeight": 600
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"security": {
|
"security": {
|
||||||
|
|||||||
12
src/App.tsx
12
src/App.tsx
@@ -1,5 +1,7 @@
|
|||||||
import { useState, useEffect, useCallback } from "react";
|
import { useState, useEffect, useCallback } from "react";
|
||||||
|
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||||
import { useAppStore } from "@/stores/app-store";
|
import { useAppStore } from "@/stores/app-store";
|
||||||
|
import { useBoardStore } from "@/stores/board-store";
|
||||||
import { AppShell } from "@/components/layout/AppShell";
|
import { AppShell } from "@/components/layout/AppShell";
|
||||||
import { BoardList } from "@/components/boards/BoardList";
|
import { BoardList } from "@/components/boards/BoardList";
|
||||||
import { BoardView } from "@/components/board/BoardView";
|
import { BoardView } from "@/components/board/BoardView";
|
||||||
@@ -18,6 +20,16 @@ export default function App() {
|
|||||||
init();
|
init();
|
||||||
}, [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
|
// Listen for custom event to open settings from TopBar or command palette
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
function handleOpenSettings() {
|
function handleOpenSettings() {
|
||||||
|
|||||||
Reference in New Issue
Block a user