Update shortcuts.svelte - use "DisplayName" for displayname

made code use "DisplayName" in object for display name instead of object name, includes fallback in case the object is missing displayname
This commit is contained in:
StroepWafel
2025-05-08 21:32:59 +09:30
committed by GitHub
parent 7a19074c4f
commit fa41542ec6
@@ -135,7 +135,8 @@
{#each Object.entries(Shortcuts) as shortcut} {#each Object.entries(Shortcuts) as shortcut}
<div class="flex justify-between items-center px-4 py-3"> <div class="flex justify-between items-center px-4 py-3">
<div class="pr-4"> <div class="pr-4">
<h2 class="text-sm">{shortcut[0]}</h2> <!-- Use DisplayName if it exists, otherwise use the key (shortcut[0]) as a fallback -->
<h2 class="text-sm">{shortcut[1].DisplayName || shortcut[0]}</h2>
</div> </div>
<Switch state={$settingsState.shortcuts.find(s => s.name === shortcut[0])?.enabled ?? false} onChange={() => switchChange(shortcut[0])} /> <Switch state={$settingsState.shortcuts.find(s => s.name === shortcut[0])?.enabled ?? false} onChange={() => switchChange(shortcut[0])} />
</div> </div>