From ae4cc8cfe6aae009b84f7a75138e158cbe174403 Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Thu, 15 Jun 2023 00:51:28 -0500 Subject: [PATCH] let's do another build --- package.json | 2 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 8 ++-- src-tauri/src/{kanji.rs => kanji/mod.rs} | 2 + src-tauri/src/kanji/query.rs | 1 + src-tauri/src/main.rs | 10 +++++ src-tauri/tauri.conf.json | 7 +++- src/panes/SettingsPane.module.scss | 4 ++ src/panes/SettingsPane.tsx | 52 ++++++++++++++++++------ 9 files changed, 69 insertions(+), 19 deletions(-) rename src-tauri/src/{kanji.rs => kanji/mod.rs} (99%) create mode 100644 src-tauri/src/kanji/query.rs create mode 100644 src/panes/SettingsPane.module.scss diff --git a/package.json b/package.json index e3d1c3c..e9644d6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "houhou", "private": true, - "version": "0.1.0", + "version": "0.1.0-rc2", "type": "module", "scripts": { "dev": "vite", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 34c3a27..0f5b99a 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -1635,7 +1635,7 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "houhou" -version = "0.1.0" +version = "0.1.0-rc2" dependencies = [ "anyhow", "base64 0.21.2", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 502f366..26aeb7e 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "houhou" -version = "0.1.0" -description = "A Tauri App" -authors = ["you"] +version = "0.1.0-rc2" +description = "Houhou SRS" +authors = ["Michael Zhang "] license = "" repository = "" edition = "2021" @@ -14,7 +14,7 @@ members = ["database-maker"] tauri-build = { version = "1.3", features = [] } [dependencies] -tauri = { version = "1.3", features = ["notification-all", "shell-open", "system-tray"] } +tauri = { version = "1.3", features = [ "app-all", "notification-all", "shell-open", "system-tray"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" dirs = "5.0.1" diff --git a/src-tauri/src/kanji.rs b/src-tauri/src/kanji/mod.rs similarity index 99% rename from src-tauri/src/kanji.rs rename to src-tauri/src/kanji/mod.rs index 92db128..3f5ca18 100644 --- a/src-tauri/src/kanji.rs +++ b/src-tauri/src/kanji/mod.rs @@ -1,3 +1,5 @@ +pub mod query; + use std::{collections::HashMap, io::Read, path::PathBuf}; use base64::{engine::general_purpose, Engine as _}; diff --git a/src-tauri/src/kanji/query.rs b/src-tauri/src/kanji/query.rs new file mode 100644 index 0000000..9906bc1 --- /dev/null +++ b/src-tauri/src/kanji/query.rs @@ -0,0 +1 @@ +pub struct KanjiQuery {} diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 40e60d4..bbf1fdf 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -88,6 +88,16 @@ async fn main() -> Result<()> { _ => {} }) .on_system_tray_event(|app, event| match event { + SystemTrayEvent::LeftClick { + tray_id, + position, + size, + .. + } => { + if let Some(main_window) = app.get_window("main") { + main_window.show(); + } + } SystemTrayEvent::MenuItemClick { id, .. } => match id.as_str() { "quit" => { process::exit(0); diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index d6eadf5..e22abf8 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,11 +8,16 @@ }, "package": { "productName": "houhou", - "version": "0.1.0" + "version": "0.1.0-rc2" }, "tauri": { "allowlist": { "all": false, + "app": { + "all": true, + "hide": true, + "show": true + }, "shell": { "all": false, "open": true diff --git a/src/panes/SettingsPane.module.scss b/src/panes/SettingsPane.module.scss new file mode 100644 index 0000000..be4b68c --- /dev/null +++ b/src/panes/SettingsPane.module.scss @@ -0,0 +1,4 @@ +.main { + padding: 16px; + width: 100%; +} diff --git a/src/panes/SettingsPane.tsx b/src/panes/SettingsPane.tsx index 5a461aa..3338257 100644 --- a/src/panes/SettingsPane.tsx +++ b/src/panes/SettingsPane.tsx @@ -1,6 +1,10 @@ import { invoke } from "@tauri-apps/api/tauri"; import useSWR from "swr"; import SelectOnClick from "../components/utils/SelectOnClick"; +import styles from "./SettingsPane.module.scss"; +import { Button, Table, Td, Tr } from "@chakra-ui/react"; +import { getVersion } from "@tauri-apps/api/app"; +import { useEffect, useState } from "react"; interface ApplicationInfo { kanji_db_path: string; @@ -12,19 +16,43 @@ export function Component() { invoke("application_info"), ); + const [version, setVersion] = useState(""); + useEffect(() => { + getVersion().then((result) => setVersion(result)); + }, []); + return ( - <> -
    -
  • - Kanji DB path: - {info?.kanji_db_path} -
  • -
  • - SRS DB path: - {info?.srs_db_path} -
  • -
- +
+ + + + + + + + + + + + + + + + + + + + +
Kanji DB Path + {info?.kanji_db_path} +
SRS DB Path + {info?.srs_db_path} +
Links + + + +
Version{version}
+
); }