Move various files from /utils to /data
This commit is contained in:
parent
1179e4936c
commit
5b6c6b4521
21 changed files with 30 additions and 28 deletions
|
|
@ -8,8 +8,8 @@ import SelectItem from '~components/SelectItem'
|
|||
|
||||
import classNames from 'classnames'
|
||||
|
||||
import { weaponAwakening, characterAwakening } from '~utils/awakening'
|
||||
import type { Awakening } from '~utils/awakening'
|
||||
import { weaponAwakening, characterAwakening } from '~data/awakening'
|
||||
import type { Awakening } from '~data/awakening'
|
||||
|
||||
import './index.scss'
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import SelectItem from '~components/SelectItem'
|
|||
|
||||
import classNames from 'classnames'
|
||||
|
||||
import { axData } from '~utils/axData'
|
||||
import ax from '~data/ax'
|
||||
|
||||
import './index.scss'
|
||||
|
||||
|
|
@ -155,7 +155,7 @@ const AXSelect = (props: Props) => {
|
|||
|
||||
if (props.currentSkills[0].modifier > -1 && primaryAxValueInput.current) {
|
||||
const modifier = props.currentSkills[0].modifier
|
||||
const axSkill = axData[props.axType - 1][modifier]
|
||||
const axSkill = ax[props.axType - 1][modifier]
|
||||
setupInput(axSkill, primaryAxValueInput.current)
|
||||
}
|
||||
}
|
||||
|
|
@ -169,7 +169,7 @@ const AXSelect = (props: Props) => {
|
|||
props.currentSkills[1].modifier != null
|
||||
) {
|
||||
const firstSkill = props.currentSkills[0]
|
||||
const primaryAxSkill = axData[props.axType - 1][firstSkill.modifier]
|
||||
const primaryAxSkill = ax[props.axType - 1][firstSkill.modifier]
|
||||
const secondaryAxSkill = findSecondaryAxSkill(
|
||||
primaryAxSkill,
|
||||
props.currentSkills[1]
|
||||
|
|
@ -185,7 +185,7 @@ const AXSelect = (props: Props) => {
|
|||
}
|
||||
|
||||
function findSecondaryAxSkill(
|
||||
axSkill: AxSkill | undefined,
|
||||
axSkill: ItemSkill | undefined,
|
||||
skillAtIndex: SimpleAxSkill
|
||||
) {
|
||||
if (axSkill)
|
||||
|
|
@ -213,7 +213,7 @@ const AXSelect = (props: Props) => {
|
|||
}
|
||||
|
||||
function generateOptions(modifierSet: number) {
|
||||
const axOptions = axData[props.axType - 1]
|
||||
const axOptions = ax[props.axType - 1]
|
||||
|
||||
let axOptionElements: React.ReactNode[] = []
|
||||
if (modifierSet == 0) {
|
||||
|
|
@ -264,7 +264,7 @@ const AXSelect = (props: Props) => {
|
|||
secondaryAxModifierSelect.current &&
|
||||
secondaryAxValueInput.current
|
||||
) {
|
||||
setupInput(axData[props.axType - 1][value], primaryAxValueInput.current)
|
||||
setupInput(ax[props.axType - 1][value], primaryAxValueInput.current)
|
||||
setPrimaryAxValue(0)
|
||||
primaryAxValueInput.current.value = ''
|
||||
|
||||
|
|
@ -280,7 +280,7 @@ const AXSelect = (props: Props) => {
|
|||
const value = parseInt(rawValue)
|
||||
setSecondaryAxModifier(value)
|
||||
|
||||
const primaryAxSkill = axData[props.axType - 1][primaryAxModifier]
|
||||
const primaryAxSkill = ax[props.axType - 1][primaryAxModifier]
|
||||
const currentAxSkill = primaryAxSkill.secondary
|
||||
? primaryAxSkill.secondary.find((skill) => skill.id == value)
|
||||
: undefined
|
||||
|
|
@ -304,7 +304,7 @@ const AXSelect = (props: Props) => {
|
|||
}
|
||||
|
||||
function handlePrimaryErrors(value: number) {
|
||||
const primaryAxSkill = axData[props.axType - 1][primaryAxModifier]
|
||||
const primaryAxSkill = ax[props.axType - 1][primaryAxModifier]
|
||||
let newErrors = { ...errors }
|
||||
|
||||
if (value < primaryAxSkill.minValue) {
|
||||
|
|
@ -333,7 +333,7 @@ const AXSelect = (props: Props) => {
|
|||
}
|
||||
|
||||
function handleSecondaryErrors(value: number) {
|
||||
const primaryAxSkill = axData[props.axType - 1][primaryAxModifier]
|
||||
const primaryAxSkill = ax[props.axType - 1][primaryAxModifier]
|
||||
let newErrors = { ...errors }
|
||||
|
||||
if (primaryAxSkill.secondary) {
|
||||
|
|
@ -373,7 +373,7 @@ const AXSelect = (props: Props) => {
|
|||
return newErrors.axValue2.length === 0
|
||||
}
|
||||
|
||||
function setupInput(ax: AxSkill | undefined, element: HTMLInputElement) {
|
||||
function setupInput(ax: ItemSkill | undefined, element: HTMLInputElement) {
|
||||
if (ax) {
|
||||
const rangeString = `${ax.minValue}~${ax.maxValue}${ax.suffix || ''}`
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import SelectItem from '~components/SelectItem'
|
|||
import SelectGroup from '~components/SelectGroup'
|
||||
|
||||
import { appState } from '~utils/appState'
|
||||
import { jobGroups } from '~utils/jobGroups'
|
||||
import { jobGroups } from '~data/jobGroups'
|
||||
|
||||
import './index.scss'
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import React, { useEffect, useState } from 'react'
|
||||
import { useRouter } from 'next/router'
|
||||
import { SkillGroup, skillClassification } from '~utils/skillGroups'
|
||||
import { SkillGroup, skillClassification } from '~data/skillGroups'
|
||||
|
||||
import './index.scss'
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import * as HoverCard from '@radix-ui/react-hover-card'
|
|||
import WeaponLabelIcon from '~components/WeaponLabelIcon'
|
||||
import UncapIndicator from '~components/UncapIndicator'
|
||||
|
||||
import { axData } from '~utils/axData'
|
||||
import ax from '~data/ax'
|
||||
|
||||
import './index.scss'
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ const WeaponHovercard = (props: Props) => {
|
|||
}
|
||||
|
||||
const createPrimaryAxSkillString = () => {
|
||||
const primaryAxSkills = axData[props.gridWeapon.object.ax_type - 1]
|
||||
const primaryAxSkills = ax[props.gridWeapon.object.ax_type - 1]
|
||||
|
||||
if (props.gridWeapon.ax) {
|
||||
const simpleAxSkill = props.gridWeapon.ax[0]
|
||||
|
|
@ -97,7 +97,7 @@ const WeaponHovercard = (props: Props) => {
|
|||
}
|
||||
|
||||
const createSecondaryAxSkillString = () => {
|
||||
const primaryAxSkills = axData[props.gridWeapon.object.ax_type - 1]
|
||||
const primaryAxSkills = ax[props.gridWeapon.object.ax_type - 1]
|
||||
|
||||
if (props.gridWeapon.ax) {
|
||||
const primarySimpleAxSkill = props.gridWeapon.ax[0]
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import {
|
|||
emptyWeaponSeriesState,
|
||||
} from '~utils/emptyStates'
|
||||
import { elements, proficiencies, rarities } from '~utils/stateValues'
|
||||
import { weaponSeries } from '~utils/weaponSeries'
|
||||
import { weaponSeries } from '~data/weaponSeries'
|
||||
|
||||
interface Props {
|
||||
sendFilters: (filters: { [key: string]: number[] }) => void
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ import Button from '~components/Button'
|
|||
|
||||
import type { SearchableObject } from '~types'
|
||||
|
||||
import { axData } from '~utils/axData'
|
||||
import { weaponAwakening } from '~utils/awakening'
|
||||
import ax from '~data/ax'
|
||||
import { weaponAwakening } from '~data/awakening'
|
||||
|
||||
import PlusIcon from '~public/icons/Add.svg'
|
||||
import SettingsIcon from '~public/icons/Settings.svg'
|
||||
|
|
@ -330,7 +330,7 @@ const WeaponUnit = (props: Props) => {
|
|||
props.gridWeapon.object.ax_type > 0 &&
|
||||
props.gridWeapon.ax
|
||||
) {
|
||||
const axOptions = axData[props.gridWeapon.object.ax_type - 1]
|
||||
const axOptions = ax[props.gridWeapon.object.ax_type - 1]
|
||||
const weaponAxSkill: SimpleAxSkill = props.gridWeapon.ax[0]
|
||||
|
||||
let axSkill = axOptions.find((ax) => ax.id === weaponAxSkill.modifier)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
export const axData: AxSkill[][] = [
|
||||
const ax: ItemSkill[][] = [
|
||||
[
|
||||
{
|
||||
name: {
|
||||
|
|
@ -868,3 +868,5 @@ export const axData: AxSkill[][] = [
|
|||
},
|
||||
],
|
||||
]
|
||||
|
||||
export default ax
|
||||
|
|
@ -13,7 +13,7 @@ import setUserToken from '~utils/setUserToken'
|
|||
import extractFilters from '~utils/extractFilters'
|
||||
import organizeRaids from '~utils/organizeRaids'
|
||||
import useDidMountEffect from '~utils/useDidMountEffect'
|
||||
import { elements, allElement } from '~utils/Element'
|
||||
import { elements, allElement } from '~data/elements'
|
||||
import { emptyPaginationObject } from '~utils/emptyStates'
|
||||
|
||||
import GridRep from '~components/GridRep'
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import setUserToken from '~utils/setUserToken'
|
|||
import extractFilters from '~utils/extractFilters'
|
||||
import organizeRaids from '~utils/organizeRaids'
|
||||
import useDidMountEffect from '~utils/useDidMountEffect'
|
||||
import { elements, allElement } from '~utils/Element'
|
||||
import { elements, allElement } from '~data/elements'
|
||||
import { emptyPaginationObject } from '~utils/emptyStates'
|
||||
|
||||
import GridRep from '~components/GridRep'
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import setUserToken from '~utils/setUserToken'
|
|||
import extractFilters from '~utils/extractFilters'
|
||||
import organizeRaids from '~utils/organizeRaids'
|
||||
import useDidMountEffect from '~utils/useDidMountEffect'
|
||||
import { elements, allElement } from '~utils/Element'
|
||||
import { elements, allElement } from '~data/elements'
|
||||
import { emptyPaginationObject } from '~utils/emptyStates'
|
||||
|
||||
import GridRep from '~components/GridRep'
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { elements, allElement } from '~utils/Element'
|
||||
import { elements, allElement } from '~data/elements'
|
||||
|
||||
export default (query: { [index: string]: string }, raids: Raid[]) => {
|
||||
// Extract recency filter
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { weaponKeyGroups } from './weaponKeyGroups'
|
||||
import { weaponKeyGroups } from '../data/weaponKeyGroups'
|
||||
|
||||
export type GroupedWeaponKeys = {
|
||||
[key: string]: WeaponKey[]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { weaponSeries } from '~utils/weaponSeries'
|
||||
import { weaponSeries } from '~data/weaponSeries'
|
||||
|
||||
export default (id: number) =>
|
||||
weaponSeries.find((series) => series.id === id)?.slug
|
||||
|
|
|
|||
Loading…
Reference in a new issue