on the way to get shortcuts working

This commit is contained in:
Alphons Joseph
2024-09-06 22:37:57 +08:00
parent 7f93aef9cc
commit cd430f2027
@@ -1,25 +1,37 @@
<script lang="ts"> <script lang="ts">
import { settingsState } from "@/seqta/utils/listeners/SettingsState.ts" import { settingsState } from "@/seqta/utils/listeners/SettingsState.ts"
import Switch from "../../components/Switch.svelte"
console.log(settingsState.shortcuts)
</script> </script>
{#snippet Shortcuts([string, Shortcut]) } {#snippet Shortcuts({ name, enabled, Component, props }) }
<div class="flex items-center justify-between px-4 py-3"> <div class="flex items-center justify-between px-4 py-3">
<div class="pr-4"> <div class="pr-4">
<h2 class="text-sm font-bold">{Shortcut.name}</h2> <h2 class="text-sm font-bold">{name}</h2>
<p class="text-xs">{Shortcut.enabled}</p> <p class="text-xs">{enabled}</p>
</div>
<div>
<Component {...props} />
</div> </div>
</div> </div>
{/snippet} {/snippet}
<div class="text-xl">shortcuts tab</div>
<div class="flex flex-col -mt-4 overflow-y-scroll divide-y divide-zinc-100 dark:divide-zinc-700"> <div class="flex flex-col -mt-4 overflow-y-scroll divide-y divide-zinc-100 dark:divide-zinc-700">
{#each Object.entries(settingsState.shortcuts) as shortcut} {#each settingsState.shortcuts as shortcut}
<!-- do processing stuff here --> {@const shortcutFinal = {
{@render Shortcuts(shortcut)} ...shortcut,
name: shortcut.name,
enabled: shortcut.enabled,
Component: Switch,
props: {
// placeholder
// state: $settingsState.onoff,
// onChange: (isOn: boolean) => settingsState.onoff = isOn
}
}}
{@render Shortcuts(shortcutFinal)}
{/each} {/each}
</div> </div>