web/settings: fix setting value name
This commit is contained in:
parent
b9e7661b6d
commit
7e39bd78d7
3 changed files with 9 additions and 9 deletions
|
@ -3,7 +3,7 @@
|
||||||
generics="
|
generics="
|
||||||
Context extends Exclude<keyof CobaltSettings, 'schemaVersion'>,
|
Context extends Exclude<keyof CobaltSettings, 'schemaVersion'>,
|
||||||
Id extends keyof CobaltSettings[Context],
|
Id extends keyof CobaltSettings[Context],
|
||||||
Key extends CobaltSettings[Context][Id]
|
Value extends CobaltSettings[Context][Id]
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
import settings, { updateSetting } from "$lib/settings";
|
import settings, { updateSetting } from "$lib/settings";
|
||||||
|
@ -11,20 +11,20 @@
|
||||||
|
|
||||||
export let settingContext: Context;
|
export let settingContext: Context;
|
||||||
export let settingId: Id;
|
export let settingId: Id;
|
||||||
export let settingKey: Key;
|
export let settingValue: Value;
|
||||||
|
|
||||||
$: setting = $settings[settingContext][settingId];
|
$: setting = $settings[settingContext][settingId];
|
||||||
$: isSelected = setting === settingKey;
|
$: isSelected = setting === settingValue;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
id="setting-button-{settingContext}-{String(settingId)}-{settingKey}"
|
id="setting-button-{settingContext}-{String(settingId)}-{settingValue}"
|
||||||
class="button"
|
class="button"
|
||||||
class:selected={isSelected}
|
class:selected={isSelected}
|
||||||
on:click={() =>
|
on:click={() =>
|
||||||
updateSetting({
|
updateSetting({
|
||||||
[settingContext]: {
|
[settingContext]: {
|
||||||
[settingId]: settingKey,
|
[settingId]: settingValue,
|
||||||
},
|
},
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
|
|
|
@ -68,13 +68,13 @@
|
||||||
|
|
||||||
<div id="action-container">
|
<div id="action-container">
|
||||||
<Switcher>
|
<Switcher>
|
||||||
<SettingsButton settingContext="save" settingId="downloadMode" settingKey="auto">
|
<SettingsButton settingContext="save" settingId="downloadMode" settingValue="auto">
|
||||||
<IconSparkles /> auto
|
<IconSparkles /> auto
|
||||||
</SettingsButton>
|
</SettingsButton>
|
||||||
<SettingsButton settingContext="save" settingId="downloadMode" settingKey="audio">
|
<SettingsButton settingContext="save" settingId="downloadMode" settingValue="audio">
|
||||||
<IconMusic /> audio
|
<IconMusic /> audio
|
||||||
</SettingsButton>
|
</SettingsButton>
|
||||||
<SettingsButton settingContext="save" settingId="downloadMode" settingKey="mute">
|
<SettingsButton settingContext="save" settingId="downloadMode" settingValue="mute">
|
||||||
<IconMute /> mute
|
<IconMute /> mute
|
||||||
</SettingsButton>
|
</SettingsButton>
|
||||||
</Switcher>
|
</Switcher>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
<div>{settingId}</div>
|
<div>{settingId}</div>
|
||||||
<Switcher>
|
<Switcher>
|
||||||
{#each settingValue as value}
|
{#each settingValue as value}
|
||||||
<SettingsButton settingContext="{context}" settingId="{settingId}" settingKey="{value}">
|
<SettingsButton settingContext="{context}" settingId="{settingId}" settingValue="{value}">
|
||||||
{value}
|
{value}
|
||||||
</SettingsButton>
|
</SettingsButton>
|
||||||
{/each}
|
{/each}
|
||||||
|
|
Loading…
Reference in a new issue