Small syntax updates
This commit is contained in:
parent
bc93565dc5
commit
b284bf1f81
2 changed files with 9 additions and 6 deletions
|
|
@ -47,16 +47,18 @@ const WeaponGrid = (props: Props) => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const shortcode = (props.slug) ? props.slug : slug
|
const shortcode = (props.slug) ? props.slug : slug
|
||||||
if (shortcode) fetchGrid(shortcode)
|
if (shortcode) fetchGrid(shortcode)
|
||||||
else {
|
else state.party.editable = true
|
||||||
state.party.editable = true
|
|
||||||
}
|
|
||||||
}, [slug, props.slug])
|
}, [slug, props.slug])
|
||||||
|
|
||||||
// Initialize an array of current uncap values for each weapon
|
// Initialize an array of current uncap values for each weapon
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let initialPreviousUncapValues: {[key: number]: number} = {}
|
let initialPreviousUncapValues: {[key: number]: number} = {}
|
||||||
if (state.grid.weapons.mainWeapon) initialPreviousUncapValues[-1] = state.grid.weapons.mainWeapon.uncap_level
|
|
||||||
|
if (state.grid.weapons.mainWeapon)
|
||||||
|
initialPreviousUncapValues[-1] = state.grid.weapons.mainWeapon.uncap_level
|
||||||
|
|
||||||
Object.values(state.grid.weapons.allWeapons).map(o => initialPreviousUncapValues[o.position] = o.uncap_level)
|
Object.values(state.grid.weapons.allWeapons).map(o => initialPreviousUncapValues[o.position] = o.uncap_level)
|
||||||
|
|
||||||
setPreviousUncapValues(initialPreviousUncapValues)
|
setPreviousUncapValues(initialPreviousUncapValues)
|
||||||
}, [state.grid.weapons.mainWeapon, state.grid.weapons.allWeapons])
|
}, [state.grid.weapons.mainWeapon, state.grid.weapons.allWeapons])
|
||||||
|
|
||||||
|
|
@ -114,6 +116,7 @@ const WeaponGrid = (props: Props) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Methods: Adding an object from search
|
||||||
function receiveWeaponFromSearch(object: Character | Weapon | Summon, position: number) {
|
function receiveWeaponFromSearch(object: Character | Weapon | Summon, position: number) {
|
||||||
const weapon = object as Weapon
|
const weapon = object as Weapon
|
||||||
if (position == 1)
|
if (position == 1)
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import React, { useEffect, useState } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
|
|
||||||
|
import SearchModal from '~components/SearchModal'
|
||||||
import UncapIndicator from '~components/UncapIndicator'
|
import UncapIndicator from '~components/UncapIndicator'
|
||||||
import PlusIcon from '~public/icons/Add.svg'
|
import PlusIcon from '~public/icons/Add.svg'
|
||||||
|
|
||||||
import './index.scss'
|
import './index.scss'
|
||||||
import SearchModal from '~components/SearchModal'
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
gridWeapon: GridWeapon | undefined
|
gridWeapon: GridWeapon | undefined
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue