Skip to content

Commit

Permalink
feat: add download button on updater dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
MystiPanda committed Jun 8, 2024
1 parent 3e8b891 commit bc5eaf3
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/components/setting/mods/update-viewer.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import useSWR from "swr";
import { forwardRef, useImperativeHandle, useState, useMemo } from "react";
import { useLockFn } from "ahooks";
import { Box, LinearProgress } from "@mui/material";
import { Box, LinearProgress, Button } from "@mui/material";
import { useTranslation } from "react-i18next";
import { relaunch } from "@tauri-apps/api/process";
import { checkUpdate, installUpdate } from "@tauri-apps/api/updater";
import { BaseDialog, DialogRef, Notice } from "@/components/base";
import { useUpdateState, useSetUpdateState } from "@/services/states";
import { listen, Event, UnlistenFn } from "@tauri-apps/api/event";
import { portableFlag } from "@/pages/_layout";
import { open as openUrl } from "@tauri-apps/api/shell";
import ReactMarkdown from "react-markdown";

let eventListener: UnlistenFn | null = null;
Expand Down Expand Up @@ -76,7 +77,24 @@ export const UpdateViewer = forwardRef<DialogRef>((props, ref) => {
return (
<BaseDialog
open={open}
title={`New Version v${updateInfo?.manifest?.version}`}
title={
<Box display="flex" justifyContent="space-between">
{`New Version v${updateInfo?.manifest?.version}`}
<Box>
<Button
variant="contained"
size="small"
onClick={() => {
openUrl(
`https://github.com/clash-verge-rev/clash-verge-rev/releases/tag/v${updateInfo?.manifest?.version}`
);
}}
>
{t("Go to Release Page")}
</Button>
</Box>
</Box>
}
contentSx={{ minWidth: 360, maxWidth: 400, height: "50vh" }}
okBtn={t("Update")}
cancelBtn={t("Cancel")}
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
"Runtime Config": "Runtime Config",
"ReadOnly": "ReadOnly",
"ReadOnlyMessage": "Cannot edit in read-only editor",
"Go to Release Page": "Go to Release Page",
"Restart": "Restart",
"Upgrade": "Upgrade",

Expand Down
1 change: 1 addition & 0 deletions src/locales/fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@
"Runtime Config": "پیکربندی زمان اجرا",
"ReadOnly": "فقط خواندنی",
"ReadOnlyMessage": "نمی‌توان در ویرایشگر فقط خواندنی ویرایش کرد",
"Go to Release Page": "رفتن به صفحه انتشار",
"Restart": "راه‌اندازی مجدد",
"Upgrade": "ارتقاء",

Expand Down
1 change: 1 addition & 0 deletions src/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@
"Runtime Config": "Используемый конфиг",
"ReadOnly": "Только для чтения",
"ReadOnlyMessage": "Невозможно редактировать в режиме только для чтения",
"Go to Release Page": "Перейти на страницу релизов",
"Restart": "Перезапуск",
"Upgrade": "Обновлять",

Expand Down
1 change: 1 addition & 0 deletions src/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
"Runtime Config": "当前配置",
"ReadOnly": "只读",
"ReadOnlyMessage": "无法在只读模式下编辑",
"Go to Release Page": "前往发布页",
"Restart": "重启内核",
"Upgrade": "升级内核",

Expand Down

0 comments on commit bc5eaf3

Please sign in to comment.