design: upgrade global design of the app
This commit is contained in:
25
src/App.tsx
25
src/App.tsx
@ -1,8 +1,10 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { getCurrentWindow, LogicalSize } from "@tauri-apps/api/window";
|
||||
import { WebviewWindow } from "@tauri-apps/api/webviewWindow";
|
||||
import { useStore } from "./store";
|
||||
import TitleBar from "./components/TitleBar";
|
||||
import ResizeHandles from "./components/ResizeHandles";
|
||||
import HomeView from "./components/HomeView";
|
||||
import GuideView from "./components/GuideView";
|
||||
import SettingsPanel from "./components/SettingsPanel";
|
||||
@ -58,7 +60,27 @@ export default function App() {
|
||||
}, 500);
|
||||
});
|
||||
|
||||
return () => { unlisten.then(f => f()); };
|
||||
const unlistenFocus = win.listen("tauri://focus", async () => {
|
||||
const viewer = await WebviewWindow.getByLabel("image-viewer");
|
||||
if (viewer) {
|
||||
const isMin = await viewer.isMinimized();
|
||||
if (isMin) await viewer.unminimize();
|
||||
}
|
||||
});
|
||||
|
||||
const unlistenBlur = win.listen("tauri://blur", async () => {
|
||||
const isMin = await win.isMinimized();
|
||||
if (isMin) {
|
||||
const viewer = await WebviewWindow.getByLabel("image-viewer");
|
||||
if (viewer) await viewer.minimize();
|
||||
}
|
||||
});
|
||||
|
||||
return () => {
|
||||
unlisten.then(f => f());
|
||||
unlistenFocus.then(f => f());
|
||||
unlistenBlur.then(f => f());
|
||||
};
|
||||
}, []);
|
||||
|
||||
async function handleInitialSync() {
|
||||
@ -68,6 +90,7 @@ export default function App() {
|
||||
|
||||
return (
|
||||
<div className="app-shell">
|
||||
<ResizeHandles />
|
||||
<TitleBar onOpenSettings={() => setShowSettings(s => !s)} />
|
||||
<div className="app-body">
|
||||
<main className="app-main">
|
||||
|
||||
Reference in New Issue
Block a user