From 72254fb4794e8784773c413daa99b8bc0c711111 Mon Sep 17 00:00:00 2001 From: Josh Creek <8179928+jcreek@users.noreply.github.com> Date: Fri, 12 Jul 2024 14:35:25 +0100 Subject: [PATCH] feat(*): Add ability to toggle origins and forms --- .../pokedex/PokedexEntryCatchRecord.svelte | 42 +++++++++++-------- src/routes/mydex/+page.svelte | 17 +++++++- 2 files changed, 40 insertions(+), 19 deletions(-) diff --git a/src/lib/components/pokedex/PokedexEntryCatchRecord.svelte b/src/lib/components/pokedex/PokedexEntryCatchRecord.svelte index 6d021c9..b2eced9 100644 --- a/src/lib/components/pokedex/PokedexEntryCatchRecord.svelte +++ b/src/lib/components/pokedex/PokedexEntryCatchRecord.svelte @@ -6,6 +6,8 @@ export let pokedexEntry: PokedexEntry; export let catchRecord: CatchRecord; + export let showOrigins: boolean; + export let showForms: boolean; const dispatch = createEventDispatcher(); @@ -34,15 +36,19 @@ -
-

Form: {pokedexEntry.form ? pokedexEntry.form : '-'}

-
+ {#if showForms} +
+

Form: {pokedexEntry.form ? pokedexEntry.form : '-'}

+
+ {/if}

Box: {pokedexEntry.boxPlacement.box}

Row: {pokedexEntry.boxPlacement.row}

Column: {pokedexEntry.boxPlacement.column}

-

Can Gigantamax: {pokedexEntry.canGigantamax ? 'Yes' : 'No'}

+ {#if showForms} +

Can Gigantamax: {pokedexEntry.canGigantamax ? 'Yes' : 'No'}

+ {/if}

Notes: {pokedexEntry.notes}

@@ -77,7 +83,7 @@ class="form-checkbox" /> - {#if pokedexEntry.canGigantamax} + {#if pokedexEntry.canGigantamax && showForms}
-
-

Region to Catch In: {pokedexEntry.regionToCatchIn}

-

Games to catch in:

-
    - {#each pokedexEntry.gamesToCatchIn as game} -
  • {game}
  • - {/each} -
- {#if pokedexEntry.regionToEvolveIn} -

Region to Evolve In: {pokedexEntry.regionToEvolveIn}

- {/if} -
+ {#if showOrigins} +
+

Region to Catch In: {pokedexEntry.regionToCatchIn}

+

Games to catch in:

+
    + {#each pokedexEntry.gamesToCatchIn as game} +
  • {game}
  • + {/each} +
+ {#if pokedexEntry.regionToEvolveIn} +

Region to Evolve In: {pokedexEntry.regionToEvolveIn}

+ {/if} +
+ {/if}
diff --git a/src/routes/mydex/+page.svelte b/src/routes/mydex/+page.svelte index f67ef7f..ace0aa5 100644 --- a/src/routes/mydex/+page.svelte +++ b/src/routes/mydex/+page.svelte @@ -21,6 +21,17 @@ let creatingRecords = false; let totalRecordsCreated = 0; + let showOrigins = true; + let showForms = true; + + function toggleOrigins() { + showOrigins = !showOrigins; + } + + function toggleForms() { + showForms = !showForms; + } + async function fetchPokeDexEntries() { console.log('Fetching updated Pokedex entry data'); const response = await fetch('/api/pokedexentries'); @@ -164,8 +175,8 @@
{#if combinedData}
- - + +