feat: add dismissible announcement bar (AuthZed Cloud promo)#154
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Removes overlapping act() warnings so test output is pristine. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Add shrink-0 to the spacer so the reserved height can never be compressed below the fixed bar (final review hardening). - Clarify that the storage-event listener syncs across other tabs only. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Default variant stays a dark bar in both themes: bg-foreground/text-background in light mode (near-black), and bg-secondary/text-secondary-foreground in dark mode (the dark-grey surface token, ~oklch 0.27) instead of the inverted white. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Update the announcement bar to promote fully managed SpiceDB clusters on AuthZed Cloud, linking to the Cloud signup with UTM params (source=playground). Bump contentId so the new content re-shows for users who dismissed the old bar. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Adds a reusable, theme-compatible announcement bar fixed to the top of the window and wires it into the playground. It currently promotes AuthZed Cloud.
The bar is dismissible, and dismissal is remembered per content version — bump
contentIdand the bar re-shows for everyone who dismissed the previous message.What's included
useDismissible(id, storageKey?)(src/hooks/use-dismissible.ts) — generic localStorage-backed dismissal memory. Reads synchronously in the state initializer (no flash-of-dismissed-content), guards all storage access in try/catch (private mode / corrupt JSON safe), and syncs across tabs via thestorageevent.<AnnouncementBar>(src/components/announcement-bar.tsx) —position: fixedfull-width bar plus an in-flow spacer whose height tracks the bar viaResizeObserver, so it never overlaps page content and adapts to responsive wrapping.cvavariants (default/brand/info) built on semantic theme tokens; shadcnButton+ lucideXclose control. Content can be text or any component.defaultvariant renders a dark bar in both themes:bg-foreground/text-backgroundin light mode andbg-secondary/text-secondary-foreground(the dark-grey surface token) in dark mode.src/components/FullPlayground.tsx) — mounted as the first flex child of the root layout; the spacer pushes the existing chrome down. OnlyFullPlaygroundis wired (Inline/Embedded iframe modes are untouched). The link targets the AuthZed Cloud signup with UTM params (utm_source=playground).Usage
Test plan
use-dismissible.test.tsx— new id shows; dismiss persists + flips state; a different id still shows; reset clears; corrupt storage handled.announcement-bar.test.tsx— renders children; dismiss hides + persists + callsonDismiss; pre-dismissedcontentIdrenders nothing; variant applied; spacer present/absent perreserveSpace; close hidden whendismissible={false}.announcement-integration.test.tsx— the bar shows in the playground and dismisses (stable role/aria-label selectors).pnpm lint0 errors,tsc --noEmit0 errors.🤖 Generated with Claude Code