mirror of
https://github.com/imputnet/cobalt.git
synced 2024-12-28 18:46:09 +00:00
web/settings: fix setting value name
This commit is contained in:
parent
b9e7661b6d
commit
7e39bd78d7
|
@ -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,
|
||||
},
|
||||
})}
|
||||
>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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}
|
||||
|
|
Loading…
Reference in a new issue