Wire up API call to callback for summons

This commit is contained in:
Justin Edmund 2023-01-22 20:54:30 -08:00
parent 4b3fae1fe4
commit 5bb5652aef
3 changed files with 15 additions and 0 deletions

View file

@ -14,6 +14,7 @@ interface Props {
removeSummon: (id: string) => void
updateObject: (object: SearchableObject, position: number) => void
updateUncap: (id: string, position: number, uncap: number) => void
updateTranscendence: (id: string, position: number, stage: number) => void
}
const ExtraSummons = (props: Props) => {
@ -36,6 +37,7 @@ const ExtraSummons = (props: Props) => {
gridSummon={props.grid[props.offset + i]}
updateObject={props.updateObject}
updateUncap={props.updateUncap}
updateTranscendence={props.updateTranscendence}
/>
</li>
)

View file

@ -377,6 +377,7 @@ const SummonGrid = (props: Props) => {
removeSummon={removeSummon}
updateObject={receiveSummonFromSearch}
updateUncap={initiateUncapUpdate}
updateTranscendence={initiateTranscendenceUpdate}
/>
</div>
)
@ -390,8 +391,10 @@ const SummonGrid = (props: Props) => {
key="grid_friend_summon"
position={6}
unitType={2}
removeSummon={removeSummon}
updateObject={receiveSummonFromSearch}
updateUncap={initiateUncapUpdate}
updateTranscendence={initiateTranscendenceUpdate}
/>
</div>
)
@ -411,6 +414,7 @@ const SummonGrid = (props: Props) => {
removeSummon={removeSummon}
updateObject={receiveSummonFromSearch}
updateUncap={initiateUncapUpdate}
updateTranscendence={initiateTranscendenceUpdate}
/>
</li>
)
@ -428,6 +432,7 @@ const SummonGrid = (props: Props) => {
removeSummon={removeSummon}
updateObject={receiveSummonFromSearch}
updateUncap={initiateUncapUpdate}
updateTranscendence={initiateTranscendenceUpdate}
/>
)

View file

@ -29,6 +29,7 @@ interface Props {
removeSummon: (id: string) => void
updateObject: (object: SearchableObject, position: number) => void
updateUncap: (id: string, position: number, uncap: number) => void
updateTranscendence: (id: string, position: number, stage: number) => void
}
const SummonUnit = ({
@ -39,6 +40,7 @@ const SummonUnit = ({
removeSummon: sendSummonToRemove,
updateObject,
updateUncap,
updateTranscendence,
}: Props) => {
// Translations and locale
const { t } = useTranslation('common')
@ -105,6 +107,10 @@ const SummonUnit = ({
if (gridSummon) updateUncap(gridSummon.id, position, uncap)
}
function passTranscendenceData(stage: number) {
if (gridSummon) updateTranscendence(gridSummon.id, position, stage)
}
function removeSummon() {
if (gridSummon) sendSummonToRemove(gridSummon.id)
}
@ -246,8 +252,10 @@ const SummonUnit = ({
xlb={gridSummon.object.uncap.xlb || false}
editable={editable}
uncapLevel={gridSummon.uncap_level}
transcendenceStage={gridSummon.transcendence_step}
position={gridSummon.position}
updateUncap={passUncapData}
updateTranscendence={passTranscendenceData}
special={false}
/>
) : (