diff --git a/src/Pages/Events/CreateEventPage.js b/src/Pages/Events/CreateEventPage.js
index a8b9027fe..58f055ee1 100644
--- a/src/Pages/Events/CreateEventPage.js
+++ b/src/Pages/Events/CreateEventPage.js
@@ -3,10 +3,10 @@ import { useMemo, useState } from 'react';
import { Link, useHistory } from 'react-router-dom';
import { useSCE } from '../../Components/context/SceContext';
import { createSCEvent } from '../../APIFunctions/SCEvents';
-import CreateEventFormQuestionBlock from './CreateEventFormQuestionBlock';
import { membershipState } from '../../Enums';
import { useEventQuestions, toApiRegistrationForm } from './useEventQuestions';
import { getApiErrorMessage } from './eventUtils';
+import EventEditorForm from './EventEditorForm';
/** Matches SCEvents `max_attendees` when there is no cap. */
const UNLIMITED_ATTENDEES = -1;
@@ -155,267 +155,53 @@ export default function CreateEventPage() {
}
return (
-
-
-
- ← Back to Events
-
-
- Create event
-
-
Event id: {eventId}
-
-
-
Event details
-
-
-
-
-
-
-
-
-
-
-
-
-
- Waitlist
-
-
-
-
- {waitlistEnabled && (
-
- Maximum number of users allowed on the waitlist.
-
- )}
-
-
-
-
-
-
-
-
- {visibility === 'private' && (
-
- )}
-
-
-
- Registration questions
-
-
- {questions.map((q, index) => (
-
- ))}
-
-
-
- {submitError && (
-
- {submitError}
-
- )}
-
-
-
-
- Cancel
-
-
-
+
);
}
diff --git a/src/Pages/Events/EditEventPage.js b/src/Pages/Events/EditEventPage.js
index fbdd609af..4b045650b 100644
--- a/src/Pages/Events/EditEventPage.js
+++ b/src/Pages/Events/EditEventPage.js
@@ -3,10 +3,10 @@ import { useMemo, useState, useEffect } from 'react';
import { Link, useHistory, useParams } from 'react-router-dom';
import { useSCE } from '../../Components/context/SceContext';
import { getEventByID, updateSCEvent } from '../../APIFunctions/SCEvents';
-import CreateEventFormQuestionBlock from './CreateEventFormQuestionBlock';
import { membershipState } from '../../Enums';
import { toApiRegistrationForm, useEventQuestions } from './useEventQuestions';
import { getApiErrorMessage } from './eventUtils';
+import EventEditorForm from './EventEditorForm';
/** Matches SCEvents `max_attendees` when there is no cap. */
const UNLIMITED_ATTENDEES = -1;
@@ -186,246 +186,53 @@ export default function EditEventPage() {
}
return (
-
-
-
- ← Back to Events
-
-
- Edit event
-
-
Event id: {id}
-
-
-
Event details
-
-
-
-
-
-
-
-
-
-
-
- Max attendees
-
-
- setMaxAttendees(
- e.target.value ? parseInt(e.target.value, 10) : UNLIMITED_ATTENDEES,
- )
- }
- placeholder="No limit"
- />
-
-
-
-
- Waitlist
-
-
-
-
- {waitlistEnabled && (
-
- Maximum number of users allowed on the waitlist.
-
- )}
-
-
-
-
-
-
-
-
- {visibility === 'private' && (
-
- )}
-
-
-
- Registration questions
-
-
- {questions.map((q, index) => (
-
- ))}
-
-
-
- {submitError && (
-
- {submitError}
-
- )}
-
-
-
-
- Cancel
-
-
-
+
);
}
diff --git a/src/Pages/Events/EventEditorForm.js b/src/Pages/Events/EventEditorForm.js
new file mode 100644
index 000000000..fc2eebe66
--- /dev/null
+++ b/src/Pages/Events/EventEditorForm.js
@@ -0,0 +1,336 @@
+import { Link } from 'react-router-dom';
+import CreateEventFormQuestionBlock from './CreateEventFormQuestionBlock';
+
+export default function EventEditorForm({
+ meta,
+ form,
+ questionActions,
+}) {
+ const {
+ title,
+ eventIdLabel,
+ containerClassName,
+ submitLabel,
+ submittingLabel,
+ onSubmit,
+ submitting,
+ submitError,
+ unlimitedAttendeesValue,
+ maxAttendeesMode,
+ } = meta;
+
+ const {
+ eventName,
+ setEventName,
+ date,
+ setDate,
+ time,
+ setTime,
+ location,
+ setLocation,
+ description,
+ setDescription,
+ status,
+ setStatus,
+ visibility,
+ setVisibility,
+ minimumVisibleRole,
+ setMinimumVisibleRole,
+ maxAttendees,
+ setMaxAttendees,
+ waitlistEnabled,
+ setWaitlistEnabled,
+ waitlistSize,
+ setWaitlistSize,
+ } = form;
+
+ const {
+ questions,
+ addQuestion,
+ removeQuestion,
+ updateQuestion,
+ updateQuestionType,
+ updateAnswerOption,
+ addAnswerOption,
+ removeAnswerOption,
+ } = questionActions;
+
+ return (
+
+
+
+ ← Back to Events
+
+
+ {title}
+
+
Event id: {eventIdLabel}
+
+
+
Event details
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Waitlist
+
+
+
+ {waitlistEnabled && (
+
+ Maximum number of users allowed on the waitlist.
+
+ )}
+
+
+
+
+
+
+
+
+ {visibility === 'private' && (
+
+ )}
+
+
+
+ Registration questions
+
+
+ {questions.map((q, index) => (
+
+ ))}
+
+
+
+ {submitError && (
+
+ {submitError}
+
+ )}
+
+
+
+
+ Cancel
+
+
+
+ );
+}
diff --git a/src/Pages/Events/Events.js b/src/Pages/Events/Events.js
index 12948aa3f..e9b0794a3 100644
--- a/src/Pages/Events/Events.js
+++ b/src/Pages/Events/Events.js
@@ -79,7 +79,7 @@ export default function EventsPage() {
return (
{/* Ambient blobs — unchanged from original */}
-
+
@@ -87,13 +87,13 @@ export default function EventsPage() {
{/* ── Calendar area ── */}
{isLoading && (
-
+
Loading events...
)}
{!isLoading && hasError && (
-
+
Failed to load events. Please make sure SCEvents is running locally.
)}