web/settings: fix setting value name

This commit is contained in:
wukko 2024-06-20 19:19:57 +06:00
parent b9e7661b6d
commit 7e39bd78d7
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2
3 changed files with 9 additions and 9 deletions

View file

@ -3,7 +3,7 @@
generics="
Context extends Exclude<keyof CobaltSettings, 'schemaVersion'>,
Id extends keyof CobaltSettings[Context],
Key extends CobaltSettings[Context][Id]
Value extends CobaltSettings[Context][Id]
"
>
import settings, { updateSetting } from "$lib/settings";
@ -11,20 +11,20 @@
export let settingContext: Context;
export let settingId: Id;
export let settingKey: Key;
export let settingValue: Value;
$: setting = $settings[settingContext][settingId];
$: isSelected = setting === settingKey;
$: isSelected = setting === settingValue;
</script>
<button
id="setting-button-{settingContext}-{String(settingId)}-{settingKey}"
id="setting-button-{settingContext}-{String(settingId)}-{settingValue}"
class="button"
class:selected={isSelected}
on:click={() =>
updateSetting({
[settingContext]: {
[settingId]: settingKey,
[settingId]: settingValue,
},
})}
>

View file

@ -68,13 +68,13 @@
<div id="action-container">
<Switcher>
<SettingsButton settingContext="save" settingId="downloadMode" settingKey="auto">
<SettingsButton settingContext="save" settingId="downloadMode" settingValue="auto">
<IconSparkles /> auto
</SettingsButton>
<SettingsButton settingContext="save" settingId="downloadMode" settingKey="audio">
<SettingsButton settingContext="save" settingId="downloadMode" settingValue="audio">
<IconMusic /> audio
</SettingsButton>
<SettingsButton settingContext="save" settingId="downloadMode" settingKey="mute">
<SettingsButton settingContext="save" settingId="downloadMode" settingValue="mute">
<IconMute /> mute
</SettingsButton>
</Switcher>

View file

@ -22,7 +22,7 @@
<div>{settingId}</div>
<Switcher>
{#each settingValue as value}
<SettingsButton settingContext="{context}" settingId="{settingId}" settingKey="{value}">
<SettingsButton settingContext="{context}" settingId="{settingId}" settingValue="{value}">
{value}
</SettingsButton>
{/each}