diff --git a/src/lib/components/SkeletonPlaceholder.svelte b/src/lib/components/SkeletonPlaceholder.svelte new file mode 100644 index 0000000..d94d899 --- /dev/null +++ b/src/lib/components/SkeletonPlaceholder.svelte @@ -0,0 +1,115 @@ + + + + +
+ + diff --git a/src/lib/components/game/index.svelte b/src/lib/components/game/index.svelte index f269c3b..04346a8 100644 --- a/src/lib/components/game/index.svelte +++ b/src/lib/components/game/index.svelte @@ -10,7 +10,6 @@ import { browser } from '$app/environment'; export let game: GameType | SavedGameType; - export let minimal: boolean = false; export let detailed: boolean = false; const dispatch = createEventDispatcher(); @@ -23,6 +22,24 @@ dispatch('handleRemoveCollection', game); } + // Naive and assumes description is only on our GameType at the moment + function isGameType(game: GameType | SavedGameType): game is GameType { + return (game as GameType).description !== undefined; + } + + // function lazy(img: HTMLImageElement) { + // function loaded() { + // img.classList.add('loaded'); + // img.classList.remove('loading'); + // } + // if (img.complete) { + // loaded(); + // } else { + // img.classList.add('loading'); + // img.onload = () => loaded(); + // } + // } + $: existsInCollection = $collectionStore.find((item: SavedGameType) => item.id === game.id); $: existsInWishlist = $wishlistStore.find((item: SavedGameType) => item.id === game.id); @@ -31,15 +48,16 @@Players: {game.min_players} - {game.max_players}
+Players: {game.players}
Time: {game.playtime} minutes
- {#if game?.min_age} + {#if isGameType(game) && game?.min_age}Min Age: {game.min_age}
{/if} - {#if detailed} + {#if detailed && isGameType(game) && game?.description}