1
0
Fork 0
mirror of https://git.sr.ht/~ashkeel/strimertul synced 2024-09-18 01:50:50 +00:00

feat: add button to repeat onboarding

This commit is contained in:
Ash Keel 2022-12-16 12:19:05 +01:00
parent 517bd5aac6
commit bf8cd57fff
No known key found for this signature in database
GPG key ID: BAD8D93E7314ED3E
2 changed files with 22 additions and 3 deletions

View file

@ -264,7 +264,9 @@
},
"uiconfig": {
"title": "User interface settings",
"language": "Language"
"language": "Language",
"repeat-onboarding": "Repeat onboarding",
"partial-translation": "Partial translation"
}
},
"form-actions": {

View file

@ -2,13 +2,22 @@ import React from 'react';
import { useTranslation } from 'react-i18next';
import { useModule } from '~/lib/react-utils';
import { languages } from '~/locale/languages';
import { useAppDispatch } from '~/store';
import { modules } from '~/store/api/reducer';
import RadioGroup from '../components/forms/RadioGroup';
import { Field, Label, PageContainer, PageHeader, PageTitle } from '../theme';
import {
Button,
Field,
Label,
PageContainer,
PageHeader,
PageTitle,
} from '../theme';
export default function UISettingsPage(): React.ReactElement {
const [uiConfig, setUiConfig] = useModule(modules.uiConfig);
const [t, i18n] = useTranslation();
const dispatch = useAppDispatch();
const maxKeys = languages.reduce(
(current, it) => Math.max(current, it.keys),
@ -33,7 +42,7 @@ export default function UISettingsPage(): React.ReactElement {
{lang.name}{' '}
{lang.keys < maxKeys ? (
<small>
Partial translation (
{t('pages.uiconfig.partial-translation')} (
{((lang.keys / maxKeys) * 100).toFixed(1)}% - {lang.keys}/
{maxKeys})
</small>
@ -43,6 +52,14 @@ export default function UISettingsPage(): React.ReactElement {
}))}
/>
</Field>
<Button
type="button"
onClick={() => {
void dispatch(setUiConfig({ ...uiConfig, onboardingDone: false }));
}}
>
{t('pages.uiconfig.repeat-onboarding')}
</Button>
</PageContainer>
);
}