let's do another build

This commit is contained in:
Michael Zhang 2023-06-15 00:51:28 -05:00
parent 84e5c926df
commit ae4cc8cfe6
9 changed files with 69 additions and 19 deletions

View file

@ -1,7 +1,7 @@
{ {
"name": "houhou", "name": "houhou",
"private": true, "private": true,
"version": "0.1.0", "version": "0.1.0-rc2",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

2
src-tauri/Cargo.lock generated
View file

@ -1635,7 +1635,7 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]] [[package]]
name = "houhou" name = "houhou"
version = "0.1.0" version = "0.1.0-rc2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"base64 0.21.2", "base64 0.21.2",

View file

@ -1,8 +1,8 @@
[package] [package]
name = "houhou" name = "houhou"
version = "0.1.0" version = "0.1.0-rc2"
description = "A Tauri App" description = "Houhou SRS"
authors = ["you"] authors = ["Michael Zhang <mail@mzhang.io>"]
license = "" license = ""
repository = "" repository = ""
edition = "2021" edition = "2021"
@ -14,7 +14,7 @@ members = ["database-maker"]
tauri-build = { version = "1.3", features = [] } tauri-build = { version = "1.3", features = [] }
[dependencies] [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 = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"
dirs = "5.0.1" dirs = "5.0.1"

View file

@ -1,3 +1,5 @@
pub mod query;
use std::{collections::HashMap, io::Read, path::PathBuf}; use std::{collections::HashMap, io::Read, path::PathBuf};
use base64::{engine::general_purpose, Engine as _}; use base64::{engine::general_purpose, Engine as _};

View file

@ -0,0 +1 @@
pub struct KanjiQuery {}

View file

@ -88,6 +88,16 @@ async fn main() -> Result<()> {
_ => {} _ => {}
}) })
.on_system_tray_event(|app, event| match event { .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() { SystemTrayEvent::MenuItemClick { id, .. } => match id.as_str() {
"quit" => { "quit" => {
process::exit(0); process::exit(0);

View file

@ -8,11 +8,16 @@
}, },
"package": { "package": {
"productName": "houhou", "productName": "houhou",
"version": "0.1.0" "version": "0.1.0-rc2"
}, },
"tauri": { "tauri": {
"allowlist": { "allowlist": {
"all": false, "all": false,
"app": {
"all": true,
"hide": true,
"show": true
},
"shell": { "shell": {
"all": false, "all": false,
"open": true "open": true

View file

@ -0,0 +1,4 @@
.main {
padding: 16px;
width: 100%;
}

View file

@ -1,6 +1,10 @@
import { invoke } from "@tauri-apps/api/tauri"; import { invoke } from "@tauri-apps/api/tauri";
import useSWR from "swr"; import useSWR from "swr";
import SelectOnClick from "../components/utils/SelectOnClick"; 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 { interface ApplicationInfo {
kanji_db_path: string; kanji_db_path: string;
@ -12,19 +16,43 @@ export function Component() {
invoke<ApplicationInfo>("application_info"), invoke<ApplicationInfo>("application_info"),
); );
const [version, setVersion] = useState("");
useEffect(() => {
getVersion().then((result) => setVersion(result));
}, []);
return ( return (
<> <main className={styles.main}>
<ul> <Table>
<li> <Tr>
Kanji DB path: <Td>Kanji DB Path</Td>
<SelectOnClick>{info?.kanji_db_path}</SelectOnClick> <Td>
</li> <SelectOnClick>{info?.kanji_db_path}</SelectOnClick>
<li> </Td>
SRS DB path: </Tr>
<SelectOnClick>{info?.srs_db_path}</SelectOnClick>
</li> <Tr>
</ul> <Td>SRS DB Path</Td>
</> <Td>
<SelectOnClick>{info?.srs_db_path}</SelectOnClick>
</Td>
</Tr>
<Tr>
<Td>Links</Td>
<Td>
<a href="https://git.mzhang.io/michael/houhou" target="_blank" rel="noopener">
<Button>Source Code</Button>
</a>
</Td>
</Tr>
<Tr>
<Td>Version</Td>
<Td>{version}</Td>
</Tr>
</Table>
</main>
); );
} }