diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/EditContactAddressModal/EditContactAddressModal.test.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/EditContactAddressModal/EditContactAddressModal.test.tsx index 1ff480dc6..0bcaf3c43 100644 --- a/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/EditContactAddressModal/EditContactAddressModal.test.tsx +++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/EditContactAddressModal/EditContactAddressModal.test.tsx @@ -43,6 +43,7 @@ const mockContact: ContactMailingFragment = { historic: true, street: '123 Cool Street', primaryMailingAddress: false, + source: 'MPDX', }, ], }, diff --git a/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/EditContactAddressModal/EditContactAddressModal.tsx b/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/EditContactAddressModal/EditContactAddressModal.tsx index fe589065a..698a5d6bf 100644 --- a/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/EditContactAddressModal/EditContactAddressModal.tsx +++ b/src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/EditContactAddressModal/EditContactAddressModal.tsx @@ -65,6 +65,8 @@ const LoadingIndicator = styled(CircularProgress)(({ theme }) => ({ margin: theme.spacing(0, 1, 0, 0), })); +export const editableSources = ['MPDX', 'manual', 'TntImport']; + interface EditContactAddressModalProps { accountListId: string; address: ContactMailingFragment['addresses']['nodes'][0]; @@ -169,8 +171,7 @@ export const EditContactAddressModal: React.FC< handleClose(); }; - const editingDisabled = - address.source === 'Siebel' || address.source === 'DataServer'; + const editingDisabled = editableSources.indexOf(address.source) === -1; const { data: emailData } = useDonationServicesEmailQuery({ variables: { accountListId, diff --git a/src/components/Tool/FixMailingAddresses/Contact.tsx b/src/components/Tool/FixMailingAddresses/Contact.tsx index e8fe8db7a..9b57119a5 100644 --- a/src/components/Tool/FixMailingAddresses/Contact.tsx +++ b/src/components/Tool/FixMailingAddresses/Contact.tsx @@ -20,6 +20,7 @@ import clsx from 'clsx'; import { DateTime } from 'luxon'; import { useTranslation } from 'react-i18next'; import { makeStyles } from 'tss-react/mui'; +import { editableSources } from 'src/components/Contacts/ContactDetails/ContactDetailsTab/Mailing/EditContactAddressModal/EditContactAddressModal'; import { AddButton, AddIcon, @@ -105,6 +106,7 @@ interface Props { name: string; status: string; addresses: ContactAddressFragment[]; + appName: string; openEditAddressModal: (address: ContactAddressFragment, id: string) => void; openNewAddressModal: (address: ContactAddressFragment, id: string) => void; } @@ -114,6 +116,7 @@ const Contact: React.FC = ({ name, status, addresses, + appName, openEditAddressModal, openNewAddressModal, }) => { @@ -219,7 +222,11 @@ const Contact: React.FC = ({ - {address.source === 'MPDX' ? : } + {editableSources.indexOf(address.source) > -1 ? ( + + ) : ( + + )} @@ -233,7 +240,9 @@ const Contact: React.FC = ({ {t('Source')}: - MPDX + + {t('{{appName}}', { appName })} + @@ -243,7 +252,6 @@ const Contact: React.FC = ({ justifyContent="flex-start" className={clsx( classes.responsiveBorder, - classes.paddingX, classes.hoverHighlight, )} > diff --git a/src/components/Tool/FixMailingAddresses/FixMailingAddresses.tsx b/src/components/Tool/FixMailingAddresses/FixMailingAddresses.tsx index 3860e3b3d..6f0b53389 100644 --- a/src/components/Tool/FixMailingAddresses/FixMailingAddresses.tsx +++ b/src/components/Tool/FixMailingAddresses/FixMailingAddresses.tsx @@ -92,9 +92,11 @@ const useStyles = makeStyles()(() => ({ }, })); +const appName = process.env.APP_NAME || 'MPDX'; + export const emptyAddress: ContactAddressFragment = { id: 'new', - source: 'MPDX', + source: appName, street: '', region: '', location: '', @@ -114,7 +116,7 @@ enum ModalEnum { Edit = 'Edit', } -const sourceOptions = ['MPDX', 'DataServer']; +const sourceOptions = [appName, 'DataServer']; const FixSendNewsletter: React.FC = ({ accountListId }: Props) => { const { classes } = useStyles(); @@ -123,7 +125,7 @@ const FixSendNewsletter: React.FC = ({ accountListId }: Props) => { const [showNewAddressModal, setShowNewAddressModal] = useState(false); const [selectedAddress, setSelectedAddress] = useState(emptyAddress); const [selectedContactId, setSelectedContactId] = useState(''); - const [defaultSource, setDefaultSource] = useState('MPDX'); + const [defaultSource, setDefaultSource] = useState(appName); const { data, loading } = useInvalidAddressesQuery({ variables: { accountListId }, }); @@ -218,10 +220,12 @@ const FixSendNewsletter: React.FC = ({ accountListId }: Props) => { {loading && !data && ( - + + + )} {!loading && data && ( @@ -286,6 +290,7 @@ const FixSendNewsletter: React.FC = ({ accountListId }: Props) => { status={contact.status || ''} key={contact.id} addresses={contact.addresses.nodes} + appName={appName} openEditAddressModal={(address, contactId) => handleModalOpen(ModalEnum.Edit, address, contactId) }