s3si.ts/gui/src/pages/Settings.tsx

41 lines
1.5 KiB
TypeScript
Raw Normal View History

2023-03-06 09:01:18 -05:00
import { Loading } from 'components/Loading';
2023-03-06 08:32:00 -05:00
import { usePromise } from 'hooks/usePromise';
2023-03-06 07:21:29 -05:00
import React from 'react'
import { useTranslation } from 'react-i18next';
import { AiOutlineLeft } from 'react-icons/ai';
import { useNavigate } from 'react-router-dom';
2023-03-06 08:32:00 -05:00
import { getConfig } from 'services/config';
2023-03-06 07:21:29 -05:00
export const Settings: React.FC = () => {
2023-03-06 08:32:00 -05:00
const { loading, result, error } = usePromise(getConfig);
2023-03-06 07:21:29 -05:00
const navigate = useNavigate();
const { t } = useTranslation();
const onSave = async () => {
}
2023-03-06 08:32:00 -05:00
if (loading) {
2023-03-06 09:01:18 -05:00
return <div className='h-full flex items-center justify-center'><Loading /></div>
2023-03-06 08:32:00 -05:00
}
2023-03-06 07:21:29 -05:00
return <>
<div className='card m-2 h-full'>
2023-03-06 08:32:00 -05:00
<h2 className="card-title" data-tauri-drag-region><button onClick={() => navigate('/')}><AiOutlineLeft /></button>{t('配置')}</h2>
2023-03-06 07:21:29 -05:00
<div className='card'>
<div className="form-control w-full max-w-xs mb-4">
<label className="label">
<span className="label-text">{t('stat.ink API密钥')}</span>
<span className="label-text-alt"><a
className='underline'
target='_blank'
rel='noopener noreferrer'
href='https://stat.ink/profile'
title={t('打开 stat.ink') ?? undefined}
>{t('stat.ink')}</a></span>
</label>
<input type="text" placeholder={t('长度为43') ?? undefined} className="input input-bordered w-full max-w-xs" />
</div>
</div>
2023-03-06 08:32:00 -05:00
<button className='btn btn-primary w-20' onClick={onSave}>{t('保存')}</button>
2023-03-06 07:21:29 -05:00
</div>
</>
}