summaryrefslogtreecommitdiff
path: root/web/src/lib/ui/menus/SettingsMenu.svelte
blob: ef5a91aad90158e4b6c0f5ec29b1530884d472ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!--
	Settings (Phase 3 subset of the reference `SettingsMenu`): the visual
	style theme and the UI language. Both are client-only preferences.
-->
<script lang="ts">
	import { availableLocales, locale, type Locale } from '$lib/i18n';
	import { styleTheme, type StyleTheme } from '$lib/settings';
	import { t } from '$lib/i18n';
	import Menu from '../Menu.svelte';

	let { open = $bindable(true) }: { open?: boolean } = $props();

	const THEMES: { id: StyleTheme; label: string }[] = [
		{ id: 'frosthaven', label: 'Frosthaven' },
		{ id: 'gloomhaven', label: 'Gloomhaven' },
		{ id: 'original', label: 'Original' }
	];
</script>

<Menu open={open} title={t('menuSettings')}>
	<div class="settingsrow">
		<label for="theme">{t('menuSettings')}</label>
		<select
			id="theme"
			class="search"
			style="margin: 0; width: auto"
			value={$styleTheme}
			onchange={(e) => styleTheme.set(e.currentTarget.value as StyleTheme)}
		>
			{#each THEMES as th (th.id)}
				<option value={th.id}>{th.label}</option>
			{/each}
		</select>
	</div>

	<div class="settingsrow">
		<label for="locale">Language</label>
		<select
			id="locale"
			class="search"
			style="margin: 0; width: auto"
			value={$locale}
			onchange={(e) => locale.set(e.currentTarget.value as Locale)}
		>
			{#each availableLocales as l (l)}
				<option value={l}>{l}</option>
			{/each}
		</select>
	</div>
</Menu>