import { DeleteRegular, DesktopRegular, EditRegular, GlobeRegular, PauseRegular, PlayRegular } from "@fluentui/react-icons"; import type { UpstreamProxy } from "../../types"; import { Button, Tag } from "../ui"; import type { LoadError, UpstreamRow } from "./shared"; import { useI18n } from "../../lib/i18n"; export interface UpstreamSectionProps { rows: UpstreamRow[]; loading: boolean; error: LoadError | null; onRetry: () => void; onEdit: (proxy: UpstreamProxy) => void; onDelete: (proxy: UpstreamProxy) => void; onOpenBindings: (proxy: UpstreamProxy) => void; onToggle: (proxy: UpstreamProxy) => void; toggleBusyId?: string; } export function UpstreamSection({ rows, loading, error, onRetry, onEdit, onDelete, onOpenBindings, onToggle, toggleBusyId }: UpstreamSectionProps) { const { t } = useI18n(); return (
{error ? (
{t("加载上游代理失败")}:{error.message} {error.status ? `(${error.status})` : ""}
) : null}
{rows.map((row) => ( ))}
{t("名称")} {t("地址")} {t("状态")} {t("SIM / Profile 绑定")} {t("国家规则")} {t("操作")}
{row.name || row.id} {row.addr} {row.enabled ? t("已启用") : t("已禁用")} {row.bindingCount} {row.countryNames.length ? (
{row.countryNames.map((countryName) => {countryName})}
) : }
{!loading && !rows.length ? (
{t("暂无上游代理")}
{t("点击“新增代理”创建 SOCKS5 上游代理,再配置国家规则或 ICCID 绑定;未匹配的卡默认直连。")}
) : null} {loading ?
{t("加载中...")}
: null}
); }