Improve announcements UI - #784
Merged
Merged
Conversation
Splits the desktop popover and mobile dropdown-panel announcement markup out of Navbar.tsx into a new Announcements.tsx (AnnouncementsBell, MobileAnnouncements), sharing one internal list-rendering component instead of duplicating the accordion markup. Navbar keeps ownership of the data layer (queries/mutations) and passes it down as props. Also fixes the announcements bell rendering taller than the other nav buttons: it hard-coded a 2.4rem box instead of deriving its height from padding + line-height like its siblings. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Announcement.body is authored free-form in the Django admin; render it through react-markdown instead of a plain <p> so staff can use bold, links, and lists. react-markdown converts markdown to React elements directly (no dangerouslySetInnerHTML), so no sanitizer is needed. - Announcements.tsx: swap the body <p> for <ReactMarkdown> - Announcements.module.scss: style the elements markdown can produce (p/ul/ol/li/a/code) instead of a single bare <p> - core/models.py: note Markdown support in the body field's help_text (migration 0017, help_text-only) - Navbar.stories.tsx / Navbar.test.tsx: cover markdown rendering Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- Hover effect on announcement items - Hide "Mark read" while collapsed (was always visible) - Hide "Mark all read" entirely when there are no unread items - Replace the (unused) rotating chevron affordance's earlier text hint with a CSS-drawn arrow, scoped to each item's own data-state so it no longer picks up the popover's data-state="open" instead - Remove the accordion trigger's green focus-visible outline; falls back to the site-wide default - Hide the summary once an item is expanded (redundant with the body) - Announcement.save() now sets published_at automatically the first time an announcement is published, if not already set - AnnouncementAdmin makes published_at read-only once set - Frontend displays each announcement's published date/time
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.
Summary
Navbar.tsxinto a newNavbar/Announcements.tsx(AnnouncementsBell,MobileAnnouncements), sharing one internal list-rendering component instead of duplicating the accordion markup twice.Navbar.tsxkeeps ownership of the data layer (useAnnouncements, mutations, unread-count sync) and passes it down as props — no duplicated queries/mutations.Announcements.module.scss;Navbar.module.scssshrinks by ~155 lines.2.4rembox instead of deriving its height from padding + line-height like its siblings.bodyas Markdown (react-markdown) instead of plain text.UX polish
:focus-visibleoutline.Announcement.save()now auto-setspublished_atthe first time an announcement is saved as published, if it isn't already set (idempotent — won't overwrite an existing value).formatPublishedAt, following the existingformatDueAtconvention).published_atbecomes read-only once set, viaAnnouncementAdmin.get_readonly_fields— still editable while unset or on a new unsaved announcement..body's font-size was never actually applied to the rendered markdown<p>/<li>elements (a global barep { }rule was winning over the inherited container size).Known issue
Testing
npx eslinton changed files: cleannpx tsc --noEmit: cleannpx vitest run src/layout/Navbar/Navbar.test.tsx: 12/12 passingcore/tests.pyadditions (AnnouncementSaveTest,AnnouncementAdminReadonlyFieldsTest) cover thepublished_atauto-set and admin read-only behavior — not yet run against Docker in this session.🤖 Generated with Claude Code