feat: add stat.ink link, extract constant

main
imspace 2023-03-07 04:32:09 +08:00
parent 90aeaefae7
commit cffc2a98a5
3 changed files with 13 additions and 4 deletions

View File

@ -0,0 +1,4 @@
/**
* https://stat.ink
*/
export const STAT_INK = 'https://stat.ink'

View File

@ -1,5 +1,6 @@
import { ErrorContent } from 'components/ErrorContent';
import { Loading } from 'components/Loading';
import { STAT_INK } from 'constant';
import { usePromise } from 'hooks/usePromise';
import React from 'react'
import { useTranslation } from 'react-i18next';
@ -8,7 +9,7 @@ import { getConfig, getProfile } from 'services/config';
import { composeLoadable } from 'utils/composeLoadable';
export const Home: React.FC = () => {
let { loading, error, retry, result } = composeLoadable({
let { loading, error, retry } = composeLoadable({
config: usePromise(getConfig),
profile: usePromise(() => getProfile(0)),
});
@ -28,8 +29,11 @@ export const Home: React.FC = () => {
return <>
<div className='card m-2 h-full'>
{t('欢迎!')}
<h1 className='mb-4'>{t('欢迎!')}</h1>
<div className='flex flex-col gap-2'>
<Link to='/settings' className='btn btn-primary'>{t('配置')}</Link>
<a className='btn' href={STAT_INK} target='_blank' rel='noreferrer'>{t('前往 stat.ink')}</a>
</div>
</div>
</>
}

View File

@ -9,6 +9,7 @@ import { Config, getConfig, getProfile, Profile, setConfig, setProfile } from 's
import { composeLoadable } from 'utils/composeLoadable';
import classNames from 'classnames';
import { useLogin } from 'services/s3si';
import { STAT_INK } from 'constant';
const Page: React.FC<{ children?: React.ReactNode }> = ({ children }) => {
const { t } = useTranslation();
@ -89,7 +90,7 @@ const Form: React.FC<{
className='underline'
target='_blank'
rel='noopener noreferrer'
href='https://stat.ink/profile'
href={`${STAT_INK}/profile`}
title={t('打开 stat.ink') ?? undefined}
>{t('stat.ink')}</a></span>
</label>