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:
parent
517bd5aac6
commit
bf8cd57fff
2 changed files with 22 additions and 3 deletions
|
@ -264,7 +264,9 @@
|
||||||
},
|
},
|
||||||
"uiconfig": {
|
"uiconfig": {
|
||||||
"title": "User interface settings",
|
"title": "User interface settings",
|
||||||
"language": "Language"
|
"language": "Language",
|
||||||
|
"repeat-onboarding": "Repeat onboarding",
|
||||||
|
"partial-translation": "Partial translation"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"form-actions": {
|
"form-actions": {
|
||||||
|
|
|
@ -2,13 +2,22 @@ import React from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useModule } from '~/lib/react-utils';
|
import { useModule } from '~/lib/react-utils';
|
||||||
import { languages } from '~/locale/languages';
|
import { languages } from '~/locale/languages';
|
||||||
|
import { useAppDispatch } from '~/store';
|
||||||
import { modules } from '~/store/api/reducer';
|
import { modules } from '~/store/api/reducer';
|
||||||
import RadioGroup from '../components/forms/RadioGroup';
|
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 {
|
export default function UISettingsPage(): React.ReactElement {
|
||||||
const [uiConfig, setUiConfig] = useModule(modules.uiConfig);
|
const [uiConfig, setUiConfig] = useModule(modules.uiConfig);
|
||||||
const [t, i18n] = useTranslation();
|
const [t, i18n] = useTranslation();
|
||||||
|
const dispatch = useAppDispatch();
|
||||||
|
|
||||||
const maxKeys = languages.reduce(
|
const maxKeys = languages.reduce(
|
||||||
(current, it) => Math.max(current, it.keys),
|
(current, it) => Math.max(current, it.keys),
|
||||||
|
@ -33,7 +42,7 @@ export default function UISettingsPage(): React.ReactElement {
|
||||||
{lang.name}{' '}
|
{lang.name}{' '}
|
||||||
{lang.keys < maxKeys ? (
|
{lang.keys < maxKeys ? (
|
||||||
<small>
|
<small>
|
||||||
Partial translation (
|
{t('pages.uiconfig.partial-translation')} (
|
||||||
{((lang.keys / maxKeys) * 100).toFixed(1)}% - {lang.keys}/
|
{((lang.keys / maxKeys) * 100).toFixed(1)}% - {lang.keys}/
|
||||||
{maxKeys})
|
{maxKeys})
|
||||||
</small>
|
</small>
|
||||||
|
@ -43,6 +52,14 @@ export default function UISettingsPage(): React.ReactElement {
|
||||||
}))}
|
}))}
|
||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
onClick={() => {
|
||||||
|
void dispatch(setUiConfig({ ...uiConfig, onboardingDone: false }));
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t('pages.uiconfig.repeat-onboarding')}
|
||||||
|
</Button>
|
||||||
</PageContainer>
|
</PageContainer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue