From fae08fb4656e2b6ec51a5fe68165f0c299aa2dbf Mon Sep 17 00:00:00 2001 From: Marte Fossum <myf@uio.no> Date: Mon, 16 Jan 2023 09:13:18 +0100 Subject: [PATCH] GREG-307: Show that new invitation is sent --- frontend/public/locales/en/common.json | 1 + frontend/public/locales/nb/common.json | 1 + frontend/public/locales/nn/common.json | 1 + .../src/routes/sponsor/guest/guestInfo/index.tsx | 16 +++++++++++++++- 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/frontend/public/locales/en/common.json b/frontend/public/locales/en/common.json index e05cd659..4e91d322 100644 --- a/frontend/public/locales/en/common.json +++ b/frontend/public/locales/en/common.json @@ -55,6 +55,7 @@ "roleInfoHead": "Roles and periods", "roleInfoTableText": "Guest roles", "roleInfoBody": "You can only change roles connected to units that you have given.", + "newEmailSent": "New invitation sent", "verifier": "Verified by", "verified": "Verified", "source": "Source", diff --git a/frontend/public/locales/nb/common.json b/frontend/public/locales/nb/common.json index 8db7af58..1d5d547c 100644 --- a/frontend/public/locales/nb/common.json +++ b/frontend/public/locales/nb/common.json @@ -55,6 +55,7 @@ "roleInfoHead": "Roller og perioder", "roleInfoBody": "Du kan endre på tidsperioden, men kun på gjesteroller tilknyttet enheter du er vert for.", "roleInfoTableText": "Gjesteroller", + "newEmailSent": "Ny invitasjon sendt", "verifier": "Godkjent av", "verified": "Godkjent", "source": "Kilde", diff --git a/frontend/public/locales/nn/common.json b/frontend/public/locales/nn/common.json index 12ff6ef2..1122d460 100644 --- a/frontend/public/locales/nn/common.json +++ b/frontend/public/locales/nn/common.json @@ -55,6 +55,7 @@ "roleInfoTableText": "Gjesteroller", "roleInfoHead": "Roller og periodar", "roleInfoBody": "Du kan endre på tidsperioden, men berre på gjesteroller knytta til eininger du er vert for.", + "newEmailSent": "Ny invitasjon sendt", "verifier": "Godkjend av", "verified": "Godkjend", "source": "Kjelde", diff --git a/frontend/src/routes/sponsor/guest/guestInfo/index.tsx b/frontend/src/routes/sponsor/guest/guestInfo/index.tsx index 09af6847..18d304c1 100644 --- a/frontend/src/routes/sponsor/guest/guestInfo/index.tsx +++ b/frontend/src/routes/sponsor/guest/guestInfo/index.tsx @@ -98,6 +98,7 @@ export default function GuestInfo({ const [t] = useTranslation(['common']) const navigate = useNavigate() const [confirmCancelDialogOpen, setConfirmCancelDialogOpen] = useState(false) + const [showEmailSent, setShowEmailSent] = useState<Boolean>(false) const [emailUpdateError, setEmailUpdateError] = useState<ServerErrorReportData>() const [updateOKMsg, setUpdateOKMsg] = useState<string>('') @@ -221,6 +222,11 @@ export default function GuestInfo({ } } + const handleClick = () => { + resend() + setShowEmailSent(true) + } + useEffect(() => { reset({ email: guest.email }) // Forces defaultValue to be set to the new value, making the form not dirty setValue('email', guest.email) @@ -256,6 +262,14 @@ export default function GuestInfo({ {t(updateOKMsg)} </Alert> )} + {showEmailSent && ( + <Alert + severity="success" + sx={{ fontSize: '1rem', marginBottom: '1rem' }} + > + {t('guestInfo.newEmailSent')} + </Alert> + )} <TableContainer> <Table sx={{ minWidth: 650 }} aria-label="simple table"> <TableHead> @@ -304,7 +318,7 @@ export default function GuestInfo({ marginTop: '0.5rem', }} > - <Button color="secondary" onClick={resend}> + <Button color="secondary" onClick={handleClick}> {t('button.resendInvitation')} </Button> <Button -- GitLab