From eace0530faeabf4c2e65f387ab31da24eda4e948 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sat, 20 Sep 2025 12:33:08 -0700 Subject: [PATCH] fix: update CharacterRep and SummonRep to use correct adapter field names and shared image utilities --- src/app.scss | 1 - src/lib/components/reps/CharacterRep.svelte | 9 +++++---- src/lib/components/reps/SummonRep.svelte | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/app.scss b/src/app.scss index 4968e36e..3368530d 100644 --- a/src/app.scss +++ b/src/app.scss @@ -35,7 +35,6 @@ ul { main { max-width: var(--main-max-width); margin: 0 auto; - padding: 0 spacing.$unit-2x; width: 100%; transition: max-width 0.3s ease; diff --git a/src/lib/components/reps/CharacterRep.svelte b/src/lib/components/reps/CharacterRep.svelte index 8c31dad2..5a169ff0 100644 --- a/src/lib/components/reps/CharacterRep.svelte +++ b/src/lib/components/reps/CharacterRep.svelte @@ -13,8 +13,8 @@ let { party, characters: directCharacters, jobId, element, gender }: Props = $props() - // Use direct characters if provided, otherwise get from party (note: API returns gridCharacters) - const characters = $derived(directCharacters || party?.gridCharacters || []) + // Use direct characters if provided, otherwise get from party + const characters = $derived(directCharacters || party?.characters || []) const grid = $derived(Array.from({ length: 3 }, (_, i) => characters.find((c: GridCharacter) => c?.position === i) )) @@ -24,7 +24,7 @@ element ? getElementClass(element) : // Otherwise try to get from party's mainhand weapon party ? (() => { - const main: GridWeapon | undefined = (party.gridWeapons || []).find( + const main: GridWeapon | undefined = (party.weapons || []).find( (w: GridWeapon) => w?.mainhand || w?.position === -1 ) const el = main?.element ?? main?.weapon?.element @@ -47,8 +47,9 @@ ) const el = main?.element ?? main?.weapon?.element ?? 1 suffix = `${suffix}_0${el}` + return `/images/character-main/${id}_${suffix}.jpg` } - return `/images/character-main/${id}_${suffix}.jpg` + return getCharacterImage(id, suffix, 'main') } diff --git a/src/lib/components/reps/SummonRep.svelte b/src/lib/components/reps/SummonRep.svelte index 50d6562c..820bef4b 100644 --- a/src/lib/components/reps/SummonRep.svelte +++ b/src/lib/components/reps/SummonRep.svelte @@ -10,8 +10,8 @@ let { party, summons: directSummons, extendedView = false }: Props = $props() - // Use direct summons if provided, otherwise get from party (note: API returns gridSummons) - const summons = $derived(directSummons || party?.gridSummons || []) + // Use direct summons if provided, otherwise get from party + const summons = $derived(directSummons || party?.summons || []) const main = $derived(summons.find((s: GridSummon) => s?.main || s?.position === -1)) const friend = $derived( extendedView ? summons.find((s: GridSummon) => s?.friend || s?.position === -2) : undefined @@ -27,8 +27,8 @@ function summonImageUrl(s?: GridSummon, isMain = false): string { const id = s?.summon?.granblueId if (!id) return '' - const folder = isMain ? 'summon-main' : 'summon-grid' - return `/images/${folder}/${id}.jpg` + const size = isMain ? 'main' : 'grid' + return getSummonImage(id, size) }