import { Card, Timeline, Typography, Tag, Empty } from 'antd' import { HistoryOutlined } from '@ant-design/icons' import { formatTimestamp, quotaToUsd } from '@/utils/quota' const { Text } = Typography interface LogItem { id: number created_at: number model_name: string token_name: string quota: number type: number } interface Props { logs: LogItem[] loading: boolean } const logTypeMap: Record = { 1: { color: '#7DB87D', label: '充值' }, 2: { color: '#C8956C', label: '消费' }, 3: { color: '#E8A850', label: '管理' }, 4: { color: '#9B8EC2', label: '系统' }, 5: { color: '#D4645C', label: '错误' }, 6: { color: '#7BA4C8', label: '退款' }, } export default function RecentLogs({ logs, loading }: Props) { if (!loading && logs.length === 0) { return ( 最近操作日志} className="stat-accent"> ) } return ( 最近操作日志} loading={loading} hoverable className="stat-accent" > { const typeInfo = logTypeMap[log.type] || { color: '#A69278', label: '未知' } return { color: typeInfo.color, children: (
{typeInfo.label} {log.model_name || '-'} {log.quota > 0 && ( ${quotaToUsd(log.quota)} )}
{formatTimestamp(log.created_at)} {log.token_name && ` · ${log.token_name}`}
), } })} />
) }