From 07af29e6e6c285ab41e6a08e3935b6056172c2aa Mon Sep 17 00:00:00 2001 From: Josh Creek <8179928+jcreek@users.noreply.github.com> Date: Fri, 9 Jan 2026 18:45:47 +0000 Subject: [PATCH] chore(#67): Address pr comments --- scripts/sql-to-csv.js | 87 ----- .../pokedex/PokedexViewBoxes.svelte | 19 +- src/lib/models/PokedexEntry.ts | 2 - .../repositories/CombinedDataRepository.ts | 48 +-- .../repositories/PokedexEntryRepository.ts | 21 +- src/routes/api/seed/+server.ts | 99 ----- src/routes/auth/confirm/+server.ts | 2 +- src/routes/my-pokedexes/+page.svelte | 24 +- src/routes/pokedex/[id]/+page.svelte | 202 +++++++--- src/routes/welcome/+page.svelte | 365 ++++++++++++++++++ .../migrations/20260105160807_seed_johto.sql | 4 +- 11 files changed, 538 insertions(+), 335 deletions(-) delete mode 100644 scripts/sql-to-csv.js delete mode 100644 src/routes/api/seed/+server.ts create mode 100644 src/routes/welcome/+page.svelte diff --git a/scripts/sql-to-csv.js b/scripts/sql-to-csv.js deleted file mode 100644 index b28d67f..0000000 --- a/scripts/sql-to-csv.js +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env node - -/** - * Converts Kanto seed SQL migration to CSV format - * Parses 20260104000001_seed_kanto.sql and generates: - * - data/pokemon/gen1-kanto.csv - * - data/pokemon/games.csv - */ - -import fs from 'fs'; -import path from 'path'; -import { fileURLToPath } from 'url'; - -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); - -// Read the SQL migration file -const sqlPath = path.join(__dirname, '..', 'supabase', 'migrations', '20260104000001_seed_kanto.sql'); -const sqlContent = fs.readFileSync(sqlPath, 'utf-8'); - -// Extract games from region_game_mappings section -const gameMatches = [...sqlContent.matchAll(/\('Kanto', '([^']+)'\)/g)]; -const games = gameMatches.map(m => m[1]); - -console.log(`Found ${games.length} Kanto games:`, games); - -// Extract Pokemon entries from INSERT statement -// Match pattern: (number, 'name', form, boolean, 'region', ARRAY[games], ...) -const valuePattern = /\((\d+),\s*'([^']+)',\s*(NULL|'[^']+'),\s*(true|false),\s*'[^']+',\s*ARRAY\[([^\]]+)\][^,]*,[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,\s*(NULL|\d+)\)/g; - -const pokemon = []; -let match; -while ((match = valuePattern.exec(sqlContent)) !== null) { - const [_, pokedexNumber, name, formRaw, canGigantamax, gamesRaw, regionalNumberRaw] = match; - - // Parse form (NULL or 'Female') - const form = formRaw === 'NULL' ? '' : formRaw.replace(/'/g, ''); - - // Parse games array - extract game names from ARRAY['Red', 'Blue', ...] - const gamesList = gamesRaw.match(/'([^']+)'/g).map(g => g.replace(/'/g, '')); - const gamesStr = gamesList.join('|'); - - // Parse regional number - const regionalNumber = regionalNumberRaw === 'NULL' ? '' : regionalNumberRaw; - - pokemon.push({ - pokedexNumber, - name, - form, - games: gamesStr, - regionalNumber - }); -} - -console.log(`Extracted ${pokemon.length} Pokemon entries`); - -// Generate gen1-kanto.csv -const kantoCSV = [ - 'pokedexNumber,name,form,games,regionalNumber', - ...pokemon.map(p => { - const form = p.form.includes(',') ? `"${p.form}"` : p.form; - const games = p.games.includes(',') ? `"${p.games}"` : p.games; - return `${p.pokedexNumber},${p.name},${form},${games},${p.regionalNumber}`; - }) -].join('\n'); - -const kantoPath = path.join(__dirname, '..', 'data', 'pokemon', 'gen1-kanto.csv'); -fs.writeFileSync(kantoPath, kantoCSV); -console.log(`✓ Created ${kantoPath}`); - -// Generate games.csv -const gamesCSV = [ - 'id,displayName,region,generation', - ...games.map((game, idx) => { - const id = game.toLowerCase().replace(/[^a-z0-9]/g, '-'); - const generation = game.startsWith('LG:') ? 7 : 1; - return `${id},${game},Kanto,${generation}`; - }) -].join('\n'); - -const gamesPath = path.join(__dirname, '..', 'data', 'pokemon', 'games.csv'); -fs.writeFileSync(gamesPath, gamesCSV); -console.log(`✓ Created ${gamesPath}`); - -console.log('\n✅ Conversion complete!'); -console.log(` gen1-kanto.csv: ${pokemon.length} entries`); -console.log(` games.csv: ${games.length} games`); diff --git a/src/lib/components/pokedex/PokedexViewBoxes.svelte b/src/lib/components/pokedex/PokedexViewBoxes.svelte index 624c0ac..f6bb523 100644 --- a/src/lib/components/pokedex/PokedexViewBoxes.svelte +++ b/src/lib/components/pokedex/PokedexViewBoxes.svelte @@ -1,12 +1,11 @@ - {pokedex.name} - Living Dex Tracker + {pokedex ? `${pokedex.name} - Living Dex Tracker` : 'Pokédex - Living Dex Tracker'} {#if !localUser}

Please sign in

+{:else if !pokedex} +

Loading...

{:else}
@@ -285,32 +309,64 @@ {#if pokedex.isLivingDex}
- - + + Living
{/if} {#if pokedex.isShinyDex}
- - + + Shiny
{/if} {#if pokedex.isOriginDex}
- - + + Origin
{/if} {#if pokedex.isFormDex}
- - + + Form
@@ -320,17 +376,35 @@ {#if pokedex.gameScope}
- + - + {pokedex.gameScope}
{:else}
- - + + All Games
@@ -345,8 +419,15 @@
- - + + My Pokédexes @@ -358,7 +439,6 @@ diff --git a/src/routes/welcome/+page.svelte b/src/routes/welcome/+page.svelte new file mode 100644 index 0000000..d0a964f --- /dev/null +++ b/src/routes/welcome/+page.svelte @@ -0,0 +1,365 @@ + + + + Welcome - Living Dex Tracker + + + +
+
+ + {#if showSuccess} +
+
+ + + + Account Created Successfully! +
+
+ {/if} + + +
+
+ +
+

+ Welcome to Living Dex Tracker! +

+ +
+ +
+
+ + + +
+
+

Check Your Email

+

+ We've sent you a magic link to verify your account. Click the link in your email + to sign in and start tracking your Pokédex progress. +

+
+
+ +

+ After clicking the link, you'll be automatically signed in and can start tracking your + Pokémon catches across all generations! +

+ + +
+

+ Haven't received the email? Check your spam or junk + folder. +

+

+ Still having trouble? + + Contact support + for assistance. +

+
+
+
+ + +
+
+

+ + + + What's Next? +

+ +
    +
  • +
    +
    + + + +
    +
    +
    +

    Check your email

    +

    Look for our verification email in your inbox

    +
    +
  • + +
  • +
    +
    + + + +
    +
    +
    +

    Click the magic link

    +

    This will sign you in and verify your account

    +
    +
  • + +
  • +
    +
    + + + +
    +
    +
    +

    Start tracking your Pokémon

    +

    + Create your first Pokédex and begin your journey! +

    +
    +
  • +
+ + +
+
+ + + + The verification link expires in 24 hours +
+
+
+
+
+
+ + +
+

What You Can Do With Living Dex Tracker

+
+
+
+ + + +

Track Multiple Pokédexes

+

+ Manage different Living Dex challenges across all generations +

+
+
+ +
+
+ + + +

Share Your Progress

+

Connect with friends and share your Pokédex journey

+
+
+ +
+
+ + + +

Works Offline

+

Track your catches even without an internet connection

+
+
+
+
+
+
+ + diff --git a/supabase/migrations/20260105160807_seed_johto.sql b/supabase/migrations/20260105160807_seed_johto.sql index 79df3ef..4f32c87 100644 --- a/supabase/migrations/20260105160807_seed_johto.sql +++ b/supabase/migrations/20260105160807_seed_johto.sql @@ -149,6 +149,7 @@ INSERT INTO pokedex_entries ( (231, 'Phanpy', NULL, false, 'Johto', ARRAY['Gold', 'Silver', 'Crystal', 'HeartGold', 'SoulSilver']), (232, 'Donphan', NULL, false, 'Johto', ARRAY['Gold', 'Silver', 'Crystal', 'HeartGold', 'SoulSilver']), (232, 'Donphan', 'Female', false, 'Johto', ARRAY['Gold', 'Silver', 'Crystal', 'HeartGold', 'SoulSilver']), +(233, 'Porygon2', NULL, false, 'Johto', ARRAY['Gold', 'Silver', 'Crystal', 'HeartGold', 'SoulSilver']), (234, 'Stantler', NULL, false, 'Johto', ARRAY['Gold', 'Silver', 'Crystal', 'HeartGold', 'SoulSilver']), (235, 'Smeargle', NULL, false, 'Johto', ARRAY['Gold', 'Silver', 'Crystal', 'HeartGold', 'SoulSilver']), (236, 'Tyrogue', NULL, false, 'Johto', ARRAY['Gold', 'Silver', 'Crystal', 'HeartGold', 'SoulSilver']), @@ -256,6 +257,7 @@ INSERT INTO regional_dex_numbers ( ((SELECT id FROM pokedex_entries WHERE "pokedexNumber" = 230 AND form IS NULL), 'Johto', 79), ((SELECT id FROM pokedex_entries WHERE "pokedexNumber" = 231 AND form IS NULL), 'Johto', 80), ((SELECT id FROM pokedex_entries WHERE "pokedexNumber" = 232 AND form IS NULL), 'Johto', 81), + ((SELECT id FROM pokedex_entries WHERE "pokedexNumber" = 233 AND form IS NULL), 'Johto', 82), ((SELECT id FROM pokedex_entries WHERE "pokedexNumber" = 234 AND form IS NULL), 'Johto', 83), ((SELECT id FROM pokedex_entries WHERE "pokedexNumber" = 235 AND form IS NULL), 'Johto', 84), ((SELECT id FROM pokedex_entries WHERE "pokedexNumber" = 236 AND form IS NULL), 'Johto', 85), @@ -279,4 +281,4 @@ INSERT INTO regional_dex_numbers ( INSERT INTO metadata (key, value) VALUES ('johto_seeded', 'true'), ('johto_seed_date', NOW()::TEXT), - ('johto_pokemon_count', '98'); + ('johto_pokemon_count', '99');