mirror of
https://github.com/jcreek/LivingDexTracker.git
synced 2026-09-14 17:42:17 +00:00
style: format tracked files and ignore generated data exports
`prettier --check .` failed on 22 files, so gating CI on `npm run lint` was never going to pass. These changes are whitespace only. Adds the two remaining generated data exports to .prettierignore so this class of churn cannot recur, along with machine-local settings files.
This commit is contained in:
@@ -56,7 +56,6 @@
|
||||
}
|
||||
updateCatchRecord('toggle');
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div
|
||||
|
||||
@@ -59,10 +59,8 @@
|
||||
// Validation
|
||||
$: hasAtLeastOneType =
|
||||
pokedex.isLivingDex || pokedex.isShinyDex || pokedex.isOriginDex || pokedex.isFormDex;
|
||||
$: hasDexScope =
|
||||
!pokedex.gameScope || (pokedex.dexScopes && pokedex.dexScopes.length > 0);
|
||||
$: canSubmit =
|
||||
pokedex.name && pokedex.name.trim() !== '' && hasAtLeastOneType && hasDexScope;
|
||||
$: hasDexScope = !pokedex.gameScope || (pokedex.dexScopes && pokedex.dexScopes.length > 0);
|
||||
$: canSubmit = pokedex.name && pokedex.name.trim() !== '' && hasAtLeastOneType && hasDexScope;
|
||||
|
||||
$: if (pokedex.gameScope !== lastGameScope) {
|
||||
const shouldResetDexes = mode === 'create' || hasSeenGameScope;
|
||||
@@ -162,16 +160,14 @@
|
||||
<option value={null}>All Games</option>
|
||||
{#if loadingDexes}
|
||||
<option disabled>Loading games...</option>
|
||||
{:else if gameList.length > 0}
|
||||
{#each gameList as game}
|
||||
<option value={game.displayName}>{game.displayName}</option>
|
||||
{/each}
|
||||
{:else}
|
||||
{#if gameList.length > 0}
|
||||
{#each gameList as game}
|
||||
<option value={game.displayName}>{game.displayName}</option>
|
||||
{/each}
|
||||
{:else}
|
||||
{#each gameOrder.length > 0 ? gameOrder : Object.keys(gameDexes) as game}
|
||||
<option value={game}>{game}</option>
|
||||
{/each}
|
||||
{/if}
|
||||
{#each gameOrder.length > 0 ? gameOrder : Object.keys(gameDexes) as game}
|
||||
<option value={game}>{game}</option>
|
||||
{/each}
|
||||
{/if}
|
||||
</select>
|
||||
</div>
|
||||
@@ -181,7 +177,9 @@
|
||||
<fieldset class="w-full">
|
||||
<legend class="label">
|
||||
<span class="label-text">Dex Scope</span>
|
||||
<span class="label-text-alt text-error">{!hasDexScope ? 'Select at least one dex' : ''}</span>
|
||||
<span class="label-text-alt text-error"
|
||||
>{!hasDexScope ? 'Select at least one dex' : ''}</span
|
||||
>
|
||||
</legend>
|
||||
{#if availableDexes.length === 0}
|
||||
<p class="text-sm text-error">No dexes found for this game.</p>
|
||||
|
||||
@@ -8,9 +8,7 @@ import type { SupabaseClient } from '@supabase/supabase-js';
|
||||
class PokedexEntryRepository {
|
||||
constructor(private supabase: SupabaseClient) {}
|
||||
|
||||
private parseCatchInformation(
|
||||
values: string[] | null
|
||||
): Array<string | CatchInformationItem> {
|
||||
private parseCatchInformation(values: string[] | null): Array<string | CatchInformationItem> {
|
||||
if (!values) return [];
|
||||
return values.map((value) => {
|
||||
const trimmed = value.trim();
|
||||
|
||||
@@ -84,9 +84,7 @@ export async function setPokedexDexScopes(
|
||||
}
|
||||
}
|
||||
|
||||
export async function listGameDexes(
|
||||
supabase: SupabaseClient
|
||||
): Promise<{
|
||||
export async function listGameDexes(supabase: SupabaseClient): Promise<{
|
||||
gameDexes: Record<string, GameDexRow[]>;
|
||||
gameOrder: string[];
|
||||
games: { displayName: string; releaseYear: number }[];
|
||||
|
||||
@@ -24,62 +24,62 @@ type RegionalDexKey =
|
||||
|
||||
const gameToRegionalDexMap: Record<string, RegionalDexKey> = {
|
||||
// Kanto region
|
||||
'Red': 'kanto',
|
||||
'Blue': 'kanto',
|
||||
'Yellow': 'kanto',
|
||||
'FireRed': 'kanto',
|
||||
'LeafGreen': 'kanto',
|
||||
Red: 'kanto',
|
||||
Blue: 'kanto',
|
||||
Yellow: 'kanto',
|
||||
FireRed: 'kanto',
|
||||
LeafGreen: 'kanto',
|
||||
'LG: Pikachu': 'kanto',
|
||||
'LG: Eevee': 'kanto',
|
||||
|
||||
// Johto region
|
||||
'Gold': 'johto',
|
||||
'Silver': 'johto',
|
||||
'Crystal': 'johto',
|
||||
'HeartGold': 'johto',
|
||||
'SoulSilver': 'johto',
|
||||
Gold: 'johto',
|
||||
Silver: 'johto',
|
||||
Crystal: 'johto',
|
||||
HeartGold: 'johto',
|
||||
SoulSilver: 'johto',
|
||||
|
||||
// Hoenn region
|
||||
'Ruby': 'hoenn',
|
||||
'Sapphire': 'hoenn',
|
||||
'Emerald': 'hoenn',
|
||||
'OmegaRuby': 'hoenn',
|
||||
'AlphaSapphire': 'hoenn',
|
||||
Ruby: 'hoenn',
|
||||
Sapphire: 'hoenn',
|
||||
Emerald: 'hoenn',
|
||||
OmegaRuby: 'hoenn',
|
||||
AlphaSapphire: 'hoenn',
|
||||
|
||||
// Sinnoh region
|
||||
'Diamond': 'sinnoh',
|
||||
'Pearl': 'sinnoh',
|
||||
'Platinum': 'sinnoh',
|
||||
'BrilliantDiamond': 'sinnoh',
|
||||
'ShiningPearl': 'sinnoh',
|
||||
Diamond: 'sinnoh',
|
||||
Pearl: 'sinnoh',
|
||||
Platinum: 'sinnoh',
|
||||
BrilliantDiamond: 'sinnoh',
|
||||
ShiningPearl: 'sinnoh',
|
||||
|
||||
// Unova region
|
||||
'Black': 'unova_bw',
|
||||
'White': 'unova_bw',
|
||||
'Black2': 'unova_b2w2',
|
||||
'White2': 'unova_b2w2',
|
||||
Black: 'unova_bw',
|
||||
White: 'unova_bw',
|
||||
Black2: 'unova_b2w2',
|
||||
White2: 'unova_b2w2',
|
||||
|
||||
// Kalos region - Note: All XY use all three sub-dexes
|
||||
// We default to Central for simplicity
|
||||
'X': 'kalos_central',
|
||||
'Y': 'kalos_central',
|
||||
X: 'kalos_central',
|
||||
Y: 'kalos_central',
|
||||
|
||||
// Alola region
|
||||
'Sun': 'alola_sm',
|
||||
'Moon': 'alola_sm',
|
||||
'UltraSun': 'alola_usum',
|
||||
'UltraMoon': 'alola_usum',
|
||||
Sun: 'alola_sm',
|
||||
Moon: 'alola_sm',
|
||||
UltraSun: 'alola_usum',
|
||||
UltraMoon: 'alola_usum',
|
||||
|
||||
// Galar region
|
||||
'Sword': 'galar',
|
||||
'Shield': 'galar',
|
||||
Sword: 'galar',
|
||||
Shield: 'galar',
|
||||
|
||||
// Hisui region
|
||||
'LegendsArceus': 'hisui',
|
||||
LegendsArceus: 'hisui',
|
||||
|
||||
// Paldea region
|
||||
'Scarlet': 'paldea',
|
||||
'Violet': 'paldea'
|
||||
Scarlet: 'paldea',
|
||||
Violet: 'paldea'
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -119,22 +119,22 @@ export function getRegionalDexFieldName(gameName: string): string | undefined {
|
||||
|
||||
// Map regional key to actual PokedexEntry field name (camelCase)
|
||||
const fieldMap: Record<string, string> = {
|
||||
'kanto': 'kantoDexNumber',
|
||||
'johto': 'johtoDexNumber',
|
||||
'hoenn': 'hoennDexNumber',
|
||||
'sinnoh': 'sinnohDexNumber',
|
||||
'unova_bw': 'unovaBwDexNumber',
|
||||
'unova_b2w2': 'unovaB2w2DexNumber',
|
||||
'kalos_central': 'kalosCentralDexNumber',
|
||||
'kalos_coastal': 'kalosCoastalDexNumber',
|
||||
'kalos_mountain': 'kalosMountainDexNumber',
|
||||
'alola_sm': 'alolaSmDexNumber',
|
||||
'alola_usum': 'alolaUsumDexNumber',
|
||||
'galar': 'galarDexNumber',
|
||||
'galar_isle_of_armor': 'galarIsleOfArmorDexNumber',
|
||||
'galar_crown_tundra': 'galarCrownTundraDexNumber',
|
||||
'hisui': 'hisuiDexNumber',
|
||||
'paldea': 'paldeaDexNumber'
|
||||
kanto: 'kantoDexNumber',
|
||||
johto: 'johtoDexNumber',
|
||||
hoenn: 'hoennDexNumber',
|
||||
sinnoh: 'sinnohDexNumber',
|
||||
unova_bw: 'unovaBwDexNumber',
|
||||
unova_b2w2: 'unovaB2w2DexNumber',
|
||||
kalos_central: 'kalosCentralDexNumber',
|
||||
kalos_coastal: 'kalosCoastalDexNumber',
|
||||
kalos_mountain: 'kalosMountainDexNumber',
|
||||
alola_sm: 'alolaSmDexNumber',
|
||||
alola_usum: 'alolaUsumDexNumber',
|
||||
galar: 'galarDexNumber',
|
||||
galar_isle_of_armor: 'galarIsleOfArmorDexNumber',
|
||||
galar_crown_tundra: 'galarCrownTundraDexNumber',
|
||||
hisui: 'hisuiDexNumber',
|
||||
paldea: 'paldeaDexNumber'
|
||||
};
|
||||
|
||||
return fieldMap[regionalKey];
|
||||
|
||||
@@ -47,7 +47,9 @@ export const PUT = async (event: RequestEvent) => {
|
||||
.eq('userId', userId)
|
||||
.is('pokedexId', null)
|
||||
.eq('provider', provider)
|
||||
.select('id, provider, enabled, fileName, folderId, path, metadata, lastExportedAt, lastError')
|
||||
.select(
|
||||
'id, provider, enabled, fileName, folderId, path, metadata, lastExportedAt, lastError'
|
||||
)
|
||||
.maybeSingle();
|
||||
|
||||
if (error) {
|
||||
|
||||
@@ -31,9 +31,7 @@ export const GET = async (event: RequestEvent) => {
|
||||
|
||||
const repo = new CatchRecordRepository(event.locals.supabase, userId, pokedexId);
|
||||
const catchData = await repo.findAll();
|
||||
const sortedData = catchData.sort(
|
||||
(a, b) => Number(a.pokemonId) - Number(b.pokemonId)
|
||||
);
|
||||
const sortedData = catchData.sort((a, b) => Number(a.pokemonId) - Number(b.pokemonId));
|
||||
return json(sortedData);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
@@ -159,10 +157,7 @@ export const POST = async (event: RequestEvent) => {
|
||||
try {
|
||||
await exportPokedexIfConfigured(event.locals.supabase, userId, pokedexId);
|
||||
} catch (exportError) {
|
||||
console.error(
|
||||
'Failed to export pokedex after per-record catch updates:',
|
||||
exportError
|
||||
);
|
||||
console.error('Failed to export pokedex after per-record catch updates:', exportError);
|
||||
}
|
||||
return json(insertedRecords);
|
||||
}
|
||||
|
||||
@@ -204,11 +204,7 @@
|
||||
</h3>
|
||||
<PokedexForm bind:pokedex={formData} {mode} onSubmit={handleSubmit} onCancel={closeModal} />
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="modal-backdrop"
|
||||
aria-label="Close modal"
|
||||
on:click={closeModal}
|
||||
<button type="button" class="modal-backdrop" aria-label="Close modal" on:click={closeModal}
|
||||
></button>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user