0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Added notification to user invitations

refs. https://github.com/TryGhost/Team/issues/3351
This commit is contained in:
Peter Zimon 2023-06-05 17:54:25 +02:00
parent 9aef897936
commit ae6a2ba0cc
2 changed files with 12 additions and 4 deletions

View file

@ -26,7 +26,7 @@ const Toast: React.FC<ToastProps> = ({
children,
props
}) => {
let classNames = `flex w-[300px] items-start justify-between rounded py-3 px-4 text-sm font-medium text-white gap-6`;
let classNames = `flex w-[300px] items-start justify-between rounded py-3 px-4 text-sm font-medium text-white gap-6 z-[90] `;
if (t.visible) {
classNames += ' animate-toaster-in';

View file

@ -6,7 +6,7 @@ import useRoles from '../../../../hooks/useRoles';
import useStaffUsers from '../../../../hooks/useStaffUsers';
import validator from 'validator';
import {ServicesContext} from '../../../providers/ServiceProvider';
import {toast} from 'react-hot-toast';
import {showToast} from '../../../../admin-x-ds/global/Toast';
import {useContext, useEffect, useRef, useState} from 'react';
type RoleType = 'administrator' | 'editor' | 'author' | 'contributor';
@ -44,7 +44,7 @@ const InviteUserModal = NiceModal.create(() => {
} else if (saveState === 'saved') {
okLabel = 'Invite sent!';
} else if (saveState === 'error') {
okLabel = 'Failed to send. Retry?';
okLabel = 'Retry';
}
const handleSendInvitation = async () => {
@ -70,9 +70,17 @@ const InviteUserModal = NiceModal.create(() => {
setSaveState('saved');
toast.success('Invitation sent!');
showToast({
message: `Invitation successfully sent to ${email}`,
type: 'success'
});
} catch (e: any) {
setSaveState('error');
showToast({
message: `Failed to send invitation to ${email}`,
type: 'error'
});
return;
}
};