mirror of
https://github.com/BradNut/boredgame
synced 2025-09-08 17:40:22 +00:00
Merge pull request #11 from BradNut/development
Fixing url on link with icon and fixing nulls on playtime/players.
This commit is contained in:
commit
73118c8d79
5 changed files with 1133 additions and 10 deletions
|
|
@ -1,6 +1,4 @@
|
|||
<script lang="ts">
|
||||
import type { SvelteComponentTyped } from 'svelte';
|
||||
|
||||
export let url: string;
|
||||
export let ariaLabel = `Link to ${url}`;
|
||||
export let external = false;
|
||||
|
|
|
|||
|
|
@ -40,13 +40,21 @@ export type ToastData = {
|
|||
message: string;
|
||||
};
|
||||
|
||||
export type GameMechanic = {
|
||||
id: string;
|
||||
name: string;
|
||||
boardGameAtlasLink: string;
|
||||
};
|
||||
|
||||
export type SavedGameType = {
|
||||
id: string;
|
||||
name: string;
|
||||
thumb_url: string;
|
||||
players: string;
|
||||
playtime: string;
|
||||
mechanics: GameMechanic[];
|
||||
searchTerms: string;
|
||||
includeInRandom: boolean;
|
||||
};
|
||||
|
||||
export type GameType = {
|
||||
|
|
|
|||
1114
src/lib/util/boardGameAtlasMechanics.json
Normal file
1114
src/lib/util/boardGameAtlasMechanics.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -6,7 +6,7 @@ export const load: PageServerLoad = async ({ params, setHeaders }) => {
|
|||
const queryParams = {
|
||||
ids: `${params?.id}`,
|
||||
fields:
|
||||
'id,name,price,min_age,min_players,max_players,thumb_url,playtime,min_playtime,max_playtime,min_age,description,year_published,image_url'
|
||||
'id,name,price,min_age,min_players,max_players,thumb_url,playtime,min_playtime,max_playtime,min_age,description,year_published,url,image_url'
|
||||
};
|
||||
|
||||
const response = await boardGameApi('get', `search`, queryParams);
|
||||
|
|
@ -19,8 +19,13 @@ export const load: PageServerLoad = async ({ params, setHeaders }) => {
|
|||
});
|
||||
|
||||
const game = gameResponse?.games[0];
|
||||
game.players = `${game.min_players}-${game.max_players}`;
|
||||
game.playtime = `${game.min_playtime}-${game.max_playtime}`;
|
||||
if (game.min_players) {
|
||||
game.players = `${game.min_players}-${game.max_players}`;
|
||||
}
|
||||
|
||||
if (game.min_playtime) {
|
||||
game.playtime = `${game.min_playtime}-${game.max_playtime}`;
|
||||
}
|
||||
|
||||
return {
|
||||
game
|
||||
|
|
|
|||
|
|
@ -82,11 +82,9 @@
|
|||
{#if +game?.price !== 0.0}
|
||||
<p>Price: ${game?.price}</p>
|
||||
{/if}
|
||||
<p>
|
||||
<LinkWithIcon external ariaLabel={`Board Game Atlas Link for ${game.name}`} url={game.url}>
|
||||
Board Game Atlas <ExternalLinkIcon width="24" height="24" />
|
||||
</LinkWithIcon>
|
||||
</p>
|
||||
<LinkWithIcon external ariaLabel={`Board Game Atlas Link for ${game.name}`} url={game.url}>
|
||||
Board Game Atlas <ExternalLinkIcon width="24" height="24" />
|
||||
</LinkWithIcon>
|
||||
</div>
|
||||
<div style="display: grid; gap: 1.5rem; place-content: center;">
|
||||
{#if existsInCollection}
|
||||
|
|
|
|||
Loading…
Reference in a new issue