Skip to content

feat: add dismissible announcement bar (AuthZed Cloud promo)#154

Merged
samkim merged 7 commits into
mainfrom
feat/announcement-bar
Jul 1, 2026
Merged

feat: add dismissible announcement bar (AuthZed Cloud promo)#154
samkim merged 7 commits into
mainfrom
feat/announcement-bar

Conversation

@samkim

@samkim samkim commented Jul 1, 2026

Copy link
Copy Markdown
Member

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 contentId and the bar re-shows for everyone who dismissed the previous message.

image

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 the storage event.
  • <AnnouncementBar> (src/components/announcement-bar.tsx) — position: fixed full-width bar plus an in-flow spacer whose height tracks the bar via ResizeObserver, so it never overlaps page content and adapts to responsive wrapping. cva variants (default / brand / info) built on semantic theme tokens; shadcn Button + lucide X close control. Content can be text or any component.
    • default variant renders a dark bar in both themes: bg-foreground / text-background in light mode and bg-secondary / text-secondary-foreground (the dark-grey surface token) in dark mode.
  • Playground integration (src/components/FullPlayground.tsx) — mounted as the first flex child of the root layout; the spacer pushes the existing chrome down. Only FullPlayground is wired (Inline/Embedded iframe modes are untouched). The link targets the AuthZed Cloud signup with UTM params (utm_source=playground).

Usage

<AnnouncementBar contentId="authzed-cloud" variant="default">
  Deploy fully managed SpiceDB clusters on AuthZed Cloud. <a href="…">Try now →</a>
</AnnouncementBar>

Test plan

  • New tests (Vitest browser project, real DOM + localStorage, not mocks):
    • 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 + calls onDismiss; pre-dismissed contentId renders nothing; variant applied; spacer present/absent per reserveSpace; close hidden when dismissible={false}.
    • announcement-integration.test.tsx — the bar shows in the playground and dismisses (stable role/aria-label selectors).
  • Full suite green: unit 78/78, browser 24/24 (pristine output).
  • pnpm lint 0 errors, tsc --noEmit 0 errors.

🤖 Generated with Claude Code

samkim and others added 7 commits June 30, 2026 18:02
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>
@vercel

vercel Bot commented Jul 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
playground Ready Ready Preview, Comment Jul 1, 2026 1:24am

Request Review

@josephschorr josephschorr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@samkim
samkim merged commit 0c9a90d into main Jul 1, 2026
5 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants