Skip to content

Commit

Permalink
feat: 在关于弹窗添加了版本号显示
Browse files Browse the repository at this point in the history
  • Loading branch information
huangdonghao committed Jul 18, 2023
1 parent f3729ec commit 14f57f6
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "png-palettes",
"private": true,
"version": "1.0.0",
"version": "1.0.1",
"type": "module",
"license": "GPL-3.0-or-later",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license = "GPL-3.0-or-later"
name = "app"
repository = ""
rust-version = "1.59"
version = "1.0.0"
version = "1.0.1"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"package": {
"productName": "Png Palettes",
"version": "1.0.0"
"version": "1.0.1"
},
"tauri": {
"allowlist": {
Expand Down
18 changes: 12 additions & 6 deletions src/components/Container/OptionsArea/UIControl/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,25 @@ import ThemeSwitch from "./ThemeSwitch";
import { I18n, languages } from "@src/context/i18n";
import * as dialog from "@tauri-apps/api/dialog";
import { open } from "@tauri-apps/api/shell";
import { getVersion } from "@tauri-apps/api/app";
import { ReactComponent as GitHubSvg } from "@src/assets/icons/svg/github.svg"; // 关闭图标
import { ThemeStateContext } from "@src/context/theming";

export default function UIControl() {
const [i18n, setI18n] = useContext(I18n);
const [theme] = useContext(ThemeStateContext);

function about() {
dialog.message(i18n.dialog.about.content, {
type: "info",
title: i18n.dialog.about.title,
});
async function about() {
const appVersion = await getVersion();

dialog.message(
`${i18n.dialog.about.version}${appVersion} \r\n` +
i18n.dialog.about.content,
{
type: "info",
title: i18n.dialog.about.title,
}
);
}

function onSelect(e: React.FormEvent<HTMLSelectElement>) {
Expand Down Expand Up @@ -45,7 +52,6 @@ export default function UIControl() {
<GitHubSvg></GitHubSvg>
</div>
<div className={classNames(styles.language, "fs-10 flex-center")}>
<span className="mar-r-5">language</span>
<select
name="select"
onInput={onSelect}
Expand Down
3 changes: 3 additions & 0 deletions src/context/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export interface I18N_TYPE {
about: {
title: string;
content: string;
version: string;
};
};
/**
Expand Down Expand Up @@ -179,6 +180,7 @@ export const zhCN: I18N_TYPE = {
title: "关于",
content:
"这是一个PNG图片压缩工具,选择所要压缩的图片时,软件将PNG图像的RGBA模式转为调色板模式,从而减小图像大小。\r\n如有别的问题请联系:huangdonghao1997@gmail.com",
version: "版本:",
},
},
error: {
Expand Down Expand Up @@ -229,6 +231,7 @@ export const en: I18N_TYPE = {
title: "About",
content:
"This is a PNG image compression tool. When selecting the image to be compressed,\r\nthe software converts the PNG image's RGBA mode to a palette mode, thereby reducing the image size. \r\nIf you have any other questions, please contact: huangdonghao1997@gmail.com",
version: "Version: ",
},
},
error: {
Expand Down

0 comments on commit 14f57f6

Please sign in to comment.