Skip to content

Commit

Permalink
Add more menu for additional controls and links in the desktop layout
Browse files Browse the repository at this point in the history
  • Loading branch information
gomander committed Jan 6, 2024
1 parent d0b4d70 commit 897d9ad
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 13 deletions.
2 changes: 2 additions & 0 deletions src/lib/components/EntriesTextbox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@
disabled={$busyStore.spinning}
aria-label="Entries"
/>

<pre>{$wheelStore.entries.map(e => `${e.text} - ${e.id}`).join('\n')}</pre>
12 changes: 11 additions & 1 deletion src/lib/components/MobileMenu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { createEventDispatcher } from 'svelte'
import { LightSwitch } from '@skeletonlabs/skeleton'
import busyStore from '$lib/stores/BusyStore'
import debugStore from '$lib/stores/DebugStore'
const dispatch = createEventDispatcher<{
new: null,
Expand Down Expand Up @@ -82,12 +83,21 @@
<span class="flex-grow text-left">Theme</span>
</div>

<a
href="https://github.com/gomander/svelte-wheel"
target="_blank"
class="btn text-xl hover:variant-soft-primary"
>
<i class="fab fa-github w-6" />
<span class="flex-grow text-left">GitHub</span>
</a>

<button
class="btn text-xl hover:variant-soft-primary"
on:click={() => dispatch('debug')}
disabled={$busyStore.spinning}
>
<i class="fas fa-bug w-6" />
<i class="fas {$debugStore.active ? 'fa-bug-slash' : 'fa-bug'} w-6" />
<span class="flex-grow text-left">Debug</span>
</button>
</div>
53 changes: 53 additions & 0 deletions src/lib/components/MoreMenu.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<script lang="ts">
import { createEventDispatcher } from 'svelte'
import { LightSwitch } from '@skeletonlabs/skeleton'
import busyStore from '$lib/stores/BusyStore'
import debugStore from '$lib/stores/DebugStore'
const dispatch = createEventDispatcher<{
account: null,
debug: null
}>()
</script>

<div class="card flex flex-col w-fit shadow-xl p-2">
<button
class="btn text-xl hover:variant-soft-primary"
on:click={() => dispatch('account')}
disabled={$busyStore.spinning}
>
<i class="fas fa-user w-6" />
<span class="flex-grow text-left">Account</span>
</button>

<a
href="/faq"
class="btn text-xl hover:variant-soft-primary"
>
<i class="fas fa-question w-6" />
<span class="flex-grow text-left">FAQ</span>
</a>

<div class="btn text-xl">
<LightSwitch />
<span class="flex-grow text-left">Theme</span>
</div>

<a
href="https://github.com/gomander/svelte-wheel"
target="_blank"
class="btn text-xl hover:variant-soft-primary"
>
<i class="fab fa-github w-6" />
<span class="flex-grow text-left">GitHub</span>
</a>

<button
class="btn text-xl hover:variant-soft-primary"
on:click={() => dispatch('debug')}
disabled={$busyStore.spinning}
>
<i class="fas {$debugStore.active ? 'fa-bug-slash' : 'fa-bug'} w-6" />
<span class="flex-grow text-left">Debug</span>
</button>
</div>
2 changes: 2 additions & 0 deletions src/lib/components/ResultsTextbox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@
bind:value={text}
aria-label="Results"
/>

<pre>{$wheelStore.winners.map(e => `${e.text} - ${e.id}`).join('\n')}</pre>
30 changes: 18 additions & 12 deletions src/lib/components/Toolbar.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<script lang="ts">
import { createEventDispatcher } from 'svelte'
import { popup, LightSwitch } from '@skeletonlabs/skeleton'
import { popup } from '@skeletonlabs/skeleton'
import fullscreenStore from '$lib/stores/FullscreenStore'
import busyStore from '$lib/stores/BusyStore'
import MobileMenu from '$lib/components/MobileMenu.svelte'
import MoreMenu from '$lib/components/MoreMenu.svelte'
const dispatch = createEventDispatcher<{
new: null,
Expand Down Expand Up @@ -97,16 +98,6 @@
>
<i class="fas fa-share-nodes" />
</button>

<button
class="btn btn-icon-sm text-lg hover:variant-soft-primary"
on:click={() => dispatch('account')}
disabled={$busyStore.spinning}
aria-label="Account"
title="Account"
>
<i class="fas fa-user" />
</button>
{/if}

{#if $fullscreenStore.supported}
Expand All @@ -120,6 +111,21 @@
</button>
{/if}

<LightSwitch />
<div>
<button
class="btn btn-icon-sm text-xl hover:variant-soft-primary"
use:popup={{ event: 'click', target: 'moreMenu' }}
role="menu"
>
<i class="fas fa-bars" />
</button>

<div data-popup="moreMenu">
<MoreMenu
on:account={() => dispatch('account')}
on:debug={() => dispatch('debug')}
/>
</div>
</div>
</div>
</header>

0 comments on commit 897d9ad

Please sign in to comment.