Add announcements collection with banners and popups#1078
Draft
busbyk wants to merge 9 commits into
Draft
Conversation
Introduces a multi-tenant announcements system with time-windowed scheduling, configurable display frequency for popups, and client-side banner collapse state. Includes seed data, revalidation hooks, cached query, and unit tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tests banner visibility, collapse/expand, expiry filtering, cross-page rendering, popup display with homepage-only scope, and popup dismissal. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Removes the dedicated CTA group field from announcements — buttons are now added via the ButtonBlock already available in the rich text editor. Adds click-to-close on popup links, overrides banner button styling to respect callout theme colors, and tightens banner layout spacing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add SponsorsBlock to announcement content editor blocks - Add "Don't show this again" button to popup announcements - Improve banner divider visibility with callout-foreground color - Check dismissed state for all display frequencies, not just 'once' Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Migration Safety CheckFound 4 potential issues: 20260513_201340_announcements.ts Warning (line 22): DELETE keyword detected - review for data loss FOREIGN KEY (\`tenant_id\`) REFERENCES \`tenants\`(\`id\`) ON UPDATE no action ON DELETE set nullWarning (line 54): DELETE keyword detected - review for data loss FOREIGN KEY (\`parent_id\`) REFERENCES \`announcements\`(\`id\`) ON UPDATE no action ON DELETE set null,Warning (line 55): DELETE keyword detected - review for data loss FOREIGN KEY (\`version_tenant_id\`) REFERENCES \`tenants\`(\`id\`) ON UPDATE no action ON DELETE set nullWarning (line 83): ALTER keyword detected - review for data loss sql`ALTER TABLE \`payload_locked_documents_rels\` ADD \`announcements_id\` integer REFERENCES announcements(id);`,Review these patterns and add backup/restore logic if needed. See |
Contributor
|
Preview deployment: https://featxannouncements-collection.preview.avy-fx.org |
- Only show one popup at a time (most recently published) - Fix collapsed banner expand button hidden behind mobile header - Change "every visit" popup to once per browser session via sessionStorage - Prevent auto-focus on "Don't show this again" button when dialog opens - Rename "Every visit" to "Once per visit" in admin UI Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Lifts banner collapsed/expanded state into a context provider so the mobile nav can show a megaphone toggle button and the desktop expand button is hidden on mobile. Header is now a child of Announcements to share provider context. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Awaiting feedback, hold review.
Description
Adds a new Announcements collection supporting two display types: banners (collapsible bar at the top of the page) and popups (modal dialog with configurable display frequency).
Related Issues
Closes #82
Key Changes
announcementscollection with fields for type (banner/popup), display frequency, page scope, device targeting, and date range schedulingannouncements-${tenant.slug}tag on document change/deleteHow to test
pnpm seedto populate test announcementsnwac.localhost:3000— a banner should appear at the top, and a popup should show after 1 second/blogto confirm the homepage-only popup does not appear there/admin/collections/announcementsto manage announcementsScreenshots / Demo video
TBD
Migration Explanation
New collection only — no destructive changes. Migration adds the
announcementstable and related index/relationship tables.Future enhancements / Questions