feat: centralize popup texts in new admin tab /admin/popups

- New admin page for shared popup texts (success, waiting list, error, Instagram hint)
- Removed popup fields from MC and Open Day admin editors
- All SignupModals now read from centralized popups config
- Stored as "popups" section in DB with fallback defaults
This commit is contained in:
2026-03-25 23:48:06 +03:00
parent 983bf296fc
commit 6c485872b0
11 changed files with 100 additions and 62 deletions

View File

@@ -6,12 +6,14 @@ import { SectionHeading } from "@/components/ui/SectionHeading";
import { Reveal } from "@/components/ui/Reveal";
import { SignupModal } from "@/components/ui/SignupModal";
import type { OpenDayEvent, OpenDayClass } from "@/lib/openDay";
import type { SiteContent } from "@/types";
interface OpenDayProps {
data: {
event: OpenDayEvent;
classes: OpenDayClass[];
};
popups?: SiteContent["popups"];
}
function formatDateRu(dateStr: string): string {
@@ -23,7 +25,7 @@ function formatDateRu(dateStr: string): string {
});
}
export function OpenDay({ data }: OpenDayProps) {
export function OpenDay({ data, popups }: OpenDayProps) {
const { event, classes } = data;
const [signup, setSignup] = useState<{ classId: number; label: string } | null>(null);
@@ -132,8 +134,10 @@ export function OpenDay({ data }: OpenDayProps) {
subtitle={signup.label}
endpoint="/api/open-day-register"
extraBody={{ classId: signup.classId, eventId: event.id }}
successMessage={event.successMessage}
waitingMessage={event.waitingListText}
successMessage={popups?.successMessage}
waitingMessage={popups?.waitingListText}
errorMessage={popups?.errorMessage}
instagramHint={popups?.instagramHint}
/>
)}
</section>