ModelsSection.tsx 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /**
  2. * 模型展示区 - 4 张模型卡片(USD 单价)+ 汇率提示
  3. */
  4. import Link from 'next/link';
  5. import { useLocale, useTranslations } from 'next-intl';
  6. import { FxPrice } from './FxPrice';
  7. type ModelCard = {
  8. id: string;
  9. nameKey: string;
  10. shortKey: string;
  11. tagKey: string;
  12. tagClass: string;
  13. usdIn: number;
  14. usdOut: number;
  15. };
  16. const tagStyles = {
  17. purple: 'text-brand-purple-l bg-[rgba(124,92,255,.12)] border-[rgba(124,92,255,.35)]',
  18. green: 'text-brand-green-l bg-[rgba(0,229,160,.1)] border-[rgba(0,229,160,.3)]',
  19. gold: 'text-brand-gold bg-[rgba(255,194,77,.1)] border-[rgba(255,194,77,.3)]',
  20. gray: 'text-brand-muted bg-[rgba(154,163,192,.1)] border-[rgba(154,163,192,.3)]',
  21. } as const;
  22. const models: ModelCard[] = [
  23. { id: 'glm-5.2', nameKey: 'glm_name', shortKey: 'glm_short', tagKey: 'tag_flagship', tagClass: tagStyles.purple, usdIn: 0.98, usdOut: 3.08 },
  24. { id: 'deepseek-v4', nameKey: 'dsv4_name', shortKey: 'dsv4_short', tagKey: 'tag_best', tagClass: tagStyles.green, usdIn: 0.14, usdOut: 0.28 },
  25. { id: 'deepseek-v4-pro', nameKey: 'dsv4p_name', shortKey: 'dsv4p_short', tagKey: 'tag_reasoning', tagClass: tagStyles.gold, usdIn: 0.3, usdOut: 0.6 },
  26. { id: 'qwen-max', nameKey: 'qwen_name', shortKey: 'qwen_short', tagKey: 'tag_enterprise', tagClass: tagStyles.gray, usdIn: 1.96, usdOut: 7.84 },
  27. ];
  28. export function ModelsSection() {
  29. const t = useTranslations('models');
  30. const locale = useLocale();
  31. return (
  32. <section className="mt-[60px] border-y border-white/[0.08] bg-brand-bg2 py-[30px] pb-14">
  33. <div className="mx-auto max-w-[1160px] px-6">
  34. <div className="mx-auto mb-9 max-w-[640px] text-center">
  35. <div className="mb-1.5 text-xs font-bold uppercase tracking-[2px] text-brand-purple-l">
  36. {t('kicker')}
  37. </div>
  38. <h2 className="mb-1.5 text-[22px] font-extrabold">{t('h2')}</h2>
  39. <p className="text-sm text-brand-muted">{t('p')}</p>
  40. <Link
  41. href={`/${locale}/pricing`}
  42. className="mt-3.5 inline-block text-sm font-semibold text-brand-purple-l"
  43. >
  44. {t('more')}
  45. </Link>
  46. </div>
  47. <div className="grid grid-cols-[repeat(auto-fit,minmax(240px,1fr))] gap-[18px]">
  48. {models.map((m) => (
  49. <Link
  50. key={m.id}
  51. href={`/${locale}/models`}
  52. className="rounded-2xl border border-white/[0.08] bg-brand-card p-6 transition-all duration-200 hover:-translate-y-[3px] hover:border-[rgba(124,92,255,.5)] hover:shadow-[0_10px_34px_rgba(11,16,32,.6)]"
  53. >
  54. <div className="flex items-center justify-between">
  55. <b className="text-base">{t(m.nameKey)}</b>
  56. <span className={`inline-block rounded-full border px-2.5 py-0.5 text-[11px] ${m.tagClass}`}>
  57. {t(m.tagKey)}
  58. </span>
  59. </div>
  60. <p className="mt-1.5 min-h-[34px] text-[12.5px] text-brand-muted">{t(m.shortKey)}</p>
  61. <div className="mt-3 text-xs text-brand-muted">
  62. {t('price_in')}{' '}
  63. <span className="font-semibold text-brand-text">
  64. <FxPrice usd={m.usdIn} showUsd />
  65. </span>
  66. </div>
  67. <div className="text-xs text-brand-muted">
  68. {t('price_out')}{' '}
  69. <span className="font-semibold text-brand-text">
  70. <FxPrice usd={m.usdOut} showUsd />
  71. </span>
  72. </div>
  73. <div className="mt-3 text-[13px] font-semibold text-brand-purple-l">
  74. {t('see_detail')}
  75. </div>
  76. </Link>
  77. ))}
  78. </div>
  79. <div className="mx-auto mt-5 flex max-w-[560px] items-center gap-3 rounded-xl border border-[rgba(255,194,77,.3)] bg-[rgba(255,194,77,.08)] px-[18px] py-[14px] text-[13.5px] text-brand-gold">
  80. {t('rate_note')}
  81. </div>
  82. </div>
  83. </section>
  84. );
  85. }