fix: update CharacterRep and SummonRep to use correct adapter field names and shared image utilities
This commit is contained in:
parent
713886a290
commit
eace0530fa
3 changed files with 9 additions and 9 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue