From f282775c9a0361802b79d805d2cc386d211b2210 Mon Sep 17 00:00:00 2001 From: Denis Urs Rudolph Date: Fri, 3 Apr 2026 21:40:12 +0200 Subject: [PATCH] Add payment form and announcement components --- .../app/payments/[registrationId]/page.tsx | 19 +++ frontend/src/components/announcement-form.tsx | 84 ++++++++++++ frontend/src/components/announcement-list.tsx | 69 ++++++++++ frontend/src/components/payment-form.tsx | 120 ++++++++++++++++++ 4 files changed, 292 insertions(+) create mode 100644 frontend/src/app/payments/[registrationId]/page.tsx create mode 100644 frontend/src/components/announcement-form.tsx create mode 100644 frontend/src/components/announcement-list.tsx create mode 100644 frontend/src/components/payment-form.tsx diff --git a/frontend/src/app/payments/[registrationId]/page.tsx b/frontend/src/app/payments/[registrationId]/page.tsx new file mode 100644 index 0000000..dc842c1 --- /dev/null +++ b/frontend/src/app/payments/[registrationId]/page.tsx @@ -0,0 +1,19 @@ +import { PaymentForm } from '@/components/payment-form'; + +interface PaymentPageProps { + params: Promise<{ + registrationId: string; + }>; +} + +export default async function PaymentPage({ params }: PaymentPageProps) { + const { registrationId } = await params; + + return ( +
+
+ +
+
+ ); +} \ No newline at end of file diff --git a/frontend/src/components/announcement-form.tsx b/frontend/src/components/announcement-form.tsx new file mode 100644 index 0000000..58c96da --- /dev/null +++ b/frontend/src/components/announcement-form.tsx @@ -0,0 +1,84 @@ +'use client'; + +import { useState } from 'react'; +import { api } from '@/lib/api'; +import { useRouter } from 'next/navigation'; + +interface AnnouncementFormProps { + eventId: string; +} + +export function AnnouncementForm({ eventId }: AnnouncementFormProps) { + const [title, setTitle] = useState(''); + const [content, setContent] = useState(''); + const [isSubmitting, setIsSubmitting] = useState(false); + const [error, setError] = useState(null); + const router = useRouter(); + + const handleSubmit = async (e: React.FormEvent) => { + e.preventDefault(); + setError(null); + setIsSubmitting(true); + + try { + await api.createAnnouncement(eventId, title, content); + router.push(`/events/${eventId}`); + } catch (err) { + setError(err instanceof Error ? err.message : 'Failed to create announcement'); + } finally { + setIsSubmitting(false); + } + }; + + return ( +
+ {error && ( +
+ {error} +
+ )} + +
+

Create Announcement

+ +
+ + setTitle(e.target.value)} + required + maxLength={200} + className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" + /> +
+ +
+ +