diff --git a/bun.lockb b/bun.lockb index 0ca80a2..2608b56 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/components/ChannelGrid.tsx b/components/ChannelGrid.tsx index c5c2901..bf9025d 100644 --- a/components/ChannelGrid.tsx +++ b/components/ChannelGrid.tsx @@ -4,7 +4,7 @@ const DELAYS = shuffle([0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1 export default function ChannelGrid({ channels }: { channels: Channel[] }) { return ( -
+
{channels.map((channel, i) => (
(null); const [isSubmitting, setIsSubmitting] = useState(false); + const [isSuccess, setIsSuccess] = useState(false); async function handleSubmit(event: FormEvent) { event.preventDefault(); if (isSubmitting) return; setIsSubmitting(true); + setIsSuccess(false); const formData = new FormData(event.currentTarget); const response = await fetch(API_URL, { @@ -30,6 +53,7 @@ export default function Form() { if (response.status === 200) { setMessage('✅ Kutsu lähetetty antamaasi sähköpostiosoitteeseen.'); + setIsSuccess(true); return; } @@ -79,7 +103,7 @@ export default function Form() { @@ -129,9 +153,22 @@ export default function Form() { )} {message && ( -
- {message} -
+ <> +
+ {message} +
+ {isSuccess && ( + + )} + )}
); diff --git a/package.json b/package.json index 53a69b7..f244caa 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "lodash.shuffle": "^4.2.0", "next": "14.2.3", "react": "^18", + "react-confetti": "^6.1.0", "react-dom": "^18" }, "devDependencies": {