feat: 订阅套餐展示优化、平台图标、默认月、用户订阅查询
- 新建共享平台样式模块 platform-style.ts,含各平台 SVG 图标 + 彩色 badge - SubscriptionPlanCard 重设计:平台图标 badge、倍率/限额 grid 展示、OpenAI messages 调度信息 - UserSubscriptions 显示 group_name + 平台 badge - ChannelCard 复用共享平台样式模块 - 管理后台:新建套餐默认 1 月、去掉模型展示、平台图标 badge、OpenAI 信息 - 管理后台用户订阅 tab 默认查询所有订阅(user_id 可选) - Sub2API client 新增 listSubscriptions 函数 - API 返回 allowMessagesDispatch / defaultMappedModel / group_name / platform
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import React from 'react';
|
||||
import type { Locale } from '@/lib/locale';
|
||||
import { pickLocaleText } from '@/lib/locale';
|
||||
import { PlatformBadge } from '@/lib/platform-style';
|
||||
|
||||
export interface ChannelInfo {
|
||||
id: string;
|
||||
@@ -23,39 +24,7 @@ interface ChannelCardProps {
|
||||
userBalance?: number;
|
||||
}
|
||||
|
||||
const PLATFORM_STYLES: Record<string, { badge: string; border: string }> = {
|
||||
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 (
|
||||
@@ -68,9 +37,7 @@ export default function ChannelCard({ channel, onTopUp, isDark, locale }: Channe
|
||||
{/* Header: Platform badge + Name */}
|
||||
<div className="mb-4">
|
||||
<div className="mb-3 flex items-center gap-2">
|
||||
<span className={['rounded-md border px-2 py-0.5 text-xs font-medium', platformStyle.badge].join(' ')}>
|
||||
{channel.platform}
|
||||
</span>
|
||||
<PlatformBadge platform={channel.platform} />
|
||||
<h3 className={['text-lg font-bold', isDark ? 'text-slate-100' : 'text-slate-900'].join(' ')}>
|
||||
{channel.name}
|
||||
</h3>
|
||||
|
||||
Reference in New Issue
Block a user