diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index a4b62d6..9cafef5 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -17,7 +17,7 @@ tauri-build = { version = "1.2.1", features = [] } [dependencies] serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } -tauri = { version = "1.2", features = ["clipboard-write-text", "fs-create-dir", "fs-read-dir", "fs-read-file", "fs-write-file", "global-shortcut-all", "notification-all", "path-all", "process-exit", "system-tray", "window-close", "window-create", "window-hide", "window-set-focus", "window-show", "window-start-dragging", "window-unminimize"] } +tauri = { version = "1.2", features = ["clipboard-write-text", "fs-create-dir", "fs-read-dir", "fs-read-file", "fs-write-file", "global-shortcut-all", "notification-all", "path-all", "process-exit", "system-tray", "window-close", "window-create", "window-hide", "window-set-focus", "window-set-size", "window-show", "window-start-dragging", "window-unminimize"] } tauri-plugin-autostart = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } tauri-plugin-single-instance = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 19aee6d..66fcc89 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -31,7 +31,8 @@ "unminimize": true, "setFocus": true, "show": true, - "startDragging": true + "startDragging": true, + "setSize": true }, "fs": { "createDir": true, @@ -79,7 +80,7 @@ "title": "RunMath", "alwaysOnTop": true, "fullscreen": false, - "height": 100, + "height": 44, "resizable": false, "width": 700, "center": true, diff --git a/src/components/ConsoleResult.tsx b/src/components/ConsoleResult.tsx index 12384e2..50f5f7a 100644 --- a/src/components/ConsoleResult.tsx +++ b/src/components/ConsoleResult.tsx @@ -1,10 +1,7 @@ import { useCalculatorStore } from "@state/calculator"; import styles from "./console.module.css"; import { useCopyToClipboardSubscription } from "../hooks/useCopyToClipboardSubscription"; - -const shouldDisplayInSubconsole = (input: string, result: string) => { - return input.length + 3 + result.length > 34; -}; +import { shouldDisplayInSubconsole, SubConsoleResult } from "./SubConsoleResult"; const calculateConsoleResult = (input: string, result: any) => { return " ".repeat(input.length) + " = " + result; @@ -18,13 +15,7 @@ export const ConsoleResult = () => { if (!result) return null; if (shouldDisplayInSubconsole(input, String(result))) { - return ( - - ); + return } const value = calculateConsoleResult(input, result); diff --git a/src/components/SubConsoleResult.tsx b/src/components/SubConsoleResult.tsx new file mode 100644 index 0000000..2a5b9d8 --- /dev/null +++ b/src/components/SubConsoleResult.tsx @@ -0,0 +1,15 @@ +import { useBiggerScreen } from "../hooks/useBiggerScreen"; +import styles from "./console.module.css"; + +export const shouldDisplayInSubconsole = (input: string, result: string) => { + return input.length + 3 + result.length > 34; +}; + +export const SubConsoleResult = ({ value }: { value: string }) => { + useBiggerScreen() + return +} diff --git a/src/hooks/useBiggerScreen.ts b/src/hooks/useBiggerScreen.ts new file mode 100644 index 0000000..c6d5579 --- /dev/null +++ b/src/hooks/useBiggerScreen.ts @@ -0,0 +1,12 @@ +import { useEffect } from "react" +import { appWindow, LogicalSize } from "@tauri-apps/api/window" + +export const useBiggerScreen = () => { + useEffect(() => { + appWindow.setSize(new LogicalSize(700, 88)) + + return () => { + appWindow.setSize(new LogicalSize(700, 44)) + } + }, []) +}