import React from "react"; import {Card, Col, Row, theme, Radio, Table, Tag, Space, List, Avatar} from "antd"; import ReactECharts from "echarts-for-react"; import {ArrowDownOutlined, ArrowUpOutlined, LikeOutlined, TeamOutlined} from "@ant-design/icons"; import { useTranslation } from 'react-i18next'; const {useToken} = theme; interface DataType { key: string; name: string; age: number; address: string; tags: string[]; } const Index: React.FC = () => { const {token} = useToken(); const { t } = useTranslation(); const optionsBar = { xAxis: { type: 'category', show: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'] }, yAxis: { show: false, type: 'value' }, series: [ { data: [120, 88, 116, 60, 70], type: 'bar', itemStyle: { color: token.colorPrimary }, barWidth: 10, } ] } const optionsLine = { xAxis: { show: false, type: 'category', data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] }, yAxis: { show: false, type: 'value' }, series: [ { data: [1, 2, 3, 2, 3, 2, 1], type: 'line', itemStyle: { color: token.colorPrimary } } ] }; const options = { title: { text: t('dashboard.analysis.annualSales'), textStyle: { color: token.colorText, fontSize: token.fontSizeLG, fontWeight: token.fontWeightStrong }, }, tooltip: { trigger: 'axis', axisPointer: { type: 'cross', label: { backgroundColor: token.colorPrimaryBg, color: token.colorPrimary } }, borderWidth: 0, backgroundColor: token.colorPrimaryBg, textStyle: { color: token.colorText } }, legend: { data: [t('dashboard.analysis.grossProfit'), t('dashboard.analysis.netProfit'), t('dashboard.analysis.totalExpense')], textStyle: { color: token.colorText } }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, xAxis: [ { type: 'category', boundaryGap: false, data: [ t('dashboard.analysis.january'), t('dashboard.analysis.february'), t('dashboard.analysis.march'), t('dashboard.analysis.april'), t('dashboard.analysis.may'), t('dashboard.analysis.june'), t('dashboard.analysis.july'), t('dashboard.analysis.august'), t('dashboard.analysis.september'), t('dashboard.analysis.october'), t('dashboard.analysis.november'), t('dashboard.analysis.december') ] } ], yAxis: [ { type: 'value', splitLine: { lineStyle: { // 使用深浅的间隔色 color: token.colorBorder } } }, ], series: [ { name: t('dashboard.analysis.grossProfit'), type: 'line', stack: 'Total', areaStyle: { color: token.colorPrimaryBorder }, emphasis: { focus: 'series' }, itemStyle: { color: token.colorPrimary }, data: [30,36,42,33,21,26,29,35,42,32,28,26] }, { name: t('dashboard.analysis.netProfit'), type: 'line', stack: 'Total', areaStyle: { color: token.colorSuccessBorder }, emphasis: { focus: 'series' }, itemStyle: { color: token.colorSuccess }, data: [32,16,18,30,15,19,22,17,24,19,30,31] }, { name: t('dashboard.analysis.totalExpense'), type: 'line', stack: 'Total', areaStyle: { color: token.colorWarningBorder }, emphasis: { focus: 'series' }, itemStyle: { color: token.colorWarning }, data: [36,24,36,36,39,56,24,23,21,12,16,19] } ] } const optionsPie = { title: { text: t('dashboard.analysis.accessFrom'), textStyle: { color: token.colorText, fontSize: token.fontSizeLG, fontWeight: token.fontWeightStrong }, }, tooltip: { trigger: 'item' }, legend: { bottom: '0%', left: 'center', textStyle: { color: token.colorText } }, series: [ { name: t('dashboard.analysis.accessFrom'), type: 'pie', radius: ['40%', '70%'], avoidLabelOverlap: false, itemStyle: { borderRadius: token.borderRadius, borderColor: token.colorBorder, borderWidth: 2 }, label: { show: false, position: 'center' }, emphasis: { label: { show: true, fontSize: 40, fontWeight: 'bold' } }, labelLine: { show: false }, data: [ { value: 1048, name: t('dashboard.analysis.searchEngine') }, { value: 735, name: t('dashboard.analysis.direct') }, { value: 580, name: t('dashboard.analysis.email') }, { value: 484, name: t('dashboard.analysis.unionAds') }, { value: 300, name: t('dashboard.analysis.videoAds') } ] } ] }; const data: DataType[] = [ { key: '1', name: 'John Brown', age: 32, address: 'New York No. 1 Lake Park', tags: ['nice', 'developer'], }, { key: '2', name: 'Jim Green', age: 42, address: 'London No. 1 Lake Park', tags: ['loser'], }, { key: '3', name: 'Joe Black', age: 32, address: 'Sydney No. 1 Lake Park', tags: ['cool', 'teacher'], }, { key: '4', name: 'Jim Green', age: 42, address: 'London No. 1 Lake Park', tags: ['loser'], }, { key: '5', name: 'Joe Black', age: 32, address: 'Sydney No. 1 Lake Park', tags: ['cool', 'teacher'], }, ]; const msgData = [ { title: 'Ant Design Title 1', }, { title: 'Ant Design Title 2', }, { title: 'Ant Design Title 3', }, { title: 'Ant Design Title 4', }, { title: 'Ant Design Title 5', }, ]; return ( <>
{t('dashboard.analysis.totalRevenue')}
¥3,415.00
{t('dashboard.since.lastWeek')} 11.28%
{t('dashboard.analysis.totalExpenses')}
¥8,425.00
{t('dashboard.since.lastWeek')} 15.33%
{t('dashboard.analysis.visitors')}
1,128
{t('dashboard.since.lastWeek')} 32.60%
{t('dashboard.analysis.likes')}
668
{t('dashboard.since.lastWeek')} 9.60%
{t('dashboard.analysis.salesRanking')}
{text}, }, { title: t('dashboard.analysis.age'), dataIndex: 'age', key: 'age', }, { title: t('dashboard.analysis.address'), dataIndex: 'address', key: 'address', }, { title: t('dashboard.analysis.tags'), key: 'tags', dataIndex: 'tags', render: (_, { tags }) => ( <> {tags.map((tag) => { let color = tag.length > 5 ? 'geekblue' : 'green'; if (tag === 'loser') { color = 'volcano'; } return ( {tag.toUpperCase()} ); })} ), }, { title: t('dashboard.analysis.action'), key: 'action', render: (_, record) => ( {t('dashboard.analysis.invite')} {record.name} {t('dashboard.analysis.delete')} ), }, ]} dataSource={data} pagination={false} scroll={{x: 800}} />
{t('dashboard.analysis.userReviews')}
( } title={{item.title}} description={t('dashboard.analysis.reviewDescription')} /> )} />
) } export default Index