-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat-mobile: add lang and theme settings (#5434)
* feat-mobile: add lang and theme settings * feat-mobile: remove language change function Co-authored-by: Begoña Alvarez <balvarez@boxfish.studio>
- Loading branch information
1 parent
e232fa5
commit 84aec3d
Showing
5 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
18 changes: 16 additions & 2 deletions
18
packages/mobile/lib/contexts/dashboard/constants/settings-route-meta.constant.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
packages/mobile/views/dashboard/drawers/profile/views/settings/views/LanguageView.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<script lang="typescript"> | ||
import { Radio } from 'shared/components' | ||
import { appSettings } from '@core/app' | ||
import { SUPPORTED_LOCALES, setLanguage } from '@core/i18n' | ||
let appLanguage: string = SUPPORTED_LOCALES[$appSettings.language] | ||
$: languageList = Object.values(SUPPORTED_LOCALES).map((locale) => ({ value: locale, label: locale })) | ||
$: appLanguage, setLanguage({ value: appLanguage }) | ||
</script> | ||
|
||
<div class="flex flex-col overflow-y-auto"> | ||
{#each languageList as language} | ||
<Radio value={language.value} bind:group={appLanguage} label={language.label} classes="p-2" /> | ||
{/each} | ||
</div> |
22 changes: 22 additions & 0 deletions
22
packages/mobile/views/dashboard/drawers/profile/views/settings/views/ThemeView.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<script lang="typescript"> | ||
import { Radio, Text, Icon } from 'shared/components' | ||
import { AppTheme, appSettings, shouldBeDarkMode } from '@core/app' | ||
import { localize } from '@core/i18n' | ||
let appTheme: AppTheme = $appSettings.theme | ||
$: $appSettings.theme = appTheme | ||
$: $appSettings.darkMode = shouldBeDarkMode($appSettings.theme) | ||
</script> | ||
|
||
<div class="flex flex-col"> | ||
<Radio value={'light'} bind:group={appTheme} label={localize('general.lightTheme')} classes="p-2" /> | ||
<Radio value={'dark'} bind:group={appTheme} label={localize('general.darkTheme')} classes="p-2" /> | ||
<Radio value={'system'} bind:group={appTheme} label={localize('general.systemTheme')} classes="p-2" /> | ||
{#if appTheme === 'system'} | ||
<div class="flex flex-row items-center mb-5"> | ||
<Icon icon="info" classes="mr-3 fill-current text-black dark:text-white" /> | ||
<Text fontSize="14" lineHeight="5">{localize('views.settings.theme.advice')}</Text> | ||
</div> | ||
{/if} | ||
</div> |
2 changes: 2 additions & 0 deletions
2
packages/mobile/views/dashboard/drawers/profile/views/settings/views/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
export { default as ChangePasswordView } from './ChangePasswordView.svelte' | ||
export { default as LanguageView } from './LanguageView.svelte' | ||
export { default as ThemeView } from './ThemeView.svelte' | ||
export { default as SettingsIndexView } from './SettingsIndexView.svelte' |