From a677984edb0f29fec534dcd17a2550e284eb4ec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E4=B8=80=E4=B9=8B?= Date: Sun, 22 Mar 2026 02:24:43 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E2=9C=A8=20=E8=84=9A=E6=9C=AC=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=9C=80=E5=90=8E=E6=9B=B4=E6=96=B0=E5=88=97=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=A3=80=E6=9F=A5=E6=9B=B4=E6=96=B0=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes #1143 --- .../options/routes/ScriptList/components.tsx | 109 +++++++++++------- 1 file changed, 68 insertions(+), 41 deletions(-) diff --git a/src/pages/options/routes/ScriptList/components.tsx b/src/pages/options/routes/ScriptList/components.tsx index 10884e987..14639cd84 100644 --- a/src/pages/options/routes/ScriptList/components.tsx +++ b/src/pages/options/routes/ScriptList/components.tsx @@ -7,7 +7,7 @@ import { TbWorldWww } from "react-icons/tb"; import { semTime } from "@App/pkg/utils/dayjs"; import { useTranslation } from "react-i18next"; import { ListHomeRender } from "../utils"; -import { IconEdit, IconLink, IconUserAdd } from "@arco-design/web-react/icon"; +import { IconEdit, IconLink, IconSync, IconUserAdd } from "@arco-design/web-react/icon"; import type { SearchType } from "@App/app/service/service_worker/types"; import type { TFunction } from "i18next"; import type { SearchFilterKeyEntry, SearchFilterRequest } from "./SearchFilter"; @@ -133,52 +133,79 @@ HomeCell.displayName = "HomeCell"; export const UpdateTimeCell = React.memo(({ className, script }: { className?: string; script: ScriptLoading }) => { const { t } = useTranslation(); - const { handleClick } = { - handleClick: () => { - if (!script.checkUpdateUrl) { - Message.warning(t("update_not_supported")!); - return; - } - Message.info({ - id: "checkupdate", - content: t("checking_for_updates"), - }); - scriptClient - .requestCheckUpdate(script.uuid) - .then((res) => { - if (res) { - Message.warning({ - id: "checkupdate", - content: t("new_version_available"), - }); - } else { - Message.success({ - id: "checkupdate", - content: t("latest_version"), - }); - } - }) - .catch((e) => { - Message.error({ + const [checking, setChecking] = React.useState(false); + const handleClick = () => { + if (!script.checkUpdateUrl) { + Message.warning(t("update_not_supported")!); + return; + } + Message.info({ + id: "checkupdate", + content: t("checking_for_updates"), + }); + setChecking(true); + scriptClient + .requestCheckUpdate(script.uuid) + .then((res) => { + if (res) { + Message.warning({ id: "checkupdate", - content: `${t("update_check_failed")}: ${e.message}`, + content: t("new_version_available"), }); + } else { + Message.success({ + id: "checkupdate", + content: t("latest_version"), + }); + } + }) + .catch((e) => { + Message.error({ + id: "checkupdate", + content: `${t("update_check_failed")}: ${e.message}`, }); - }, + }) + .finally(() => { + setChecking(false); + }); }; return ( - - - {script.updatetime && semTime(new Date(script.updatetime))} - - + + + + {script.updatetime && semTime(new Date(script.updatetime))} + + + {script.checkUpdateUrl && ( + + { + e.currentTarget.style.opacity = "1"; + }} + onMouseLeave={(e) => { + if (!checking) { + e.currentTarget.style.opacity = "0.45"; + } + }} + /> + + )} + ); }); UpdateTimeCell.displayName = "UpdateTimeCell"; From 07ffd1019be667ce747df315e80ac3d0966f1a04 Mon Sep 17 00:00:00 2001 From: cyfung1031 <44498510+cyfung1031@users.noreply.github.com> Date: Sun, 22 Mar 2026 03:39:50 +0900 Subject: [PATCH 2/5] =?UTF-8?q?=E7=94=B1=20React=E9=87=8D=E7=BB=98=20?= =?UTF-8?q?=E6=94=B9=E6=88=90=20CSS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../options/routes/ScriptList/components.tsx | 15 +-------------- src/pages/options/routes/ScriptList/index.css | 13 +++++++++++++ src/pages/options/routes/ScriptList/index.tsx | 1 + 3 files changed, 15 insertions(+), 14 deletions(-) create mode 100644 src/pages/options/routes/ScriptList/index.css diff --git a/src/pages/options/routes/ScriptList/components.tsx b/src/pages/options/routes/ScriptList/components.tsx index 14639cd84..a2a64555a 100644 --- a/src/pages/options/routes/ScriptList/components.tsx +++ b/src/pages/options/routes/ScriptList/components.tsx @@ -186,22 +186,9 @@ export const UpdateTimeCell = React.memo(({ className, script }: { className?: s {script.checkUpdateUrl && ( { - e.currentTarget.style.opacity = "1"; - }} - onMouseLeave={(e) => { - if (!checking) { - e.currentTarget.style.opacity = "0.45"; - } - }} /> )} diff --git a/src/pages/options/routes/ScriptList/index.css b/src/pages/options/routes/ScriptList/index.css new file mode 100644 index 000000000..73992e4c0 --- /dev/null +++ b/src/pages/options/routes/ScriptList/index.css @@ -0,0 +1,13 @@ +.update-icon-sync { + cursor: pointer; + opacity: 0.45; + transition: opacity 0.2s; +} + +.update-icon-sync.arco-icon-loading { + opacity: 1; +} + +.update-icon-sync:hover { + opacity: 1; +} diff --git a/src/pages/options/routes/ScriptList/index.tsx b/src/pages/options/routes/ScriptList/index.tsx index da178ee8a..320b6f1c1 100644 --- a/src/pages/options/routes/ScriptList/index.tsx +++ b/src/pages/options/routes/ScriptList/index.tsx @@ -1,3 +1,4 @@ +import "./index.css"; import { useCallback, useEffect, useState, memo } from "react"; import { Card, Message } from "@arco-design/web-react"; import { useSearchParams } from "react-router-dom"; From 55f832648916cd6b568af6fecdb2dbf01b50a60d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E4=B8=80=E4=B9=8B?= Date: Sun, 22 Mar 2026 03:05:24 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20=E4=BD=BF=E7=94=A8=20T?= =?UTF-8?q?ailwindCSS=20=E6=9B=BF=E4=BB=A3=20inline=20style=20=E5=92=8C=20?= =?UTF-8?q?React=20state=20=E5=A4=84=E7=90=86=E8=A7=86=E8=A7=89=E6=95=88?= =?UTF-8?q?=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/options/routes/ScriptList/components.tsx | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/pages/options/routes/ScriptList/components.tsx b/src/pages/options/routes/ScriptList/components.tsx index a2a64555a..a6cb7c4b8 100644 --- a/src/pages/options/routes/ScriptList/components.tsx +++ b/src/pages/options/routes/ScriptList/components.tsx @@ -173,20 +173,14 @@ export const UpdateTimeCell = React.memo(({ className, script }: { className?: s return ( - + {script.updatetime && semTime(new Date(script.updatetime))} {script.checkUpdateUrl && ( From 2c71f93f5efe27f1b7dba3ae47a4b2ec5e89c33e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E4=B8=80=E4=B9=8B?= Date: Sun, 22 Mar 2026 03:07:30 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=F0=9F=94=A5=20=E5=88=A0=E9=99=A4=20linter?= =?UTF-8?q?=20=E8=87=AA=E5=8A=A8=E7=94=9F=E6=88=90=E7=9A=84=20CSS=20?= =?UTF-8?q?=E6=96=87=E4=BB=B6=EF=BC=8C=E5=B7=B2=E7=94=A8=20TailwindCSS=20?= =?UTF-8?q?=E6=9B=BF=E4=BB=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/options/routes/ScriptList/index.css | 13 ------------- src/pages/options/routes/ScriptList/index.tsx | 1 - 2 files changed, 14 deletions(-) delete mode 100644 src/pages/options/routes/ScriptList/index.css diff --git a/src/pages/options/routes/ScriptList/index.css b/src/pages/options/routes/ScriptList/index.css deleted file mode 100644 index 73992e4c0..000000000 --- a/src/pages/options/routes/ScriptList/index.css +++ /dev/null @@ -1,13 +0,0 @@ -.update-icon-sync { - cursor: pointer; - opacity: 0.45; - transition: opacity 0.2s; -} - -.update-icon-sync.arco-icon-loading { - opacity: 1; -} - -.update-icon-sync:hover { - opacity: 1; -} diff --git a/src/pages/options/routes/ScriptList/index.tsx b/src/pages/options/routes/ScriptList/index.tsx index 320b6f1c1..da178ee8a 100644 --- a/src/pages/options/routes/ScriptList/index.tsx +++ b/src/pages/options/routes/ScriptList/index.tsx @@ -1,4 +1,3 @@ -import "./index.css"; import { useCallback, useEffect, useState, memo } from "react"; import { Card, Message } from "@arco-design/web-react"; import { useSearchParams } from "react-router-dom"; From fb93545dfe919b888827dc48550e7599dea00a49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E4=B8=80=E4=B9=8B?= Date: Sun, 22 Mar 2026 03:33:54 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=F0=9F=90=9B=20=E9=98=B2=E6=AD=A2=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E6=9B=B4=E6=96=B0=E6=97=B6=E9=87=8D=E5=A4=8D=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E8=A7=A6=E5=8F=91=E5=B9=B6=E5=8F=91=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/options/routes/ScriptList/components.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/options/routes/ScriptList/components.tsx b/src/pages/options/routes/ScriptList/components.tsx index a6cb7c4b8..476630fc8 100644 --- a/src/pages/options/routes/ScriptList/components.tsx +++ b/src/pages/options/routes/ScriptList/components.tsx @@ -135,6 +135,7 @@ export const UpdateTimeCell = React.memo(({ className, script }: { className?: s const { t } = useTranslation(); const [checking, setChecking] = React.useState(false); const handleClick = () => { + if (checking) return; if (!script.checkUpdateUrl) { Message.warning(t("update_not_supported")!); return;