"use client"; import { useApp } from "@/contexts/AppContext"; import { ProductDetail } from "@/lib/api/fundmarket"; interface ProtocolLinkProps { label: string; url?: string; } function ProtocolLink({ label, url }: ProtocolLinkProps) { const enabled = !!url; return (
enabled && window.open(url, '_blank', 'noopener,noreferrer')} className={`group rounded-xl border border-border-gray dark:border-gray-600 bg-bg-subtle dark:bg-gray-700 px-4 py-3.5 flex items-center justify-between w-full transition-all ${ enabled ? 'cursor-pointer hover:border-black dark:hover:border-gray-400' : 'cursor-default opacity-40' }`} >
{label}
); } const DEFAULT_LINKS = [ "Smart Contract", "Compliance", "Proof of Reserves", "Protocol Information", ]; interface ProtocolInformationProps { product: ProductDetail; } export default function ProtocolInformation({ product }: ProtocolInformationProps) { const { t } = useApp(); const links = product.productLinks ?? []; // 只显示 display_area 为 protocol 或 both 的链接 const protocolLinks = links.filter( (l) => l.displayArea === 'protocol' || l.displayArea === 'both' ); // 有配置时用配置的,没配置时用默认占位(全部禁用) const items = protocolLinks.length > 0 ? protocolLinks.map((l) => ({ label: l.linkText, url: l.linkUrl })) : DEFAULT_LINKS.map((label) => ({ label, url: undefined })); return (

{t("protocol.title")}

{items.map((item, index) => ( ))}
); }