feat(ui-react): implement announcements admin panel#6133
feat(ui-react): implement announcements admin panel#6133
Conversation
|
Claude finished @luizhf42's task in 5m 22s —— View job Code Review CompleteReviewed 16 files across code quality, security, testing, TypeScript/React patterns, and architecture. 1 inline issue posted (medium severity — URL validation bug). The overall implementation is solid: routing is correctly nested under If you've addressed the feedback and want a new review, tag |
ab1e6f0 to
1cd6745
Compare
1cd6745 to
5d771f4
Compare
|
/review |
|
Claude finished @gustavosbarreto's task in 1m 40s —— View job Code Review CompleteReviewed 16 files across code quality, security, testing, TypeScript/React patterns, and architecture. 1 inline issue posted (high severity — stale editor content on same-route navigation). The overall implementation is solid: routing is correctly nested under If you've addressed the feedback and want a new review, tag |
ui-react/apps/console/src/pages/admin/announcements/EditAnnouncement.tsx
Show resolved
Hide resolved
Add SHELLHUB_ANNOUNCEMENTS env var to docker-compose and gen-config.sh so the React UI can read the flag at runtime. Without this, getConfig().announcements always returned the default (false) and the sidebar entry was never shown.
Add full CRUD for system-wide announcements in the React admin panel, gated behind the announcements feature flag. - Tiptap v3 rich text editor with markdown storage - List page with pagination, detail, create, and edit pages - URL validation (isAllowedUrl) to prevent XSS via links - Read-only content renderer with link security attributes - Delete confirmation dialog with query invalidation
Cover list page and delete dialog with 47 unit tests: rendering, loading/empty/error states, navigation, pagination, delete confirmation flow, and error handling.
5d771f4 to
e457a25
Compare
What
Full CRUD for system-wide announcements in the React admin panel — list with pagination, detail view, create page, edit page, and delete confirmation. Content is authored with a Tiptap v3 rich text editor and stored as markdown on the backend.
Why
Feature #10 from shellhub-io/team#93. The announcements feature existed only in the Vue admin panel and needed to be ported to the React console.
Changes
/admin/announcements, conditionally registered whengetConfig().announcementsis enabled. Routes are insideAdminRoute > LicenseGuard, so they inherit admin auth and license checks. Direct URL access returns 404 when the feature flag is off.useAdminAnnouncements(paginated list + single entity) anduseAdminAnnouncementMutations(create, update, delete with query invalidation). Follow the exact patterns fromuseAdminNamespacesanduseAdminNamespaceMutations.@tiptap/markdownfor native bidirectional markdown support — eliminates the Vue codebase's Turndown + MarkdownIt conversion pipeline. Toolbar with bold, italic, strike, headings, lists, blockquote, code blocks, links, images, undo/redo. Includes roving tabindex for keyboard navigation.isAllowedUrlutility (extracted toutils/url.ts) validates link/image URLs against an allowlist (http:,https:,mailto:) in both the editor toolbar prompts and the Link extension'svalidateoption (covers paste/auto-detect). The read-only renderer addsrel="noopener noreferrer"andtarget="_blank"to rendered links.AnnouncementContentuses a non-editable Tiptap instance with the same extensions as the editor, guaranteeing visual parity. Parent passeskey={uuid}to force re-mount on content changes.<form>for Enter-key submission. Title field with live character counter (max 90). Edit page usesnullstate to distinguish "not yet edited" from "cleared", avoiding overwrites on query refetch.Testing
announcementsfeature flag in the dev environment config/admin/announcementsshould 404, sidebar link should be hidden