From cffc2a98a599ab2f9f8d76dad9104faad1aed230 Mon Sep 17 00:00:00 2001 From: imspace Date: Tue, 7 Mar 2023 04:32:09 +0800 Subject: [PATCH] feat: add stat.ink link, extract constant --- gui/src/constant/index.ts | 4 ++++ gui/src/pages/Home.tsx | 10 +++++++--- gui/src/pages/Settings.tsx | 3 ++- 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 gui/src/constant/index.ts diff --git a/gui/src/constant/index.ts b/gui/src/constant/index.ts new file mode 100644 index 0000000..d9ea00a --- /dev/null +++ b/gui/src/constant/index.ts @@ -0,0 +1,4 @@ +/** + * https://stat.ink + */ +export const STAT_INK = 'https://stat.ink' diff --git a/gui/src/pages/Home.tsx b/gui/src/pages/Home.tsx index 8419323..aed01bf 100644 --- a/gui/src/pages/Home.tsx +++ b/gui/src/pages/Home.tsx @@ -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 <>
- {t('欢迎!')} - {t('配置')} +

{t('欢迎!')}

+
+ {t('配置')} + {t('前往 stat.ink')} +
} diff --git a/gui/src/pages/Settings.tsx b/gui/src/pages/Settings.tsx index 9dc0be4..402a6fc 100644 --- a/gui/src/pages/Settings.tsx +++ b/gui/src/pages/Settings.tsx @@ -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')}