Skip to content

Popup announcements with required confirmation - #15

Merged
Casmo merged 10 commits into
mainfrom
hl/add-popup-option-for-announcements-this
Oct 27, 2026
Merged

Casmo merged 10 commits into
mainfrom
hl/add-popup-option-for-announcements-this

Conversation

@Casmo

@Casmo Casmo commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What changed

Admins can now show an announcement as a Banner (the default, same as today) or as a Popup with confirmation required. A popup blocks the page until the user clicks "I've read this". It has no X button and does not close on Esc or a click outside. Once a user confirms a popup, they don't see it again.

  • Data: a new display column (migration stub, default banner, so existing announcements stay banners) and a string-backed AnnouncementDisplay enum (Banner, Popup). A save guard keeps announcements that only target login or registration pages from being saved as popups.
  • Rendering: popups mount once per page on BODY_END through a new AnnouncementPopups Livewire component. If several popups apply, they are shown oldest first with an "N of M" counter. Long popups scroll. The CSS uses a package prefix.
  • Fallbacks: login and registration pages (SimplePage scopes) show the announcement as a normal banner. Guests never see popups, because they can't confirm them.
  • Confirmations are stored as dismissals (announcement_dismissals), so the existing Reset dismissals action works without changes and makes everyone confirm again.
  • Admin UI: a "Display as" radio in the form. The popup option is greyed out (not hidden) when only login or registration pages are selected. The table and infolist show a display badge.
  • Tests: added a Testbench panel, a user fixture, a factory, banner regression tests and popup tests.
  • Docs: the README is updated.

Why

Users easily overlook banners or dismiss them without reading them. For important announcements, such as updated terms of service, admins need to know that every user has actually seen them. The full reasoning, decisions and anti-goals are in the spec.

All 6 plan tasks are implemented, plus the fixes from the final review.

Screenshots

Announcements · Popup — Important announcements block the page until users click “I've read this”

Announcements · Login page — On login and registration pages, a popup announcement shows as a banner

Announcements · Edit form — Admins choose Banner or Popup with confirmation required

Announcements · Edit form — Popup is greyed out when only login or registration pages are selected

Announcements · List — The list shows how each announcement is displayed

Demo

New · Announcements — Users confirm popup announcements one by one. Chapters: 1. Sign in: the login page shows the announcement as a banner, 2. A popup blocks the dashboard: 1 of 2, 3. The next popup follows: 2 of 2, 4. Confirmed popups don't come back

▶️ Watch the full video (MP4)

Chapters:

  1. Sign in: the login page shows the announcement as a banner
  2. A popup blocks the dashboard: 1 of 2
  3. The next popup follows: 2 of 2
  4. Confirmed popups don't come back

How it was tested

  • vendor/bin/pest --no-coverage: 39 passed (125 assertions)
  • vendor/bin/pint --test: pass
  • composer analyse: exits 1, as it already did on the base commit 718e486. The 14 errors there predate this branch and come from duplicate larastan/carbon includes in phpstan.neon.dist. The PHPStan findings that this branch introduced are fixed.

@Casmo
Casmo merged commit a80b767 into main Oct 27, 2026
2 of 4 checks passed
@Casmo
Casmo deleted the hl/add-popup-option-for-announcements-this branch October 27, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant