mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-10-15 07:20:26 +00:00
feat: i18n support
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
"i18next-browser-languagedetector": "^8.0.2",
|
"i18next-browser-languagedetector": "^8.0.2",
|
||||||
"i18next-http-backend": "^3.0.2",
|
"i18next-http-backend": "^3.0.2",
|
||||||
"marked": "^4.1.1",
|
"marked": "^4.1.1",
|
||||||
|
"moment": "^2.30.1",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-dropzone": "^14.2.3",
|
"react-dropzone": "^14.2.3",
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Card, Grid, Statistic } from 'semantic-ui-react';
|
import { Card, Grid, Header, Segment, Statistic } from 'semantic-ui-react';
|
||||||
|
import { API, showError } from '../../helpers';
|
||||||
|
import moment from 'moment';
|
||||||
import {
|
import {
|
||||||
LineChart,
|
LineChart,
|
||||||
Line,
|
Line,
|
||||||
@@ -116,8 +118,11 @@ const Dashboard = () => {
|
|||||||
|
|
||||||
// 获取日期范围
|
// 获取日期范围
|
||||||
const dates = data.map((item) => item.Day);
|
const dates = data.map((item) => item.Day);
|
||||||
const minDate = new Date(Math.min(...dates.map((d) => new Date(d))));
|
const minDate =
|
||||||
const maxDate = new Date(Math.max(...dates.map((d) => new Date(d))));
|
dates.length > 0
|
||||||
|
? new Date(Math.min(...dates.map((d) => new Date(d))))
|
||||||
|
: new Date();
|
||||||
|
const maxDate = new Date(); // 总是使用今天作为最后一天
|
||||||
|
|
||||||
// 生成所有日期
|
// 生成所有日期
|
||||||
for (let d = new Date(minDate); d <= maxDate; d.setDate(d.getDate() + 1)) {
|
for (let d = new Date(minDate); d <= maxDate; d.setDate(d.getDate() + 1)) {
|
||||||
@@ -148,8 +153,11 @@ const Dashboard = () => {
|
|||||||
|
|
||||||
// 获取日期范围
|
// 获取日期范围
|
||||||
const dates = data.map((item) => item.Day);
|
const dates = data.map((item) => item.Day);
|
||||||
const minDate = new Date(Math.min(...dates.map((d) => new Date(d))));
|
const minDate =
|
||||||
const maxDate = new Date(Math.max(...dates.map((d) => new Date(d))));
|
dates.length > 0
|
||||||
|
? new Date(Math.min(...dates.map((d) => new Date(d))))
|
||||||
|
: new Date();
|
||||||
|
const maxDate = new Date(); // 总是使用今天作为最后一天
|
||||||
|
|
||||||
// 生成所有日期
|
// 生成所有日期
|
||||||
for (let d = new Date(minDate); d <= maxDate; d.setDate(d.getDate() + 1)) {
|
for (let d = new Date(minDate); d <= maxDate; d.setDate(d.getDate() + 1)) {
|
||||||
|
@@ -68,11 +68,7 @@ const Home = () => {
|
|||||||
</Card.Header>
|
</Card.Header>
|
||||||
<Card.Description style={{ lineHeight: '1.6' }}>
|
<Card.Description style={{ lineHeight: '1.6' }}>
|
||||||
<p>{t('home.welcome.description')}</p>
|
<p>{t('home.welcome.description')}</p>
|
||||||
{!userState.user && (
|
{!userState.user && <p>{t('home.welcome.login_notice')}</p>}
|
||||||
<p>
|
|
||||||
{t('home.welcome.login_notice')}
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
</Card.Description>
|
</Card.Description>
|
||||||
</Card.Content>
|
</Card.Content>
|
||||||
</Card>
|
</Card>
|
||||||
|
Reference in New Issue
Block a user