diff --git a/apps/web/package.json b/apps/web/package.json
index c248634..f592c65 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -5,6 +5,7 @@
"scripts": {
"build": "vite build",
"serve": "vite preview",
+ "dev": "vite dev",
"dev:bare": "vite dev"
},
"dependencies": {
diff --git a/apps/web/src/components/homepage/EventRegistrationForm.tsx b/apps/web/src/components/homepage/EventRegistrationForm.tsx
index 475e08c..18e22d6 100644
--- a/apps/web/src/components/homepage/EventRegistrationForm.tsx
+++ b/apps/web/src/components/homepage/EventRegistrationForm.tsx
@@ -1,6 +1,9 @@
"use client";
+import { useMutation } from "@tanstack/react-query";
import { useState } from "react";
+import { toast } from "sonner";
+import { orpc } from "@/utils/orpc";
export default function EventRegistrationForm() {
const [formData, setFormData] = useState({
@@ -12,9 +15,34 @@ export default function EventRegistrationForm() {
experience: "",
});
+ const submitMutation = useMutation({
+ ...orpc.submitRegistration.mutationOptions(),
+ onSuccess: () => {
+ toast.success("Registratie succesvol!");
+ setFormData({
+ firstName: "",
+ lastName: "",
+ email: "",
+ phone: "",
+ artForm: "",
+ experience: "",
+ });
+ },
+ onError: (error) => {
+ toast.error(`Er is iets misgegaan: ${error.message}`);
+ },
+ });
+
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
- console.log("Form submitted:", formData);
+ submitMutation.mutate({
+ firstName: formData.firstName,
+ lastName: formData.lastName,
+ email: formData.email,
+ phone: formData.phone || undefined,
+ artForm: formData.artForm,
+ experience: formData.experience || undefined,
+ });
};
const handleChange = (
@@ -57,6 +85,7 @@ export default function EventRegistrationForm() {
value={formData.firstName}
onChange={handleChange}
placeholder="Jouw voornaam"
+ required
className="border-white/30 border-b bg-transparent pb-2 font-['Intro',sans-serif] text-lg text-white placeholder:text-white/40 focus:border-white focus:outline-none"
/>
@@ -75,6 +104,7 @@ export default function EventRegistrationForm() {
value={formData.lastName}
onChange={handleChange}
placeholder="Jouw achternaam"
+ required
className="border-white/30 border-b bg-transparent pb-2 font-['Intro',sans-serif] text-lg text-white placeholder:text-white/40 focus:border-white focus:outline-none"
/>
@@ -96,6 +126,7 @@ export default function EventRegistrationForm() {
value={formData.email}
onChange={handleChange}
placeholder="jouw@email.nl"
+ required
className="border-white/30 border-b bg-transparent pb-2 font-['Intro',sans-serif] text-lg text-white placeholder:text-white/40 focus:border-white focus:outline-none"
/>
@@ -134,6 +165,7 @@ export default function EventRegistrationForm() {
value={formData.artForm}
onChange={handleChange}
placeholder="Muziek, Theater, Dans, etc."
+ required
className="border-white/30 border-b bg-transparent pb-2 font-['Intro',sans-serif] text-lg text-white placeholder:text-white/40 focus:border-white focus:outline-none"
/>
@@ -164,9 +196,10 @@ export default function EventRegistrationForm() {
diff --git a/apps/web/src/components/homepage/Footer.tsx b/apps/web/src/components/homepage/Footer.tsx
index 740096e..26ed7ff 100644
--- a/apps/web/src/components/homepage/Footer.tsx
+++ b/apps/web/src/components/homepage/Footer.tsx
@@ -1,4 +1,21 @@
+"use client";
+
+import { Link } from "@tanstack/react-router";
+import { useEffect, useState } from "react";
+import { authClient } from "@/lib/auth-client";
+
export default function Footer() {
+ const [isAdmin, setIsAdmin] = useState(false);
+ const [isLoading, setIsLoading] = useState(true);
+
+ useEffect(() => {
+ authClient.getSession().then((session) => {
+ const user = session.data?.user as { role?: string } | undefined;
+ setIsAdmin(user?.role === "admin");
+ setIsLoading(false);
+ });
+ }, []);
+
return (