diff --git a/src/components/providers/ProviderActions.tsx b/src/components/providers/ProviderActions.tsx index 30dfe3d90..4e9911450 100644 --- a/src/components/providers/ProviderActions.tsx +++ b/src/components/providers/ProviderActions.tsx @@ -7,7 +7,6 @@ import { Minus, Play, Plus, - ShieldAlert, Terminal, TestTube2, Trash2, @@ -45,6 +44,18 @@ interface ProviderActionsProps { onSetAsDefault?: () => void; } +// 主按钮的呈现状态。title 用于 disabled 态向用户解释为何不可点击; +// 因 Button 基类带 disabled:pointer-events-none,title 必须挂在外层非禁用 +// 的 wrapper 上才会在 hover 时显示(见下方 包裹)。 +interface MainButtonState { + disabled: boolean; + variant: "default" | "secondary"; + className: string; + icon: JSX.Element; + text: string; + title?: string; +} + export function ProviderActions({ appId, isCurrent, @@ -108,7 +119,7 @@ export function ProviderActions({ } }; - const getMainButtonState = () => { + const getMainButtonState = (): MainButtonState => { if (isOmo) { if (isCurrent) { return { @@ -174,16 +185,6 @@ export function ProviderActions({ }; } - if (isOfficialBlockedByProxy) { - return { - disabled: true, - variant: "secondary" as const, - className: "opacity-40 cursor-not-allowed", - icon: , - text: t("provider.blockedByProxy", { defaultValue: "已拦截" }), - }; - } - if (isCurrent) { return { disabled: true, @@ -195,6 +196,17 @@ export function ProviderActions({ }; } + if (isOfficialBlockedByProxy) { + return { + disabled: true, + variant: "default" as const, + className: "", + icon: , + text: t("provider.enable"), + title: t("provider.blockedByProxyHint"), + }; + } + return { disabled: false, variant: "default" as const, @@ -247,16 +259,26 @@ export function ProviderActions({ ); })()} - + +