-
-
Your Rating
-
- We'd love to hear your thoughts about this event. Your rating helps us improve future
- events.
-
-
-
-
-
-
-
-
-
- Cancel
+
+
+
{schema?.name || "Ratings"}
+ {schemaLoading ? (
+
Loading form…
+ ) : schemaErr ? (
+
+
{schemaErr}
+
+ Ask the organizer to publish an active ratings form for this event.
+
+
+ Back to event
-
+ ) : schema ? (
+
+
+
+ ) : null}
-
-
+
);
}
diff --git a/src/pages/SingleEventPage.tsx b/src/pages/SingleEventPage.tsx
index e68058b..6749695 100644
--- a/src/pages/SingleEventPage.tsx
+++ b/src/pages/SingleEventPage.tsx
@@ -31,7 +31,20 @@ import { useEventRegistrationSettings } from "../hooks/useEventRegistrationSetti
import { useSessionQuizPollsRtdb } from "../hooks/useSessionQuizPollsRtdb";
import { firstQuizMasterOrManualVisibleId } from "../lib/sessionQuizPollsRtdb";
-const tabs = ["Key Persons", "My Sessions", "Agenda"] as const;
+type SessionTabId = "key-persons" | "my-sessions" | "agenda";
+
+const SESSION_TABS: { id: SessionTabId; label: string }[] = [
+ { id: "key-persons", label: "Key Persons" },
+ { id: "my-sessions", label: "My Sessions" },
+ { id: "agenda", label: "Agenda" },
+];
+
+function sessionTabEnabled(session: VisitorSessionPreview, tabId: SessionTabId): boolean {
+ if (tabId === "key-persons") return session.audienceKeyPersonsEnabled !== false;
+ if (tabId === "my-sessions") return session.audienceMySessionsEnabled !== false;
+ if (tabId === "agenda") return session.audienceAgendaEnabled !== false;
+ return true;
+}
function speakerName(s: { firstName?: string; lastName?: string }): string {
return [s.firstName, s.lastName].filter(Boolean).join(" ").trim() || "Speaker";
@@ -301,8 +314,23 @@ export function SingleEventPage() {
};
}, [eventId, sessionId, ctx?.eventId]);
+ const visibleTabs = useMemo(() => {
+ if (!session) return [];
+ return SESSION_TABS.filter((t) => sessionTabEnabled(session, t.id));
+ }, [session]);
+
useEffect(() => {
- if (!eventId) {
+ setTab((t) => (t >= visibleTabs.length ? 0 : t));
+ }, [visibleTabs.length]);
+
+ const activeTabId = visibleTabs[tab]?.id ?? null;
+
+ const needsAgendaData = session
+ ? session.audienceMySessionsEnabled !== false || session.audienceAgendaEnabled !== false
+ : true;
+
+ useEffect(() => {
+ if (!eventId || !needsAgendaData) {
setAgendaSessions([]);
setAgendaErr(null);
setAgendaLoading(false);
@@ -328,7 +356,7 @@ export function SingleEventPage() {
return () => {
cancelled = true;
};
- }, [eventId]);
+ }, [eventId, needsAgendaData]);
useEffect(() => {
setDayOpen({});
@@ -422,13 +450,13 @@ export function SingleEventPage() {
const showSessionRatings = reg.enableRatings && sessionAllowsRatings;
const sessionFeedbackHref = (() => {
- const q = new URLSearchParams({ event_id: eventId });
+ const q = new URLSearchParams({ event_id: eventId, session_id: sessionId });
const fid = session.audienceFeedbackForm?.trim();
if (fid) q.set("form_id", fid);
return `/feedback?${q.toString()}`;
})();
const sessionRatingsHref = (() => {
- const q = new URLSearchParams({ event_id: eventId });
+ const q = new URLSearchParams({ event_id: eventId, session_id: sessionId });
const fid = session.audienceRatingsForm?.trim();
if (fid) q.set("form_id", fid);
return `/ratings?${q.toString()}`;
@@ -557,12 +585,14 @@ export function SingleEventPage() {
-
+ {session && session.enableQnA !== false ? (
+
+ ) : null}
@@ -600,24 +630,26 @@ export function SingleEventPage() {
) : null}
-
- {tabs.map((t, i) => (
-
- ))}
-
+ {visibleTabs.length > 0 ? (
+
+ {visibleTabs.map((t, i) => (
+
+ ))}
+
+ ) : null}
- {tab === 0 ? (
+ {activeTabId === "key-persons" ? (
{(session.speakers || []).map((s) => (
@@ -635,7 +667,7 @@ export function SingleEventPage() {
) : null}
- {tab === 1 ? (
+ {activeTabId === "my-sessions" ? (
{agendaLoading && !agendaSessions.length ? (
Loading…
@@ -654,7 +686,7 @@ export function SingleEventPage() {
) : null}
- {tab === 2 ? (
+ {activeTabId === "agenda" ? (
{agendaErr ?
{agendaErr}
: null}
{agendaLoading && !agendaSessions.length ? (