AI Implementation feature(892): Admin Area General Settings and Categories 1.10 (#32)

This commit was merged in pull request #32.
This commit is contained in:
2026-07-22 16:16:22 +00:00
parent 4656a5b082
commit c0a01eb58e
17 changed files with 664 additions and 63 deletions
+28 -3
View File
@@ -1,9 +1,9 @@
---
type: guide
title: Landing Page
description: How the public landing page renders, how the login + registration modal is opened, and what each form does.
tags: [guide, landing, login, register, ui]
timestamp: 2026-07-21T18:45:54Z
description: How the public landing page renders, how the login + registration modal is opened, what each form does, and how the modal stays in sync with admin `registrationsEnabled` changes via SSE.
tags: [guide, landing, login, register, ui, sse, bootstrap]
timestamp: 2026-07-22T16:15:00Z
---
# What you see
@@ -90,6 +90,31 @@ The modal is dismissible via the **×** button (`landing-modal-close`),
clicking the overlay backdrop, or pressing `Escape`. Submit-in-flight
dismissal is suppressed.
# Reacting to admin changes
The Login/Register modal reflects the value of
`bootstrap.payload().registrationsEnabled`, which is loaded once at app
boot by `BootstrapService.load()`. Two paths keep the modal consistent
with the API:
1. `LandingComponent.ngOnInit()` calls `BootstrapService.refresh()` so
the public landing page always fetches the latest bootstrap payload
before rendering the modal. This covers users who reach `/login`
via a hard refresh or fresh tab and have not previously subscribed to
the SSE channel.
2. `BootstrapEventService` (started by `AppComponent.ngOnInit`) opens
the public `GET /api/v1/event/stream` SSE channel and listens for
`{ topic: 'general' }` frames. Whenever the admin saves a setting via
`PUT /api/v1/admin/general/settings`, the backend emits a `general`
hub event with `themeKey` and `registrationsEnabled`; the public SSE
forwards it on `/api/v1/event/stream` and the SPA calls
`BootstrapService.refresh()` to re-apply the new flag (and theme).
The pure helper `landingModalShowsRegister(registrationsEnabled)` in
`frontend/src/app/features/landing/login-modal.service.ts` mirrors the
HTML predicate and is asserted in
`tests/frontend/landing-modal.spec.ts`.
# Server error code → user copy
`buildLoginFailureMessage` (`frontend/src/app/features/landing/login-modal.service.ts`)