From b5602bead51ae0c1ee0ec65e75625485f9df4602 Mon Sep 17 00:00:00 2001 From: Dominik Stahl Date: Tue, 1 Jul 2025 08:55:53 +0200 Subject: [PATCH 1/5] fix: empty event form edit fields --- src/app/(main)/events/[eventID]/page.tsx | 37 +++++++++--------- src/components/custom-ui/labeled-input.tsx | 6 +++ src/components/forms/event-form.tsx | 44 +++++++++++----------- 3 files changed, 45 insertions(+), 42 deletions(-) diff --git a/src/app/(main)/events/[eventID]/page.tsx b/src/app/(main)/events/[eventID]/page.tsx index ce39d19..f47493a 100644 --- a/src/app/(main)/events/[eventID]/page.tsx +++ b/src/app/(main)/events/[eventID]/page.tsx @@ -51,9 +51,6 @@ export default function ShowEvent() { ); } - const event = eventData.data.event; - const organiserName = userData?.data.user?.name || 'Unknown User'; - // Format dates & times for display const formatDate = (isoString?: string) => { if (!isoString) return '-'; @@ -81,7 +78,7 @@ export default function ShowEvent() {

- {event.title || 'Untitled Event'} + {eventData.data.event.title || 'Untitled Event'}

@@ -92,8 +89,8 @@ export default function ShowEvent() { start Time @@ -102,8 +99,8 @@ export default function ShowEvent() { end Time @@ -111,7 +108,7 @@ export default function ShowEvent() { - +
@@ -119,7 +116,7 @@ export default function ShowEvent() { created:
@@ -127,7 +124,7 @@ export default function ShowEvent() { updated:
@@ -139,14 +136,14 @@ export default function ShowEvent() { - +
- +
@@ -154,11 +151,11 @@ export default function ShowEvent() { Participants {' '}
- {event.participants?.map((user) => ( + {eventData.data.event.participants?.map((user) => ( ))}
@@ -167,7 +164,7 @@ export default function ShowEvent() {
- {session.data?.user?.id === event.organizer.id ? ( + {session.data?.user?.id === eventData.data.event.organizer.id ? ( Delete Event Are you sure you want to delete the event “ - {event.title}”? This action cannot be undone. + {eventData.data.event.title}”? This action cannot be undone. @@ -196,7 +193,7 @@ export default function ShowEvent() { variant='muted' onClick={() => { deleteEvent.mutate( - { eventID: event.id }, + { eventID: eventData.data.event.id }, { onSuccess: () => { router.push('/home'); @@ -204,7 +201,7 @@ export default function ShowEvent() { )); @@ -222,7 +219,7 @@ export default function ShowEvent() { ) : null}
- {session.data?.user?.id === event.organizer.id ? ( + {session.data?.user?.id === eventData.data.event.organizer.id ? ( { + if (value !== undefined) { + setInputValue(value); + } + }, [value]); + const handleInputChange = (e: React.ChangeEvent) => { setInputValue(e.target.value); if (rest.onChange) { diff --git a/src/components/forms/event-form.tsx b/src/components/forms/event-form.tsx index 11bf820..17a4cb4 100644 --- a/src/components/forms/event-form.tsx +++ b/src/components/forms/event-form.tsx @@ -58,14 +58,14 @@ const EventForm: React.FC = (props) => { error, } = usePostApiEvent(); const { data, isLoading, error: fetchError } = useGetApiUserMe(); - const { data: eventData } = useGetApiEventEventID(props.eventId!, { - query: { enabled: props.type === 'edit' }, - }); + const { data: eventData } = useGetApiEventEventID( + props.eventId!, + { + query: { enabled: props.type === 'edit' }, + }, + ); const patchEvent = usePatchApiEventEventID(); - const router = useRouter(); - - // Extract event fields for form defaults - const event = eventData?.data?.event; + const router = useRouter();; // State for date and time fields const [startDate, setStartDate] = React.useState(undefined); @@ -87,22 +87,22 @@ const EventForm: React.FC = (props) => { // Update state when event data loads React.useEffect(() => { - if (props.type === 'edit' && event) { - setTitle(event.title || ''); + if (props.type === 'edit' && eventData?.data?.event) { + setTitle(eventData?.data?.event.title || ''); // Parse start_time and end_time - if (event.start_time) { - const start = new Date(event.start_time); + if (eventData?.data?.event.start_time) { + const start = new Date(eventData?.data?.event.start_time); setStartDate(start); setStartTime(start.toTimeString().slice(0, 5)); // "HH:mm" } - if (event.end_time) { - const end = new Date(event.end_time); + if (eventData?.data?.event.end_time) { + const end = new Date(eventData?.data?.event.end_time); setEndDate(end); setEndTime(end.toTimeString().slice(0, 5)); // "HH:mm" } - setLocation(event.location || ''); - setDescription(event.description || ''); - setSelectedParticipants(event.participants?.map((u) => u.user) || []); + setLocation(eventData?.data?.event.location || ''); + setDescription(eventData?.data?.event.description || ''); + setSelectedParticipants(eventData?.data?.event.participants?.map((u) => u.user) || []); } else if (props.type === 'create' && startFromUrl && endFromUrl) { // If creating a new event with URL params, set title and dates setTitle(''); @@ -113,7 +113,7 @@ const EventForm: React.FC = (props) => { setEndDate(end); setEndTime(end.toTimeString().slice(0, 5)); // "HH:mm" } - }, [event, props.type, startFromUrl, endFromUrl]); + }, [eventData?.data?.event, props.type, startFromUrl, endFromUrl]); async function handleSubmit(e: React.FormEvent) { e.preventDefault(); @@ -181,7 +181,7 @@ const EventForm: React.FC = (props) => { router.push(`/events/${eventID}`)} variant='success' buttonText='show' @@ -198,12 +198,12 @@ const EventForm: React.FC = (props) => { // Use DB values for created_at/updated_at in edit mode const createdAtValue = - props.type === 'edit' && event?.created_at - ? event.created_at + props.type === 'edit' && eventData?.data?.event?.created_at + ? eventData.data.event.created_at : new Date().toISOString(); const updatedAtValue = - props.type === 'edit' && event?.updated_at - ? event.updated_at + props.type === 'edit' && eventData?.data?.event?.updated_at + ? eventData.data.event.updated_at : new Date().toISOString(); // Format date for display From 2a95836dcb3bce2777a40886d5ba2b351affa464 Mon Sep 17 00:00:00 2001 From: Dominik Stahl Date: Tue, 1 Jul 2025 08:59:22 +0200 Subject: [PATCH 2/5] fix: settings error message --- src/app/(main)/events/[eventID]/page.tsx | 29 +++++++++++++++++------- src/components/forms/event-form.tsx | 15 ++++++------ src/components/settings/tabs/account.tsx | 2 +- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/src/app/(main)/events/[eventID]/page.tsx b/src/app/(main)/events/[eventID]/page.tsx index f47493a..b9e01ca 100644 --- a/src/app/(main)/events/[eventID]/page.tsx +++ b/src/app/(main)/events/[eventID]/page.tsx @@ -108,7 +108,9 @@ export default function ShowEvent() { - +
@@ -116,7 +118,9 @@ export default function ShowEvent() { created:
@@ -124,7 +128,9 @@ export default function ShowEvent() { updated:
@@ -136,14 +142,18 @@ export default function ShowEvent() { - +
- +
@@ -164,7 +174,8 @@ export default function ShowEvent() {
- {session.data?.user?.id === eventData.data.event.organizer.id ? ( + {session.data?.user?.id === + eventData.data.event.organizer.id ? ( Delete Event Are you sure you want to delete the event “ - {eventData.data.event.title}”? This action cannot be undone. + {eventData.data.event.title}”? This action + cannot be undone. @@ -219,7 +231,8 @@ export default function ShowEvent() { ) : null}
- {session.data?.user?.id === eventData.data.event.organizer.id ? ( + {session.data?.user?.id === + eventData.data.event.organizer.id ? ( = (props) => { error, } = usePostApiEvent(); const { data, isLoading, error: fetchError } = useGetApiUserMe(); - const { data: eventData } = useGetApiEventEventID( - props.eventId!, - { - query: { enabled: props.type === 'edit' }, - }, - ); + const { data: eventData } = useGetApiEventEventID(props.eventId!, { + query: { enabled: props.type === 'edit' }, + }); const patchEvent = usePatchApiEventEventID(); - const router = useRouter();; + const router = useRouter(); // State for date and time fields const [startDate, setStartDate] = React.useState(undefined); @@ -102,7 +99,9 @@ const EventForm: React.FC = (props) => { } setLocation(eventData?.data?.event.location || ''); setDescription(eventData?.data?.event.description || ''); - setSelectedParticipants(eventData?.data?.event.participants?.map((u) => u.user) || []); + setSelectedParticipants( + eventData?.data?.event.participants?.map((u) => u.user) || [], + ); } else if (props.type === 'create' && startFromUrl && endFromUrl) { // If creating a new event with URL params, set title and dates setTitle(''); diff --git a/src/components/settings/tabs/account.tsx b/src/components/settings/tabs/account.tsx index 0b8fe60..db18b0f 100644 --- a/src/components/settings/tabs/account.tsx +++ b/src/components/settings/tabs/account.tsx @@ -98,7 +98,7 @@ export default function AccountTab() { toast.custom((t) => ( Date: Tue, 1 Jul 2025 09:05:21 +0200 Subject: [PATCH 3/5] fix: remove penguin source --- next.config.ts | 2 +- src/app/login/page.tsx | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/next.config.ts b/next.config.ts index 164b423..b9574f9 100644 --- a/next.config.ts +++ b/next.config.ts @@ -6,7 +6,7 @@ const nextConfig: NextConfig = { remotePatterns: [ { protocol: 'https', - hostname: 'img1.wikia.nocookie.net', + hostname: 'i.gifer.com', port: '', pathname: '/**', }, diff --git a/src/app/login/page.tsx b/src/app/login/page.tsx index dcd207d..b83c311 100644 --- a/src/app/login/page.tsx +++ b/src/app/login/page.tsx @@ -61,10 +61,11 @@ export default async function LoginPage() { dancing penguin From d7fdd5d257066065182c7566d851ab96cf5d561a Mon Sep 17 00:00:00 2001 From: Dominik Stahl Date: Tue, 1 Jul 2025 11:30:01 +0200 Subject: [PATCH 4/5] fix: event deletion issues --- package.json | 2 +- .../20250701092705_v0_1_3/migration.sql | 170 ++++++++++++++++++ src/components/forms/event-form.tsx | 13 +- 3 files changed, 178 insertions(+), 7 deletions(-) create mode 100644 prisma/migrations/20250701092705_v0_1_3/migration.sql diff --git a/package.json b/package.json index e5e8c9e..2950955 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meetup", - "version": "0.1.0", + "version": "0.1.3", "private": true, "scripts": { "dev": "next dev --turbopack", diff --git a/prisma/migrations/20250701092705_v0_1_3/migration.sql b/prisma/migrations/20250701092705_v0_1_3/migration.sql new file mode 100644 index 0000000..b103c30 --- /dev/null +++ b/prisma/migrations/20250701092705_v0_1_3/migration.sql @@ -0,0 +1,170 @@ +-- RedefineTables +PRAGMA defer_foreign_keys=ON; +PRAGMA foreign_keys=OFF; +CREATE TABLE "new_blocked_slots" ( + "id" TEXT NOT NULL PRIMARY KEY, + "user_id" TEXT NOT NULL, + "start_time" DATETIME NOT NULL, + "end_time" DATETIME NOT NULL, + "reason" TEXT, + "is_recurring" BOOLEAN NOT NULL DEFAULT false, + "rrule" TEXT, + "recurrence_end_date" DATETIME, + "created_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" DATETIME NOT NULL, + CONSTRAINT "blocked_slots_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE CASCADE ON UPDATE CASCADE +); +INSERT INTO "new_blocked_slots" ("created_at", "end_time", "id", "is_recurring", "reason", "recurrence_end_date", "rrule", "start_time", "updated_at", "user_id") SELECT "created_at", "end_time", "id", "is_recurring", "reason", "recurrence_end_date", "rrule", "start_time", "updated_at", "user_id" FROM "blocked_slots"; +DROP TABLE "blocked_slots"; +ALTER TABLE "new_blocked_slots" RENAME TO "blocked_slots"; +CREATE INDEX "blocked_slots_user_id_start_time_end_time_idx" ON "blocked_slots"("user_id", "start_time", "end_time"); +CREATE INDEX "blocked_slots_user_id_is_recurring_idx" ON "blocked_slots"("user_id", "is_recurring"); +CREATE TABLE "new_calendar_export_tokens" ( + "id" TEXT NOT NULL PRIMARY KEY, + "user_id" TEXT NOT NULL, + "token" TEXT NOT NULL, + "scope" TEXT NOT NULL DEFAULT 'MEETINGS_ONLY', + "is_active" BOOLEAN NOT NULL DEFAULT true, + "created_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "last_accessed_at" DATETIME, + CONSTRAINT "calendar_export_tokens_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE CASCADE ON UPDATE CASCADE +); +INSERT INTO "new_calendar_export_tokens" ("created_at", "id", "is_active", "last_accessed_at", "scope", "token", "user_id") SELECT "created_at", "id", "is_active", "last_accessed_at", "scope", "token", "user_id" FROM "calendar_export_tokens"; +DROP TABLE "calendar_export_tokens"; +ALTER TABLE "new_calendar_export_tokens" RENAME TO "calendar_export_tokens"; +CREATE UNIQUE INDEX "calendar_export_tokens_token_key" ON "calendar_export_tokens"("token"); +CREATE INDEX "calendar_export_tokens_user_id_idx" ON "calendar_export_tokens"("user_id"); +CREATE TABLE "new_calendar_subscriptions" ( + "id" TEXT NOT NULL PRIMARY KEY, + "user_id" TEXT NOT NULL, + "feed_url" TEXT NOT NULL, + "name" TEXT, + "color" TEXT, + "is_enabled" BOOLEAN NOT NULL DEFAULT true, + "last_synced_at" DATETIME, + "last_sync_error" TEXT, + "sync_frequency_minutes" INTEGER DEFAULT 60, + "created_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" DATETIME NOT NULL, + CONSTRAINT "calendar_subscriptions_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE CASCADE ON UPDATE CASCADE +); +INSERT INTO "new_calendar_subscriptions" ("color", "created_at", "feed_url", "id", "is_enabled", "last_sync_error", "last_synced_at", "name", "sync_frequency_minutes", "updated_at", "user_id") SELECT "color", "created_at", "feed_url", "id", "is_enabled", "last_sync_error", "last_synced_at", "name", "sync_frequency_minutes", "updated_at", "user_id" FROM "calendar_subscriptions"; +DROP TABLE "calendar_subscriptions"; +ALTER TABLE "new_calendar_subscriptions" RENAME TO "calendar_subscriptions"; +CREATE INDEX "calendar_subscriptions_user_id_is_enabled_idx" ON "calendar_subscriptions"("user_id", "is_enabled"); +CREATE TABLE "new_email_queue" ( + "id" TEXT NOT NULL PRIMARY KEY, + "user_id" TEXT NOT NULL, + "subject" TEXT NOT NULL, + "body_html" TEXT NOT NULL, + "body_text" TEXT, + "status" TEXT NOT NULL DEFAULT 'PENDING', + "scheduled_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "attempts" INTEGER NOT NULL DEFAULT 0, + "last_attempt_at" DATETIME, + "sent_at" DATETIME, + "error_message" TEXT, + "created_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" DATETIME NOT NULL, + CONSTRAINT "email_queue_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE CASCADE ON UPDATE CASCADE +); +INSERT INTO "new_email_queue" ("attempts", "body_html", "body_text", "created_at", "error_message", "id", "last_attempt_at", "scheduled_at", "sent_at", "status", "subject", "updated_at", "user_id") SELECT "attempts", "body_html", "body_text", "created_at", "error_message", "id", "last_attempt_at", "scheduled_at", "sent_at", "status", "subject", "updated_at", "user_id" FROM "email_queue"; +DROP TABLE "email_queue"; +ALTER TABLE "new_email_queue" RENAME TO "email_queue"; +CREATE INDEX "idx_email_queue_pending_jobs" ON "email_queue"("status", "scheduled_at"); +CREATE INDEX "idx_email_queue_user_history" ON "email_queue"("user_id", "created_at"); +CREATE TABLE "new_external_events" ( + "id" TEXT NOT NULL PRIMARY KEY, + "subscription_id" TEXT NOT NULL, + "ical_uid" TEXT NOT NULL, + "summary" TEXT, + "description" TEXT, + "start_time" DATETIME NOT NULL, + "end_time" DATETIME NOT NULL, + "is_all_day" BOOLEAN NOT NULL DEFAULT false, + "location" TEXT, + "rrule" TEXT, + "dtstamp" DATETIME, + "sequence" INTEGER, + "show_as_free" BOOLEAN NOT NULL DEFAULT false, + "last_fetched_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + CONSTRAINT "external_events_subscription_id_fkey" FOREIGN KEY ("subscription_id") REFERENCES "calendar_subscriptions" ("id") ON DELETE CASCADE ON UPDATE CASCADE +); +INSERT INTO "new_external_events" ("description", "dtstamp", "end_time", "ical_uid", "id", "is_all_day", "last_fetched_at", "location", "rrule", "sequence", "show_as_free", "start_time", "subscription_id", "summary") SELECT "description", "dtstamp", "end_time", "ical_uid", "id", "is_all_day", "last_fetched_at", "location", "rrule", "sequence", "show_as_free", "start_time", "subscription_id", "summary" FROM "external_events"; +DROP TABLE "external_events"; +ALTER TABLE "new_external_events" RENAME TO "external_events"; +CREATE INDEX "external_events_subscription_id_start_time_end_time_idx" ON "external_events"("subscription_id", "start_time", "end_time"); +CREATE INDEX "external_events_subscription_id_show_as_free_idx" ON "external_events"("subscription_id", "show_as_free"); +CREATE UNIQUE INDEX "external_events_subscription_id_ical_uid_key" ON "external_events"("subscription_id", "ical_uid"); +CREATE TABLE "new_friendships" ( + "user_id_1" TEXT NOT NULL, + "user_id_2" TEXT NOT NULL, + "status" TEXT NOT NULL DEFAULT 'PENDING', + "requested_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "accepted_at" DATETIME, + + PRIMARY KEY ("user_id_1", "user_id_2"), + CONSTRAINT "friendships_user_id_1_fkey" FOREIGN KEY ("user_id_1") REFERENCES "users" ("id") ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT "friendships_user_id_2_fkey" FOREIGN KEY ("user_id_2") REFERENCES "users" ("id") ON DELETE CASCADE ON UPDATE CASCADE +); +INSERT INTO "new_friendships" ("accepted_at", "requested_at", "status", "user_id_1", "user_id_2") SELECT "accepted_at", "requested_at", "status", "user_id_1", "user_id_2" FROM "friendships"; +DROP TABLE "friendships"; +ALTER TABLE "new_friendships" RENAME TO "friendships"; +CREATE INDEX "idx_friendships_user2_status" ON "friendships"("user_id_2", "status"); +CREATE TABLE "new_group_members" ( + "group_id" TEXT NOT NULL, + "user_id" TEXT NOT NULL, + "role" TEXT NOT NULL DEFAULT 'MEMBER', + "added_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + + PRIMARY KEY ("group_id", "user_id"), + CONSTRAINT "group_members_group_id_fkey" FOREIGN KEY ("group_id") REFERENCES "groups" ("id") ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT "group_members_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE CASCADE ON UPDATE CASCADE +); +INSERT INTO "new_group_members" ("added_at", "group_id", "role", "user_id") SELECT "added_at", "group_id", "role", "user_id" FROM "group_members"; +DROP TABLE "group_members"; +ALTER TABLE "new_group_members" RENAME TO "group_members"; +CREATE INDEX "group_members_user_id_idx" ON "group_members"("user_id"); +CREATE TABLE "new_meeting_participants" ( + "meeting_id" TEXT NOT NULL, + "user_id" TEXT NOT NULL, + "status" TEXT NOT NULL DEFAULT 'PENDING', + "added_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + + PRIMARY KEY ("meeting_id", "user_id"), + CONSTRAINT "meeting_participants_meeting_id_fkey" FOREIGN KEY ("meeting_id") REFERENCES "meetings" ("id") ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT "meeting_participants_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE CASCADE ON UPDATE CASCADE +); +INSERT INTO "new_meeting_participants" ("added_at", "meeting_id", "status", "user_id") SELECT "added_at", "meeting_id", "status", "user_id" FROM "meeting_participants"; +DROP TABLE "meeting_participants"; +ALTER TABLE "new_meeting_participants" RENAME TO "meeting_participants"; +CREATE INDEX "idx_participants_user_status" ON "meeting_participants"("user_id", "status"); +CREATE TABLE "new_notifications" ( + "id" TEXT NOT NULL PRIMARY KEY, + "user_id" TEXT NOT NULL, + "type" TEXT NOT NULL, + "related_entity_type" TEXT, + "related_entity_id" TEXT, + "message" TEXT NOT NULL, + "is_read" BOOLEAN NOT NULL DEFAULT false, + "created_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + CONSTRAINT "notifications_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE CASCADE ON UPDATE CASCADE +); +INSERT INTO "new_notifications" ("created_at", "id", "is_read", "message", "related_entity_id", "related_entity_type", "type", "user_id") SELECT "created_at", "id", "is_read", "message", "related_entity_id", "related_entity_type", "type", "user_id" FROM "notifications"; +DROP TABLE "notifications"; +ALTER TABLE "new_notifications" RENAME TO "notifications"; +CREATE INDEX "idx_notifications_user_read_time" ON "notifications"("user_id", "is_read", "created_at"); +CREATE TABLE "new_user_notification_preferences" ( + "user_id" TEXT NOT NULL, + "notification_type" TEXT NOT NULL, + "email_enabled" BOOLEAN NOT NULL DEFAULT false, + "updated_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + + PRIMARY KEY ("user_id", "notification_type"), + CONSTRAINT "user_notification_preferences_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE CASCADE ON UPDATE CASCADE +); +INSERT INTO "new_user_notification_preferences" ("email_enabled", "notification_type", "updated_at", "user_id") SELECT "email_enabled", "notification_type", "updated_at", "user_id" FROM "user_notification_preferences"; +DROP TABLE "user_notification_preferences"; +ALTER TABLE "new_user_notification_preferences" RENAME TO "user_notification_preferences"; +PRAGMA foreign_keys=ON; +PRAGMA defer_foreign_keys=OFF; diff --git a/src/components/forms/event-form.tsx b/src/components/forms/event-form.tsx index 6a99983..2fe350d 100644 --- a/src/components/forms/event-form.tsx +++ b/src/components/forms/event-form.tsx @@ -5,7 +5,6 @@ import { Button } from '@/components/ui/button'; import Logo from '@/components/misc/logo'; import TimePicker from '@/components/time-picker'; import { Label } from '@/components/ui/label'; -import { useGetApiUserMe } from '@/generated/api/user/user'; import { usePostApiEvent, useGetApiEventEventID, @@ -57,8 +56,11 @@ const EventForm: React.FC = (props) => { isSuccess, error, } = usePostApiEvent(); - const { data, isLoading, error: fetchError } = useGetApiUserMe(); - const { data: eventData } = useGetApiEventEventID(props.eventId!, { + const { + data: eventData, + isLoading, + isError, + } = useGetApiEventEventID(props.eventId!, { query: { enabled: props.type === 'edit' }, }); const patchEvent = usePatchApiEventEventID(); @@ -210,8 +212,7 @@ const EventForm: React.FC = (props) => { }, []); if (props.type === 'edit' && isLoading) return
Loading...
; - if (props.type === 'edit' && fetchError) - return
Error loading event.
; + if (props.type === 'edit' && isError) return
Error loading event.
; return ( @@ -298,7 +299,7 @@ const EventForm: React.FC = (props) => {

{!isClient || isLoading ? 'Loading...' - : data?.data.user?.name || 'Unknown User'} + : eventData?.data.event.organizer.name || 'Unknown User'}

From b3cb551f7c5072da43d86ad8101790cab072c946 Mon Sep 17 00:00:00 2001 From: Dominik Stahl Date: Tue, 1 Jul 2025 11:36:40 +0200 Subject: [PATCH 5/5] fix: event cards layout bugs --- src/app/(main)/events/[eventID]/page.tsx | 2 +- src/components/forms/event-form.tsx | 2 +- src/components/time-picker.tsx | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/(main)/events/[eventID]/page.tsx b/src/app/(main)/events/[eventID]/page.tsx index b9e01ca..68ef8e6 100644 --- a/src/app/(main)/events/[eventID]/page.tsx +++ b/src/app/(main)/events/[eventID]/page.tsx @@ -160,7 +160,7 @@ export default function ShowEvent() { {' '} -
+
{eventData.data.event.participants?.map((user) => ( = (props) => { -
+
{selectedParticipants.map((user) => ( -
+
+
@@ -69,7 +69,7 @@ export default function TimePicker({
-
+