diff --git a/src/lib/components/DNDGroup.svelte b/src/lib/components/DNDGroup.svelte index 9c3eab8..f17601c 100644 --- a/src/lib/components/DNDGroup.svelte +++ b/src/lib/components/DNDGroup.svelte @@ -1,9 +1,10 @@ +{#snippet card(item, i)} + {#if image} + Album Art + + {:else} +

+ {#if type === 'artists'} + {truncate(item.value, 30)} + {:else} + {truncate(item.value, 45)} + {/if} +

+ + {/if} +{/snippet} +
{#each items as item, i (item.id)} -
- - {#if image} +
+ {#if item[SHADOW_ITEM_MARKER_PROPERTY_NAME]} +
+ {@render card(item, i)} +
+ {:else} + - Album Art - + {@render card(item, i)} - {:else} - -

- {#if type === 'artists'} - {truncate(item.value, 30)} - {:else} - {truncate(item.value, 45)} - {/if} -

- -
- {/if} -
+ + {/if}
{/each}
diff --git a/src/routes/(trivia)/pakubiiti/+page.svelte b/src/routes/(trivia)/pakubiiti/+page.svelte index e85140f..ea5723b 100644 --- a/src/routes/(trivia)/pakubiiti/+page.svelte +++ b/src/routes/(trivia)/pakubiiti/+page.svelte @@ -8,17 +8,11 @@ import type { PageData } from './$types'; import { enhance } from '$app/forms'; - let { data, form }: { data: PageData; form: FormData } = $props(); + let { data }: { data: PageData; form: FormData } = $props(); - let loading = $state(true); + let loading = $state(false); let oldAlbums: SpotifyApi.AlbumObjectSimplified[] = $state([]); - $effect(() => { - // this is a hack to disable grayscale, please ignore - // eslint-disable-next-line no-constant-binary-expression - loading = false && form?.success; - }); - // Used when user answers wrong and no new data comes in $effect(() => { if (data.streamed?.albums) { @@ -44,7 +38,34 @@ {/snippet} - +{#snippet playArea(albums, placeholder = false)} + {#if placeholder} + {#each { length: 2 } as _} +
+ {#each { length: 3 } as _} + + {/each} +
+ + {/each} + +
+ {#each { length: 3 } as _} + + {/each} +
+ {:else} + + + + + + {/if} + + {@render footer(placeholder)} +{/snippet} + + @@ -83,43 +104,16 @@ action="?/submit" method="POST" use:enhance - class="grid w-full gap-6 transition-all {loading || data?.playing === false ? 'grayscale' : ''}" + class="grid w-full gap-4 transition-all {loading || data?.playing === false ? 'grayscale' : ''}" > {#if data?.streamed?.albums} {#await data.streamed.albums} - {#each { length: 2 } as _} -
- {#each { length: 3 } as _} - - {/each} -
- - {/each} - -
- {#each { length: 3 } as _} - - {/each} -
- - {@render footer(true)} + {@render playArea({}, true)} {:then albums} - - - - - - - {@render footer(false)} + {@render playArea(albums)} {/await} {:else} - - - - - - - {@render footer(false)} + {@render playArea(oldAlbums)} {/if}