Use a Toast to inform the user about the email that will be sent
All checks were successful
Add copyright notice / copyright_notice (pull_request) Successful in 1m3s
Check usage of free licenses / build-static-assets (pull_request) Successful in 2m2s
Build Nginx-based docker image / build-static-assets (push) Successful in 4m31s
Playwright Tests / test (pull_request) Successful in 11m42s

This commit is contained in:
Manuel Bustillo 2025-07-08 19:37:01 +02:00
parent 8f5c038f9c
commit fba75025d4

View File

@ -11,6 +11,7 @@ import { LinkIcon, TrashIcon } from "@heroicons/react/24/outline";
import { useEffect, useRef } from "react"; import { useEffect, useRef } from "react";
import { useState } from "react"; import { useState } from "react";
import { classNames } from "../components/button"; import { classNames } from "../components/button";
import { Toast } from "primereact/toast";
function InvitationCard({ invitation, allGuests, onGuestAdded, onDestroy }: { function InvitationCard({ invitation, allGuests, onGuestAdded, onDestroy }: {
invitation: Invitation, invitation: Invitation,
@ -117,6 +118,7 @@ export default function InvitationsBoard({ guests, invitations: originalInvitati
guests: Array<Guest>, guests: Array<Guest>,
invitations: Array<Invitation> invitations: Array<Invitation>
}) { }) {
const toast = useRef<Toast>(null);
const api = new AbstractApi<Invitation>(); const api = new AbstractApi<Invitation>();
const serializer = new InvitationSerializer(); const serializer = new InvitationSerializer();
@ -147,13 +149,18 @@ export default function InvitationsBoard({ guests, invitations: originalInvitati
function handleDownloadQrCodes() { function handleDownloadQrCodes() {
api.post(serializer, 'email', () => { api.post(serializer, 'email', () => {
console.log("Email scheduled to be sent with QR codes."); toast.current?.show({
severity: 'success',
summary: 'Email scheduled',
detail: 'A document with the QR codes will be sent to the organizer\'s email.'
});
}) })
} }
return ( return (
<div className="flex h-screen"> <div className="flex h-screen">
{/* Left Column: Guests */} {/* Left Column: Guests */}
<Toast ref={toast} />
<div className="w-1/4 h-full overflow-auto border-r border-gray-300 p-4"> <div className="w-1/4 h-full overflow-auto border-r border-gray-300 p-4">
<h2 className="text-lg font-semibold mb-4">{unassignedGuests.length} guests without invitation</h2> <h2 className="text-lg font-semibold mb-4">{unassignedGuests.length} guests without invitation</h2>
<div> <div>