import { useTranslation } from "react-i18next"; import { FormLabel } from "@/components/ui/form"; import { Input } from "@/components/ui/input"; import { Switch } from "@/components/ui/switch"; import { Link2, Zap } from "lucide-react"; interface EndpointFieldProps { id: string; label: string; value: string; onChange: (value: string) => void; placeholder: string; hint?: string; showManageButton?: boolean; onManageClick?: () => void; manageButtonLabel?: string; showFullUrlToggle?: boolean; isFullUrl?: boolean; onFullUrlChange?: (value: boolean) => void; } export function EndpointField({ id, label, value, onChange, placeholder, hint, showManageButton = true, onManageClick, manageButtonLabel, showFullUrlToggle = false, isFullUrl = false, onFullUrlChange, }: EndpointFieldProps) { const { t } = useTranslation(); const defaultManageLabel = t("providerForm.manageAndTest", { defaultValue: "管理和测速", }); const effectiveHint = showFullUrlToggle && isFullUrl ? t("providerForm.fullUrlHint", { defaultValue: "💡 请填写完整请求 URL,并且必须开启代理后使用;代理将直接使用此 URL,不拼接路径", }) : hint; return (
{effectiveHint}