Small syntax updates

This commit is contained in:
Justin Edmund 2022-02-23 02:35:49 -08:00
parent bc93565dc5
commit b284bf1f81
2 changed files with 9 additions and 6 deletions

View file

@ -47,16 +47,18 @@ const WeaponGrid = (props: Props) => {
useEffect(() => {
const shortcode = (props.slug) ? props.slug : slug
if (shortcode) fetchGrid(shortcode)
else {
state.party.editable = true
}
else state.party.editable = true
}, [slug, props.slug])
// Initialize an array of current uncap values for each weapon
useEffect(() => {
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)
setPreviousUncapValues(initialPreviousUncapValues)
}, [state.grid.weapons.mainWeapon, state.grid.weapons.allWeapons])
@ -113,7 +115,8 @@ const WeaponGrid = (props: Props) => {
}
})
}
// Methods: Adding an object from search
function receiveWeaponFromSearch(object: Character | Weapon | Summon, position: number) {
const weapon = object as Weapon
if (position == 1)

View file

@ -1,11 +1,11 @@
import React, { useEffect, useState } from 'react'
import classnames from 'classnames'
import SearchModal from '~components/SearchModal'
import UncapIndicator from '~components/UncapIndicator'
import PlusIcon from '~public/icons/Add.svg'
import './index.scss'
import SearchModal from '~components/SearchModal'
interface Props {
gridWeapon: GridWeapon | undefined