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 {
|
main {
|
||||||
max-width: var(--main-max-width);
|
max-width: var(--main-max-width);
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 0 spacing.$unit-2x;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
transition: max-width 0.3s ease;
|
transition: max-width 0.3s ease;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,8 @@
|
||||||
|
|
||||||
let { party, characters: directCharacters, jobId, element, gender }: Props = $props()
|
let { party, characters: directCharacters, jobId, element, gender }: Props = $props()
|
||||||
|
|
||||||
// Use direct characters if provided, otherwise get from party (note: API returns gridCharacters)
|
// Use direct characters if provided, otherwise get from party
|
||||||
const characters = $derived(directCharacters || party?.gridCharacters || [])
|
const characters = $derived(directCharacters || party?.characters || [])
|
||||||
const grid = $derived(Array.from({ length: 3 }, (_, i) =>
|
const grid = $derived(Array.from({ length: 3 }, (_, i) =>
|
||||||
characters.find((c: GridCharacter) => c?.position === i)
|
characters.find((c: GridCharacter) => c?.position === i)
|
||||||
))
|
))
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
element ? getElementClass(element) :
|
element ? getElementClass(element) :
|
||||||
// Otherwise try to get from party's mainhand weapon
|
// Otherwise try to get from party's mainhand weapon
|
||||||
party ? (() => {
|
party ? (() => {
|
||||||
const main: GridWeapon | undefined = (party.gridWeapons || []).find(
|
const main: GridWeapon | undefined = (party.weapons || []).find(
|
||||||
(w: GridWeapon) => w?.mainhand || w?.position === -1
|
(w: GridWeapon) => w?.mainhand || w?.position === -1
|
||||||
)
|
)
|
||||||
const el = main?.element ?? main?.weapon?.element
|
const el = main?.element ?? main?.weapon?.element
|
||||||
|
|
@ -47,8 +47,9 @@
|
||||||
)
|
)
|
||||||
const el = main?.element ?? main?.weapon?.element ?? 1
|
const el = main?.element ?? main?.weapon?.element ?? 1
|
||||||
suffix = `${suffix}_0${el}`
|
suffix = `${suffix}_0${el}`
|
||||||
|
return `/images/character-main/${id}_${suffix}.jpg`
|
||||||
}
|
}
|
||||||
return `/images/character-main/${id}_${suffix}.jpg`
|
return getCharacterImage(id, suffix, 'main')
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@
|
||||||
|
|
||||||
let { party, summons: directSummons, extendedView = false }: Props = $props()
|
let { party, summons: directSummons, extendedView = false }: Props = $props()
|
||||||
|
|
||||||
// Use direct summons if provided, otherwise get from party (note: API returns gridSummons)
|
// Use direct summons if provided, otherwise get from party
|
||||||
const summons = $derived(directSummons || party?.gridSummons || [])
|
const summons = $derived(directSummons || party?.summons || [])
|
||||||
const main = $derived(summons.find((s: GridSummon) => s?.main || s?.position === -1))
|
const main = $derived(summons.find((s: GridSummon) => s?.main || s?.position === -1))
|
||||||
const friend = $derived(
|
const friend = $derived(
|
||||||
extendedView ? summons.find((s: GridSummon) => s?.friend || s?.position === -2) : undefined
|
extendedView ? summons.find((s: GridSummon) => s?.friend || s?.position === -2) : undefined
|
||||||
|
|
@ -27,8 +27,8 @@
|
||||||
function summonImageUrl(s?: GridSummon, isMain = false): string {
|
function summonImageUrl(s?: GridSummon, isMain = false): string {
|
||||||
const id = s?.summon?.granblueId
|
const id = s?.summon?.granblueId
|
||||||
if (!id) return ''
|
if (!id) return ''
|
||||||
const folder = isMain ? 'summon-main' : 'summon-grid'
|
const size = isMain ? 'main' : 'grid'
|
||||||
return `/images/${folder}/${id}.jpg`
|
return getSummonImage(id, size)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue