From 56524d847a70f56d00da825ae04e13afc4f3cf54 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Mon, 2 Jan 2023 21:29:13 -0800 Subject: [PATCH 1/5] Reset conflict modal after close --- components/WeaponConflictModal/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/components/WeaponConflictModal/index.tsx b/components/WeaponConflictModal/index.tsx index 84bd3541..5ace6a00 100644 --- a/components/WeaponConflictModal/index.tsx +++ b/components/WeaponConflictModal/index.tsx @@ -43,6 +43,7 @@ const WeaponConflictModal = (props: Props) => { function close() { setOpen(false) + props.resetConflict() } const infoString = () => { From 9d5d67601c5c0b615615c3082508ac89df5634db Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Mon, 2 Jan 2023 21:31:18 -0800 Subject: [PATCH 2/5] Use Dialog in ConflictModals --- components/CharacterConflictModal/index.tsx | 83 ++++++++++----------- components/WeaponConflictModal/index.tsx | 76 +++++++++---------- 2 files changed, 79 insertions(+), 80 deletions(-) diff --git a/components/CharacterConflictModal/index.tsx b/components/CharacterConflictModal/index.tsx index 6493b215..f6ab100f 100644 --- a/components/CharacterConflictModal/index.tsx +++ b/components/CharacterConflictModal/index.tsx @@ -2,12 +2,12 @@ import React, { useEffect, useState } from 'react' import { useRouter } from 'next/router' import { Trans, useTranslation } from 'next-i18next' -import * as Dialog from '@radix-ui/react-dialog' +import { Dialog, DialogContent } from '~components/Dialog' +import Button from '~components/Button' +import Overlay from '~components/Overlay' import { appState } from '~utils/appState' -import Button from '~components/Button' - import './index.scss' interface Props { @@ -68,49 +68,48 @@ const CharacterConflictModal = (props: Props) => { } return ( - - - event.preventDefault()} - > -

- -

-
-
    - {props.conflictingCharacters?.map((character, i) => ( -
  • - {character.object.name[locale]} - {character.object.name[locale]} -
  • - ))} -
- -
-
+ + event.preventDefault()} + onEscapeKeyDown={close} + > +

+ +

+
+
    + {props.conflictingCharacters?.map((character, i) => ( +
  • {props.incomingCharacter?.name[locale]} - {props.incomingCharacter?.name[locale]} -
+ {character.object.name[locale]} + + ))} + + +
+
+ {props.incomingCharacter?.name[locale]} + {props.incomingCharacter?.name[locale]}
-
-
- - - - +
+
+
+ + + ) } diff --git a/components/WeaponConflictModal/index.tsx b/components/WeaponConflictModal/index.tsx index 5ace6a00..ce7b6620 100644 --- a/components/WeaponConflictModal/index.tsx +++ b/components/WeaponConflictModal/index.tsx @@ -2,8 +2,9 @@ import React, { useEffect, useState } from 'react' import { useRouter } from 'next/router' import { Trans, useTranslation } from 'react-i18next' -import * as Dialog from '@radix-ui/react-dialog' +import { Dialog, DialogContent } from '~components/Dialog' import Button from '~components/Button' +import Overlay from '~components/Overlay' import mapWeaponSeries from '~utils/mapWeaponSeries' @@ -62,47 +63,46 @@ const WeaponConflictModal = (props: Props) => { } return ( - - - event.preventDefault()} - > -

{infoString()}

-
-
    - {props.conflictingWeapons?.map((weapon, i) => ( -
  • - {weapon.object.name[locale]} - {weapon.object.name[locale]} -
  • - ))} -
- -
-
+ + event.preventDefault()} + onEscapeKeyDown={close} + > +

{infoString()}

+
+
    + {props.conflictingWeapons?.map((weapon, i) => ( +
  • {props.incomingWeapon?.name[locale]} - {props.incomingWeapon?.name[locale]} -
+ {weapon.object.name[locale]} + + ))} + + +
+
+ {props.incomingWeapon?.name[locale]} + {props.incomingWeapon?.name[locale]}
-
-
- - - - +
+
+
+ + + ) } From eac805106a357d1375c1e1d90ff0a543618fffa2 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Mon, 2 Jan 2023 21:40:27 -0800 Subject: [PATCH 3/5] Fix AX references --- components/WeaponHovercard/index.tsx | 6 +++--- components/WeaponModal/index.tsx | 8 ++++---- components/WeaponUnit/index.tsx | 8 ++++---- types/Weapon.d.ts | 3 ++- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/components/WeaponHovercard/index.tsx b/components/WeaponHovercard/index.tsx index db7f002a..fa9afe3b 100644 --- a/components/WeaponHovercard/index.tsx +++ b/components/WeaponHovercard/index.tsx @@ -80,7 +80,7 @@ const WeaponHovercard = (props: Props) => { } const createPrimaryAxSkillString = () => { - const primaryAxSkills = axData[props.gridWeapon.object.ax - 1] + const primaryAxSkills = axData[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 - 1] + const primaryAxSkills = axData[props.gridWeapon.object.ax_type - 1] if (props.gridWeapon.ax) { const primarySimpleAxSkill = props.gridWeapon.ax[0] @@ -230,7 +230,7 @@ const WeaponHovercard = (props: Props) => {
- {props.gridWeapon.object.ax > 0 && + {props.gridWeapon.object.ax && props.gridWeapon.ax && props.gridWeapon.ax[0].modifier && props.gridWeapon.ax[0].strength diff --git a/components/WeaponModal/index.tsx b/components/WeaponModal/index.tsx index 8fb178ae..cb88311f 100644 --- a/components/WeaponModal/index.tsx +++ b/components/WeaponModal/index.tsx @@ -148,7 +148,7 @@ const WeaponModal = (props: Props) => { if (props.gridWeapon.object.series == 17 && weaponKey3Id) object.weapon.weapon_key3_id = weaponKey3Id - if (props.gridWeapon.object.ax > 0) { + if (props.gridWeapon.object.ax && props.gridWeapon.object.ax_type > 0) { object.weapon.ax_modifier1 = primaryAxModifier object.weapon.ax_modifier2 = secondaryAxModifier object.weapon.ax_strength1 = primaryAxValue @@ -287,7 +287,7 @@ const WeaponModal = (props: Props) => {

{t('modals.weapon.subtitles.ax_skills')}

{ } function openChange(open: boolean) { - if (props.gridWeapon.object.ax > 0 || props.gridWeapon.object.awakening) { + if (props.gridWeapon.object.ax || props.gridWeapon.object.awakening) { setFormValid(false) } else { setFormValid(true) @@ -369,7 +369,7 @@ const WeaponModal = (props: Props) => { {[2, 3, 17, 24].includes(props.gridWeapon.object.series) ? keySelect() : ''} - {props.gridWeapon.object.ax > 0 ? axSelect() : ''} + {props.gridWeapon.object.ax ? axSelect() : ''} {props.gridWeapon.awakening ? awakeningSelect() : ''}