Fix EditPartyModal confirmation on new teams
EditPartyModal was popping a confirmation alert on teams that had no data in them when exiting details
This commit is contained in:
parent
665a528047
commit
a56308f101
1 changed files with 15 additions and 4 deletions
|
|
@ -12,6 +12,7 @@ import DialogFooter from '~components/common/DialogFooter'
|
||||||
import DialogContent from '~components/common/DialogContent'
|
import DialogContent from '~components/common/DialogContent'
|
||||||
import Button from '~components/common/Button'
|
import Button from '~components/common/Button'
|
||||||
import DurationInput from '~components/common/DurationInput'
|
import DurationInput from '~components/common/DurationInput'
|
||||||
|
import Input from '~components/common/Input'
|
||||||
import InputTableField from '~components/common/InputTableField'
|
import InputTableField from '~components/common/InputTableField'
|
||||||
import RaidCombobox from '~components/raids/RaidCombobox'
|
import RaidCombobox from '~components/raids/RaidCombobox'
|
||||||
import SegmentedControl from '~components/common/SegmentedControl'
|
import SegmentedControl from '~components/common/SegmentedControl'
|
||||||
|
|
@ -20,6 +21,7 @@ import SwitchTableField from '~components/common/SwitchTableField'
|
||||||
import TableField from '~components/common/TableField'
|
import TableField from '~components/common/TableField'
|
||||||
import Textarea from '~components/common/Textarea'
|
import Textarea from '~components/common/Textarea'
|
||||||
|
|
||||||
|
import capitalizeFirstLetter from '~utils/capitalizeFirstLetter'
|
||||||
import type { DetailsObject } from 'types'
|
import type { DetailsObject } from 'types'
|
||||||
import type { DialogProps } from '@radix-ui/react-dialog'
|
import type { DialogProps } from '@radix-ui/react-dialog'
|
||||||
|
|
||||||
|
|
@ -27,7 +29,6 @@ import { appState } from '~utils/appState'
|
||||||
|
|
||||||
import CheckIcon from '~public/icons/Check.svg'
|
import CheckIcon from '~public/icons/Check.svg'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import Input from '~components/common/Input'
|
|
||||||
|
|
||||||
interface Props extends DialogProps {
|
interface Props extends DialogProps {
|
||||||
open: boolean
|
open: boolean
|
||||||
|
|
@ -286,8 +287,13 @@ const EditPartyModal = ({
|
||||||
|
|
||||||
// Methods: Modification checking
|
// Methods: Modification checking
|
||||||
function hasBeenModified() {
|
function hasBeenModified() {
|
||||||
const nameChanged = name !== party.name
|
const nameChanged =
|
||||||
const descriptionChanged = description !== party.description
|
name !== party.name && !(name === '' && party.name === undefined)
|
||||||
|
|
||||||
|
const descriptionChanged =
|
||||||
|
description !== party.description &&
|
||||||
|
!(description === '' && party.description === undefined)
|
||||||
|
|
||||||
const raidChanged = raid !== party.raid
|
const raidChanged = raid !== party.raid
|
||||||
const chargeAttackChanged = chargeAttack !== party.chargeAttack
|
const chargeAttackChanged = chargeAttack !== party.chargeAttack
|
||||||
const fullAutoChanged = fullAuto !== party.fullAuto
|
const fullAutoChanged = fullAuto !== party.fullAuto
|
||||||
|
|
@ -357,7 +363,12 @@ const EditPartyModal = ({
|
||||||
<span>
|
<span>
|
||||||
<Trans i18nKey="alerts.unsaved_changes.party">
|
<Trans i18nKey="alerts.unsaved_changes.party">
|
||||||
You will lose all changes to your party{' '}
|
You will lose all changes to your party{' '}
|
||||||
<strong>{{ objectName: party.name }}</strong> if you continue.
|
<strong>
|
||||||
|
{{
|
||||||
|
objectName: name || capitalizeFirstLetter(t('untitled')),
|
||||||
|
}}
|
||||||
|
</strong>{' '}
|
||||||
|
if you continue.
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
Are you sure you want to continue without saving?
|
Are you sure you want to continue without saving?
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue