chore: bug fix for home page

This commit is contained in:
JustSong
2025-02-01 01:08:28 +08:00
parent 5997fce454
commit 0a6273fc08

View File

@@ -56,218 +56,222 @@ const Home = () => {
}, []); }, []);
return ( return (
<div className='dashboard-container'> <>
<Card fluid className='chart-card'>
<Card.Content>
<Card.Header className='header'>欢迎使用 One API</Card.Header>
<Card.Description style={{ lineHeight: '1.6' }}>
<p>
One API 是一个 LLM API
接口管理和分发系统可以帮助您更好地管理和使用各大厂商的 LLM API
</p>
{!userState.user && (
<p>
如需使用请先<Link to='/login'>登录</Link>
<Link to='/register'>注册</Link>
</p>
)}
</Card.Description>
</Card.Content>
</Card>
{homePageContentLoaded && homePageContent === '' ? ( {homePageContentLoaded && homePageContent === '' ? (
<Card fluid className='chart-card'> <div className='dashboard-container'>
<Card.Content> <Card fluid className='chart-card'>
<Card.Header> <Card.Content>
<Header as='h3'>系统状况</Header> <Card.Header className='header'>欢迎使用 One API</Card.Header>
</Card.Header> <Card.Description style={{ lineHeight: '1.6' }}>
<Grid columns={2} stackable> <p>
<Grid.Column> One API 是一个 LLM API
<Card 接口管理和分发系统可以帮助您更好地管理和使用各大厂商的 LLM
fluid API
className='chart-card' </p>
style={{ boxShadow: '0 1px 3px rgba(0,0,0,0.12)' }} {!userState.user && (
> <p>
<Card.Content> 如需使用请先<Link to='/login'>登录</Link>
<Card.Header> <Link to='/register'>注册</Link>
<Header as='h3' style={{ color: '#444' }}> </p>
系统信息 )}
</Header> </Card.Description>
</Card.Header> </Card.Content>
<Card.Description </Card>
style={{ lineHeight: '2', marginTop: '1em' }} <Card fluid className='chart-card'>
> <Card.Content>
<p <Card.Header>
style={{ <Header as='h3'>系统状况</Header>
display: 'flex', </Card.Header>
alignItems: 'center', <Grid columns={2} stackable>
gap: '0.5em', <Grid.Column>
}} <Card
fluid
className='chart-card'
style={{ boxShadow: '0 1px 3px rgba(0,0,0,0.12)' }}
>
<Card.Content>
<Card.Header>
<Header as='h3' style={{ color: '#444' }}>
系统信息
</Header>
</Card.Header>
<Card.Description
style={{ lineHeight: '2', marginTop: '1em' }}
> >
<i className='info circle icon'></i> <p
<span style={{ fontWeight: 'bold' }}>名称</span> style={{
<span>{statusState?.status?.system_name}</span> display: 'flex',
</p> alignItems: 'center',
<p gap: '0.5em',
style={{ }}
display: 'flex',
alignItems: 'center',
gap: '0.5em',
}}
>
<i className='code branch icon'></i>
<span style={{ fontWeight: 'bold' }}>版本</span>
<span>{statusState?.status?.version || 'unknown'}</span>
</p>
<p
style={{
display: 'flex',
alignItems: 'center',
gap: '0.5em',
}}
>
<i className='github icon'></i>
<span style={{ fontWeight: 'bold' }}>源码</span>
<a
href='https://github.com/songquanpeng/one-api'
target='_blank'
style={{ color: '#2185d0' }}
> >
GitHub 仓库 <i className='info circle icon'></i>
</a> <span style={{ fontWeight: 'bold' }}>名称</span>
</p> <span>{statusState?.status?.system_name}</span>
<p </p>
style={{ <p
display: 'flex', style={{
alignItems: 'center', display: 'flex',
gap: '0.5em', alignItems: 'center',
}} gap: '0.5em',
> }}
<i className='clock outline icon'></i> >
<span style={{ fontWeight: 'bold' }}>启动时间</span> <i className='code branch icon'></i>
<span>{getStartTimeString()}</span> <span style={{ fontWeight: 'bold' }}>版本</span>
</p> <span>
</Card.Description> {statusState?.status?.version || 'unknown'}
</Card.Content> </span>
</Card> </p>
</Grid.Column> <p
style={{
display: 'flex',
alignItems: 'center',
gap: '0.5em',
}}
>
<i className='github icon'></i>
<span style={{ fontWeight: 'bold' }}>源码</span>
<a
href='https://github.com/songquanpeng/one-api'
target='_blank'
style={{ color: '#2185d0' }}
>
GitHub 仓库
</a>
</p>
<p
style={{
display: 'flex',
alignItems: 'center',
gap: '0.5em',
}}
>
<i className='clock outline icon'></i>
<span style={{ fontWeight: 'bold' }}>启动时间</span>
<span>{getStartTimeString()}</span>
</p>
</Card.Description>
</Card.Content>
</Card>
</Grid.Column>
<Grid.Column> <Grid.Column>
<Card <Card
fluid fluid
className='chart-card' className='chart-card'
style={{ boxShadow: '0 1px 3px rgba(0,0,0,0.12)' }} style={{ boxShadow: '0 1px 3px rgba(0,0,0,0.12)' }}
> >
<Card.Content> <Card.Content>
<Card.Header> <Card.Header>
<Header as='h3' style={{ color: '#444' }}> <Header as='h3' style={{ color: '#444' }}>
系统配置 系统配置
</Header> </Header>
</Card.Header> </Card.Header>
<Card.Description <Card.Description
style={{ lineHeight: '2', marginTop: '1em' }} style={{ lineHeight: '2', marginTop: '1em' }}
>
<p
style={{
display: 'flex',
alignItems: 'center',
gap: '0.5em',
}}
> >
<i className='envelope icon'></i> <p
<span style={{ fontWeight: 'bold' }}>邮箱验证</span>
<span
style={{ style={{
color: statusState?.status?.email_verification display: 'flex',
? '#21ba45' alignItems: 'center',
: '#db2828', gap: '0.5em',
fontWeight: '500',
}} }}
> >
{statusState?.status?.email_verification <i className='envelope icon'></i>
? '已启用' <span style={{ fontWeight: 'bold' }}>邮箱验证</span>
: '未启用'} <span
</span> style={{
</p> color: statusState?.status?.email_verification
<p ? '#21ba45'
style={{ : '#db2828',
display: 'flex', fontWeight: '500',
alignItems: 'center', }}
gap: '0.5em', >
}} {statusState?.status?.email_verification
> ? '已启用'
<i className='github icon'></i> : '未启用'}
<span style={{ fontWeight: 'bold' }}> </span>
GitHub 身份验证 </p>
</span> <p
<span
style={{ style={{
color: statusState?.status?.github_oauth display: 'flex',
? '#21ba45' alignItems: 'center',
: '#db2828', gap: '0.5em',
fontWeight: '500',
}} }}
> >
{statusState?.status?.github_oauth <i className='github icon'></i>
? '已启用' <span style={{ fontWeight: 'bold' }}>
: '未启用'} GitHub 身份验证
</span> </span>
</p> <span
<p style={{
style={{ color: statusState?.status?.github_oauth
display: 'flex', ? '#21ba45'
alignItems: 'center', : '#db2828',
gap: '0.5em', fontWeight: '500',
}} }}
> >
<i className='wechat icon'></i> {statusState?.status?.github_oauth
<span style={{ fontWeight: 'bold' }}> ? '已启用'
微信身份验证 : '未启用'}
</span> </span>
<span </p>
<p
style={{ style={{
color: statusState?.status?.wechat_login display: 'flex',
? '#21ba45' alignItems: 'center',
: '#db2828', gap: '0.5em',
fontWeight: '500',
}} }}
> >
{statusState?.status?.wechat_login <i className='wechat icon'></i>
? '已启用' <span style={{ fontWeight: 'bold' }}>
: '未启用'} 微信身份验证
</span> </span>
</p> <span
<p style={{
style={{ color: statusState?.status?.wechat_login
display: 'flex', ? '#21ba45'
alignItems: 'center', : '#db2828',
gap: '0.5em', fontWeight: '500',
}} }}
> >
<i className='shield alternate icon'></i> {statusState?.status?.wechat_login
<span style={{ fontWeight: 'bold' }}> ? '已启用'
Turnstile 校验 : '未启用'}
</span> </span>
<span </p>
<p
style={{ style={{
color: statusState?.status?.turnstile_check display: 'flex',
? '#21ba45' alignItems: 'center',
: '#db2828', gap: '0.5em',
fontWeight: '500',
}} }}
> >
{statusState?.status?.turnstile_check <i className='shield alternate icon'></i>
? '已启用' <span style={{ fontWeight: 'bold' }}>
: '未启用'} Turnstile 校验
</span> </span>
</p> <span
</Card.Description> style={{
</Card.Content> color: statusState?.status?.turnstile_check
</Card> ? '#21ba45'
</Grid.Column> : '#db2828',
</Grid> fontWeight: '500',
</Card.Content> }}
</Card> >
{statusState?.status?.turnstile_check
? '已启用'
: '未启用'}
</span>
</p>
</Card.Description>
</Card.Content>
</Card>
</Grid.Column>
</Grid>
</Card.Content>
</Card>{' '}
</div>
) : ( ) : (
<> <>
{homePageContent.startsWith('https://') ? ( {homePageContent.startsWith('https://') ? (
@@ -283,7 +287,7 @@ const Home = () => {
)} )}
</> </>
)} )}
</div> </>
); );
}; };