'use client'; import React from 'react'; import type { Locale } from '@/lib/locale'; import { pickLocaleText } from '@/lib/locale'; export interface ChannelInfo { id: string; groupId: number; name: string; platform: string; rateMultiplier: number; description: string | null; models: string[]; features: string[]; } interface ChannelCardProps { channel: ChannelInfo; onTopUp: () => void; isDark: boolean; locale: Locale; userBalance?: number; } const PLATFORM_STYLES: Record = { claude: { badge: 'bg-orange-500/10 text-orange-600 dark:text-orange-400 border-orange-500/30', border: 'border-orange-500/20', }, openai: { badge: 'bg-green-500/10 text-green-600 dark:text-green-400 border-green-500/30', border: 'border-green-500/20', }, gemini: { badge: 'bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/30', border: 'border-blue-500/20', }, codex: { badge: 'bg-green-500/10 text-green-600 dark:text-green-400 border-green-500/30', border: 'border-green-500/20', }, sora: { badge: 'bg-pink-500/10 text-pink-600 dark:text-pink-400 border-pink-500/30', border: 'border-pink-500/20', }, }; function getPlatformStyle(platform: string) { const key = platform.toLowerCase(); return PLATFORM_STYLES[key] ?? { badge: 'bg-slate-500/10 text-slate-600 dark:text-slate-400 border-slate-500/30', border: 'border-slate-500/20', }; } export default function ChannelCard({ channel, onTopUp, isDark, locale }: ChannelCardProps) { const platformStyle = getPlatformStyle(channel.platform); const usableQuota = (1 / channel.rateMultiplier).toFixed(2); return (
{/* Header: Platform badge + Name */}
{channel.platform}

{channel.name}

{/* Rate display - prominent */}
{pickLocaleText(locale, '当前倍率', 'Rate')}
1 : {channel.rateMultiplier}

{pickLocaleText( locale, <>1元可用约{usableQuota}美元额度, <>1 CNY ≈ {usableQuota} USD quota, )}

{/* Description */} {channel.description && (

{channel.description}

)}
{/* Models */} {channel.models.length > 0 && (

{pickLocaleText(locale, '支持模型', 'Supported Models')}

{channel.models.map((model) => ( {model} ))}
)} {/* Features */} {channel.features.length > 0 && (

{pickLocaleText(locale, '功能特性', 'Features')}

{channel.features.map((feature) => ( {feature} ))}
)} {/* Spacer to push button to bottom */}
{/* Top-up button */}
); }