全站汉化 + antd zhCN locale
This commit is contained in:
1 parent
2e4594fa77
commit
b96323eb99
9 files changed
+134
-136
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import { Row, Col, Card, Statistic, Typography, Table, Tag, Space } from 'antd'
|
||||
import { VideoCameraOutlined, EyeOutlined, CloudServerOutlined, SignalFilled } from '@ant-design/icons'
|
||||
import { VideoCameraOutlined, EyeOutlined, SignalFilled } from '@ant-design/icons'
|
||||
import { fetchStreams, type StreamInfo } from '../../api/streams'
|
||||
|
||||
const { Title } = Typography
|
||||
@@ -25,35 +25,34 @@ export default function Dashboard() {
|
||||
|
||||
const liveCount = streams.filter((s) => s.status === 'live').length
|
||||
const pendingCount = streams.filter((s) => s.status === 'pending').length
|
||||
const endedCount = streams.filter((s) => s.status === 'ended').length
|
||||
|
||||
const statusMap: Record<string, { color: string; label: string }> = {
|
||||
pending: { color: 'blue', label: 'Pending' },
|
||||
live: { color: 'green', label: 'Live' },
|
||||
ended: { color: 'default', label: 'Ended' },
|
||||
cancelled: { color: 'red', label: 'Cancelled' },
|
||||
pending: { color: 'blue', label: '待开播' },
|
||||
live: { color: 'green', label: '直播中' },
|
||||
ended: { color: 'default', label: '已结束' },
|
||||
cancelled: { color: 'red', label: '已取消' },
|
||||
}
|
||||
|
||||
const recentColumns = [
|
||||
{ title: 'Title', dataIndex: 'title', key: 'title', ellipsis: true },
|
||||
{ title: '标题', dataIndex: 'title', key: 'title', ellipsis: true },
|
||||
{
|
||||
title: 'Status', dataIndex: 'status', key: 'status',
|
||||
title: '状态', dataIndex: 'status', key: 'status',
|
||||
render: (status: string) => {
|
||||
const s = statusMap[status] || { color: 'default', label: status }
|
||||
return <Tag color={s.color}>{s.label}</Tag>
|
||||
},
|
||||
},
|
||||
{ title: 'Created', dataIndex: 'created_at', key: 'created_at', render: (v: string) => v?.slice(0, 16) },
|
||||
{ title: '创建时间', dataIndex: 'created_at', key: 'created_at', render: (v: string) => v?.slice(0, 16) },
|
||||
]
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Title level={3} style={{ marginBottom: 24 }}>Dashboard</Title>
|
||||
<Title level={3} style={{ marginBottom: 24 }}>概览</Title>
|
||||
<Row gutter={[24, 24]}>
|
||||
<Col xs={24} sm={8}>
|
||||
<Card>
|
||||
<Statistic
|
||||
title="Live Streams"
|
||||
title="直播中"
|
||||
value={liveCount}
|
||||
prefix={<SignalFilled style={{ color: '#52c41a' }} />}
|
||||
loading={loading}
|
||||
@@ -63,7 +62,7 @@ export default function Dashboard() {
|
||||
<Col xs={24} sm={8}>
|
||||
<Card>
|
||||
<Statistic
|
||||
title="Pending"
|
||||
title="待开播"
|
||||
value={pendingCount}
|
||||
prefix={<VideoCameraOutlined style={{ color: '#1677ff' }} />}
|
||||
loading={loading}
|
||||
@@ -73,7 +72,7 @@ export default function Dashboard() {
|
||||
<Col xs={24} sm={8}>
|
||||
<Card>
|
||||
<Statistic
|
||||
title="Total Streams"
|
||||
title="直播总数"
|
||||
value={streams.length}
|
||||
prefix={<EyeOutlined />}
|
||||
loading={loading}
|
||||
@@ -81,7 +80,7 @@ export default function Dashboard() {
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
<Card title="Recent Streams" style={{ marginTop: 24 }}>
|
||||
<Card title="最近直播" style={{ marginTop: 24 }}>
|
||||
<Table
|
||||
dataSource={streams.slice(0, 10)}
|
||||
columns={recentColumns}
|
||||
|
||||
Reference in new issue
Block a user