fix: the content displayed on the homepage is incorrect

This commit is contained in:
QuentinHsu 2024-03-02 14:56:32 +08:00
parent a8f0c5dab2
commit ac64fd26ad
No known key found for this signature in database
GPG Key ID: 20D465A435D740D0

View File

@ -1,5 +1,5 @@
import React, { useContext, useEffect, useState } from 'react'; import React, { useContext, useEffect, useState } from 'react';
import { Card, Grid, Header, Segment } from 'semantic-ui-react'; import { Card, Col, Row } from '@douyinfe/semi-ui';
import { API, showError, showNotice, timestamp2string } from '../../helpers'; import { API, showError, showNotice, timestamp2string } from '../../helpers';
import { StatusContext } from '../../context/Status'; import { StatusContext } from '../../context/Status';
import { marked } from 'marked'; import { marked } from 'marked';
@ -44,7 +44,7 @@ const Home = () => {
const getStartTimeString = () => { const getStartTimeString = () => {
const timestamp = statusState?.status?.start_time; const timestamp = statusState?.status?.start_time;
return timestamp2string(timestamp); return statusState.status ? timestamp2string(timestamp) : '';
}; };
useEffect(() => { useEffect(() => {
@ -55,67 +55,63 @@ const Home = () => {
<> <>
{ {
homePageContentLoaded && homePageContent === '' ? <> homePageContentLoaded && homePageContent === '' ? <>
<Segment> <Card
<Header as='h3'>系统状况</Header> bordered={false}
<Grid columns={2} stackable> headerLine={false}
<Grid.Column> title='系统状况'
<Card fluid> bodyStyle={{padding: '10px 20px'}}
<Card.Content> >
<Card.Header>系统信息</Card.Header> <Row gutter={16}>
<Card.Meta>系统信息总览</Card.Meta> <Col span={12}>
<Card.Description> <Card
<p>名称{statusState?.status?.system_name}</p> title='系统信息'
<p>版本{statusState?.status?.version ? statusState?.status?.version : "unknown"}</p> headerExtraContent={<span style={{ fontSize:'12px', color: 'var(--semi-color-text-1)'}}>系统信息总览</span>}>
<p> <p>名称{statusState?.system_name}</p>
源码 <p>版本{statusState?.version ? statusState?.version : "unknown"}</p>
<a <p>
href='https://github.com/songquanpeng/one-api' 源码
target='_blank' <a
> href='https://github.com/songquanpeng/one-api'
https://github.com/songquanpeng/one-api target='_blank' rel="noreferrer"
</a> >
</p> https://github.com/songquanpeng/one-api
<p>启动时间{getStartTimeString()}</p> </a>
</Card.Description> </p>
</Card.Content> <p>启动时间{getStartTimeString()}</p>
</Card> </Card>
</Grid.Column> </Col>
<Grid.Column> <Col span={12}>
<Card fluid> <Card
<Card.Content> title='系统配置'
<Card.Header>系统配置</Card.Header> headerExtraContent={<span style={{ fontSize:'12px', color: 'var(--semi-color-text-1)'}}>系统配置总览</span>}>
<Card.Meta>系统配置总览</Card.Meta> <p>
<Card.Description> 邮箱验证
<p> {statusState?.email_verification === true
邮箱验证 ? '已启用'
{statusState?.status?.email_verification === true : '未启用'}
? '已启用' </p>
: '未启用'} <p>
</p> GitHub 身份验证
<p> {statusState?.github_oauth === true
GitHub 身份验证 ? '已启用'
{statusState?.status?.github_oauth === true : '未启用'}
? '已启用' </p>
: '未启用'} <p>
</p> 微信身份验证
<p> {statusState?.wechat_login === true
微信身份验证 ? '已启用'
{statusState?.status?.wechat_login === true : '未启用'}
? '已启用' </p>
: '未启用'} <p>
</p> Turnstile 用户校验
<p> {statusState?.turnstile_check === true
Turnstile 用户校验 ? '已启用'
{statusState?.status?.turnstile_check === true : '未启用'}
? '已启用' </p>
: '未启用'}
</p>
</Card.Description>
</Card.Content>
</Card> </Card>
</Grid.Column> </Col>
</Grid> </Row>
</Segment> </Card>
</> : <> </> : <>
{ {
homePageContent.startsWith('https://') ? <iframe homePageContent.startsWith('https://') ? <iframe