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

View file

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

View file

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