Skip to content

refactor(www): framework path params to global state - #64

Merged
iamdin merged 5 commits into
nextfrom
refactor/framework-switch
Aug 31, 2025
Merged

iamdin merged 5 commits into
nextfrom
refactor/framework-switch

Conversation

@iamdin

@iamdin iamdin commented Aug 31, 2025 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features
    • Multi-framework examples and source code viewer with a persistent framework selector.
  • Changes
    • Simplified docs URLs: component pages moved to /docs/components/{component} (removed framework segment).
    • Updated docs to use a unified prop name in examples (name instead of component) across all component pages.
  • Documentation
    • Refreshed component pages to reflect the new example/source setup and prop rename.
  • CI
    • Preview deployments for pull requests with automatic PR comments containing the preview URL.

@changeset-bot

changeset-bot Bot commented Aug 31, 2025 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: d8ad7f5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Aug 31, 2025 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@iamdin has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 10 minutes and 36 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 94d1819 and d8ad7f5.

📒 Files selected for processing (2)
  • apps/www/src/components/content/component-source.astro (1 hunks)
  • apps/www/src/components/content/example-source.astro (1 hunks)

Walkthrough

Refactors docs and code display to a framework-agnostic route structure and multi-framework source rendering. Renames a public prop from component to name across docs/components. Introduces a shared frameworkAtom with localStorage persistence to toggle per-framework UI. Adjusts source APIs (source → content), updates framework selection UI, and revises CI for preview deployments.

Changes

Cohort / File(s) Change Summary
Docs: ComponentSource prop rename
apps/www/content/components/*.mdx (accordion, avatar, button, checkbox, collapsible, combobox, dialog, hover-card, input, label, menu, number-input, pagination, pin-input, popover, progress, radio-group, rating-group, select, sheet, slider, switch, tabs, tags-input, textarea, toast, toggle-group, toggle, tooltip, tree-view)
In MDX docs, <ComponentSource component="..."/> → <ComponentSource name="..."/>.
Multi-framework source rendering
apps/www/src/components/content/component-source.astro, apps/www/src/components/content/example-source.astro, apps/www/src/components/content/component-preview/index.astro, apps/www/src/components/content/component-preview/component-code.astro
ComponentSource now fetches and renders sources for all frameworks; prop renamed to name. Adds ExampleSource for examples per framework. Preview index switches to ExampleSource. Removes old per-framework code component.
Preview fallback prop rename
apps/www/src/components/content/component-preview/preview.tsx
NotFound prop renamed from component to name; usage updated.
Framework selection: shared atom and UI wiring
apps/www/src/components/framework-select.tsx, apps/www/src/components/framework-select/index.astro, apps/www/src/components/site-header.astro, apps/www/src/layouts/root-layout.astro, apps/www/src/layouts/doc-layout.astro
FrameworkSelect now uses frameworkAtom; removes Astro.params usage and URL navigation. Header imports named export and hydrates on client. Root layout loads atom script; doc layout removes data-framework attr.
Sidebar/docs routing simplification
apps/www/src/components/sidebar.astro, apps/www/src/lib/docs.ts, apps/www/src/pages/docs/components/[component].astro
Removes framework parameter from sidebar generation and routes. getStaticPaths now emits only { component } paths. Eliminates param schema/types and related helpers.
Source API field rename
apps/www/src/lib/source.ts
Public return shape changed: source field renamed to content for both example and component sources.
Content component removal
apps/www/src/components/content/accordion.tsx
Deletes dynamic Accordion content renderer and its exported types/implementation.
Framework atom (client state + persistence)
apps/www/src/store/atoms/framework.ts
Adds frameworkAtom with localStorage sync and DOM toggling via data-framework attributes on page load and changes.
CI: Preview and production deployment split
.github/workflows/deploy.yml
Adds PR preview deploys (Cloudflare Wrangler v3, comments URL). Production deploys on push to next. Removes main PR trigger.
Tooling ignore updates
biome.jsonc
Adds ignores for "**/.wrangler/**" and "**/.next/**".

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant H as SiteHeader / FrameworkSelect
  participant A as frameworkAtom
  participant LS as localStorage
  participant DOM as data-framework blocks (ComponentSource/ExampleSource)

  rect rgba(230,240,255,0.4)
  note over DOM: On page load
  A->>LS: Read saved framework (fallback "react")
  A->>DOM: Show matching [data-framework], hide others
  end

  U->>H: Change framework via select
  H->>A: frameworkAtom.set(newFramework)
  A->>LS: Persist newFramework
  A->>DOM: Toggle visibility across per-framework blocks
Loading
sequenceDiagram
  autonumber
  participant CS as ComponentSource (Astro)
  participant ES as ExampleSource (Astro)
  participant S as getComponentSource/getExampleSource
  participant F as frameworks[]

  rect rgba(245,235,255,0.35)
  note over CS: Server-side render
  CS->>F: Iterate frameworks
  CS->>S: getComponentSource(framework, name)
  S-->>CS: [{ filename, lang, content }]
  CS->>CS: Render hidden blocks per framework (data-framework)
  end

  rect rgba(245,235,255,0.35)
  note over ES: Server-side render
  ES->>F: Iterate frameworks
  ES->>S: getExampleSource(framework, name)
  S-->>ES: { lang, content } | null
  ES->>ES: Render hidden blocks per framework (data-framework)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I hop through tabs where frameworks gleam,
Flip a switch—the atom streams.
Names replaced, the sources sing,
Content blooms from every string.
Preview winds on cloud-kissed air—
I thump approval, light as hare.
Ship it quick—next branch, take care! 🐇✨

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/framework-switch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
apps/www/src/lib/source.ts (1)

23-27: Inconsistent property name: getExampleSource still returns source instead of content.

This will break consumers expecting content. Align it with getComponentSource.

Apply this diff:

   return {
     filename: `${entryFileInfo[1]}.${entryFileInfo[2]}`,
-    source: entryFile.result,
+    content: entryFile.result,
     lang: entryFileInfo[2] as BuiltinLanguage,
   }
apps/www/content/components/button.mdx (1)

49-53: Incorrect Next.js Link import in example.

next/link exports Link as default, not a named export.

Apply this diff:

-import { Link } from "next/link"
+import Link from "next/link"
apps/www/src/pages/docs/components/[component].astro (1)

1-23: Add redirect route and remove stale alias

  • Create apps/www/src/pages/docs/components/[framework]/[component].astro to redirect /docs/components/:framework/:component → /docs/components/:component (301).
  • In apps/www/astro.config.ts (line 24), remove or update the obsolete mapping
    "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/docs/components": "/docs/components/react/accordion".
🧹 Nitpick comments (10)
apps/www/src/lib/source.ts (2)

51-57: Rename aligns with new API, but ensure consumers expect content (not source).

Good rename. Please confirm all consumers (e.g., ComponentSource/ExampleSource renderers) use content. Consider introducing a shared type to lock this shape.

Apply:

+export type SourceFile = {
+  filename: string
+  content: string
+  lang: BuiltinLanguage
+}

…and use Promise<SourceFile[]> / SourceFile as return types here for compile-time safety.

Also applies to: 65-67


72-74: Broaden file-extension support or harden parsing.

extractFileInfo only matches .vue|.ts|.tsx. If examples add .jsx or .css (often co-located), this will fail silently and yield undefined.undefined.

Apply:

-export const extractFileInfo = (p: string) => {
-  return p.match(/([\w-]+)\.(vue|ts|tsx)$/) || []
-}
+export const extractFileInfo = (p: string) => p.match(/([\w-]+)\.(vue|ts|tsx|jsx|js|css|svelte)$/) || []

Optionally validate match before using [1]/[2] and throw a descriptive error.

apps/www/content/components/menu.mdx (1)

24-24: LGTM; consider naming consistency in internal UI text.

Minor: preview.tsx’s NotFound component still refers to the variable as component; consider renaming to name for consistency across the docs surface.

apps/www/src/components/sidebar.astro (1)

21-21: Active-link check can false-match; add a precise matcher and aria-current.
Prevents e.g. “tab” highlighting on “tabs” and improves a11y.

 const pathname = Astro.url.pathname
+const isActive = (href: string) =>
+  pathname === href || pathname.startsWith(href + "/")

 ...
-          <a
-            href={item.href}
-            class={cn(
-              "hover:underline px-2 py-1",
-              pathname.startsWith(item.href)
-                ? "font-medium text-foreground"
-                : "text-muted-foreground"
-            )}
-          >
+          <a
+            href={item.href}
+            aria-current={isActive(item.href) ? "page" : undefined}
+            class={cn(
+              "hover:underline px-2 py-1",
+              isActive(item.href) ? "font-medium text-foreground" : "text-muted-foreground"
+            )}
+          >

Also applies to: 30-41, 33-36

apps/www/src/lib/framework-script.ts (2)

4-4: Type subscription as possibly undefined to match optional use.
Prevents type/lint noise when calling subscription?.unsubscribe().

-let subscription: Subscription
+let subscription: Subscription | undefined

6-14: Compute framework once and toggle via hidden attribute for consistency.
Aligns with ui-library script and avoids class/attribute divergence; minor perf win.

-const handler = () => {
-  for (const element of document.querySelectorAll("[data-framework]")) {
-    if (element.getAttribute("data-framework") === frameworkAtom.get()) {
-      element.classList.remove("hidden")
-    } else {
-      element.classList.add("hidden")
-    }
-  }
-}
+const handler = () => {
+  const current = frameworkAtom.get()
+  const nodes = document.querySelectorAll<HTMLElement>("[data-framework]")
+  for (const el of nodes) {
+    el.hidden = el.dataset.framework !== current
+  }
+}
apps/www/src/components/site-header.astro (1)

31-31: Consider hydrating the switcher on idle to reduce main-thread contention.

client:idle typically suffices for a small select; keeps LCP steadier without affecting functionality.

Apply:

-        <FrameworkSelect client:load />
+        <FrameworkSelect client:idle />
apps/www/src/store/atoms/framework.ts (2)

5-23: Harden storage, add cross-tab sync, and clean up on HMR

  • Guard localStorage with try/catch (Safari private mode, quota).
  • Derive the default from frameworks[0] to avoid repeating "react".
  • Sync across tabs via the storage event.
  • Dispose subscriptions/listeners on HMR to avoid duplicate writes during dev.
 import { createAtom } from "@xstate/store"
 
 export const FRAMEWORK_STORAGE_KEY = `${siteConfig.name}-framework`
+const DEFAULT_FRAMEWORK: Framework = frameworks[0]
 
-// Get initial value from localStorage or default to "react"
-const getInitialFramework = (): Framework => {
-  if (typeof window === "undefined") return "react"
-  const stored = localStorage.getItem(FRAMEWORK_STORAGE_KEY)
-  return stored && frameworks.includes(stored as Framework)
-    ? (stored as Framework)
-    : "react"
-}
+// Get initial value from localStorage or default to the first framework ("react")
+const getInitialFramework = (): Framework => {
+  if (typeof window === "undefined") return DEFAULT_FRAMEWORK
+  try {
+    const stored = localStorage.getItem(FRAMEWORK_STORAGE_KEY)
+    return stored && frameworks.includes(stored as Framework)
+      ? (stored as Framework)
+      : DEFAULT_FRAMEWORK
+  } catch {
+    return DEFAULT_FRAMEWORK
+  }
+}
 
 export const frameworkAtom = createAtom<Framework>(getInitialFramework())
 
-// Subscribe to atom changes and persist to localStorage
+// Subscribe to atom changes, persist to localStorage, and sync across tabs
 if (typeof window !== "undefined") {
-  frameworkAtom.subscribe((framework) => {
-    localStorage.setItem(FRAMEWORK_STORAGE_KEY, framework)
-  })
+  const onStorage = (e: StorageEvent) => {
+    if (e.key === FRAMEWORK_STORAGE_KEY && typeof e.newValue === "string") {
+      if (frameworks.includes(e.newValue as Framework)) {
+        frameworkAtom.set(e.newValue as Framework)
+      }
+    }
+  }
+  const sub = frameworkAtom.subscribe((framework) => {
+    try {
+      localStorage.setItem(FRAMEWORK_STORAGE_KEY, framework)
+    } catch {
+      /* no-op */
+    }
+  })
+  window.addEventListener("storage", onStorage)
+  // HMR safety in dev
+  // @ts-expect-error Vite HMR
+  if (import.meta?.hot) {
+    // @ts-expect-error Vite HMR
+    import.meta.hot.dispose(() => {
+      sub.unsubscribe()
+      window.removeEventListener("storage", onStorage)
+    })
+  }
 }

7-13: Minor: use constant for default framework

Using DEFAULT_FRAMEWORK (first entry of frameworks) reduces duplication if the default ever changes.

apps/www/src/components/framework-select.tsx (1)

28-37: Add aria-label and avoid redundant sets

Improves a11y and prevents unnecessary state writes/re-renders.

     <Select
       className="w-20"
-      value={[framework]}
+      value={[framework]}
+      aria-label="Framework"
       onValueChange={(details) => {
         const newFramework = details.value[0] as Framework
-        frameworkAtom.set(newFramework)
+        if (newFramework !== framework) {
+          frameworkAtom.set(newFramework)
+        }
       }}
       collection={frameworksCollection}
       positioning={{ sameWidth: true }}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ab5b24d and 47215b7.

📒 Files selected for processing (45)
  • apps/www/content/components/accordion.mdx (1 hunks)
  • apps/www/content/components/avatar.mdx (1 hunks)
  • apps/www/content/components/button.mdx (1 hunks)
  • apps/www/content/components/checkbox.mdx (1 hunks)
  • apps/www/content/components/collapsible.mdx (1 hunks)
  • apps/www/content/components/combobox.mdx (1 hunks)
  • apps/www/content/components/dialog.mdx (1 hunks)
  • apps/www/content/components/hover-card.mdx (1 hunks)
  • apps/www/content/components/input.mdx (1 hunks)
  • apps/www/content/components/label.mdx (1 hunks)
  • apps/www/content/components/menu.mdx (1 hunks)
  • apps/www/content/components/number-input.mdx (1 hunks)
  • apps/www/content/components/pagination.mdx (1 hunks)
  • apps/www/content/components/pin-input.mdx (1 hunks)
  • apps/www/content/components/popover.mdx (1 hunks)
  • apps/www/content/components/progress.mdx (1 hunks)
  • apps/www/content/components/radio-group.mdx (1 hunks)
  • apps/www/content/components/rating-group.mdx (1 hunks)
  • apps/www/content/components/select.mdx (1 hunks)
  • apps/www/content/components/sheet.mdx (1 hunks)
  • apps/www/content/components/slider.mdx (1 hunks)
  • apps/www/content/components/switch.mdx (1 hunks)
  • apps/www/content/components/tabs.mdx (1 hunks)
  • apps/www/content/components/tags-input.mdx (1 hunks)
  • apps/www/content/components/textarea.mdx (1 hunks)
  • apps/www/content/components/toast.mdx (1 hunks)
  • apps/www/content/components/toggle-group.mdx (1 hunks)
  • apps/www/content/components/toggle.mdx (1 hunks)
  • apps/www/content/components/tooltip.mdx (1 hunks)
  • apps/www/content/components/tree-view.mdx (1 hunks)
  • apps/www/src/components/content/accordion.tsx (0 hunks)
  • apps/www/src/components/content/component-preview/index.astro (2 hunks)
  • apps/www/src/components/content/component-source.astro (1 hunks)
  • apps/www/src/components/content/example-source.astro (1 hunks)
  • apps/www/src/components/framework-select.tsx (2 hunks)
  • apps/www/src/components/framework-select/index.astro (0 hunks)
  • apps/www/src/components/sidebar.astro (2 hunks)
  • apps/www/src/components/site-header.astro (2 hunks)
  • apps/www/src/layouts/doc-layout.astro (1 hunks)
  • apps/www/src/layouts/root-layout.astro (1 hunks)
  • apps/www/src/lib/docs.ts (1 hunks)
  • apps/www/src/lib/framework-script.ts (1 hunks)
  • apps/www/src/lib/source.ts (2 hunks)
  • apps/www/src/pages/docs/components/[component].astro (1 hunks)
  • apps/www/src/store/atoms/framework.ts (1 hunks)
💤 Files with no reviewable changes (2)
  • apps/www/src/components/framework-select/index.astro
  • apps/www/src/components/content/accordion.tsx
🧰 Additional context used
📓 Path-based instructions (8)
apps/www/**/*

📄 CodeRabbit inference engine (.cursor/rules/overview.mdc)

Document all components and features in the documentation website (apps/www/)

Files:

  • apps/www/content/components/rating-group.mdx
  • apps/www/src/layouts/root-layout.astro
  • apps/www/content/components/pin-input.mdx
  • apps/www/src/store/atoms/framework.ts
  • apps/www/content/components/toggle.mdx
  • apps/www/content/components/popover.mdx
  • apps/www/content/components/radio-group.mdx
  • apps/www/content/components/switch.mdx
  • apps/www/content/components/progress.mdx
  • apps/www/content/components/menu.mdx
  • apps/www/content/components/checkbox.mdx
  • apps/www/content/components/sheet.mdx
  • apps/www/content/components/combobox.mdx
  • apps/www/content/components/tags-input.mdx
  • apps/www/content/components/textarea.mdx
  • apps/www/content/components/tabs.mdx
  • apps/www/content/components/accordion.mdx
  • apps/www/content/components/button.mdx
  • apps/www/content/components/tooltip.mdx
  • apps/www/content/components/label.mdx
  • apps/www/src/components/content/component-preview/index.astro
  • apps/www/content/components/toggle-group.mdx
  • apps/www/content/components/number-input.mdx
  • apps/www/content/components/toast.mdx
  • apps/www/content/components/hover-card.mdx
  • apps/www/src/lib/framework-script.ts
  • apps/www/content/components/select.mdx
  • apps/www/src/pages/docs/components/[component].astro
  • apps/www/content/components/pagination.mdx
  • apps/www/content/components/slider.mdx
  • apps/www/content/components/avatar.mdx
  • apps/www/src/components/content/example-source.astro
  • apps/www/src/components/framework-select.tsx
  • apps/www/content/components/dialog.mdx
  • apps/www/src/layouts/doc-layout.astro
  • apps/www/content/components/collapsible.mdx
  • apps/www/content/components/tree-view.mdx
  • apps/www/content/components/input.mdx
  • apps/www/src/lib/source.ts
  • apps/www/src/components/content/component-source.astro
  • apps/www/src/components/site-header.astro
  • apps/www/src/lib/docs.ts
  • apps/www/src/components/sidebar.astro
apps/www/content/**/*.mdx

📄 CodeRabbit inference engine (CLAUDE.md)

Place documentation as MDX files under apps/www/content

Place documentation MDX files under apps/www/content

Files:

  • apps/www/content/components/rating-group.mdx
  • apps/www/content/components/pin-input.mdx
  • apps/www/content/components/toggle.mdx
  • apps/www/content/components/popover.mdx
  • apps/www/content/components/radio-group.mdx
  • apps/www/content/components/switch.mdx
  • apps/www/content/components/progress.mdx
  • apps/www/content/components/menu.mdx
  • apps/www/content/components/checkbox.mdx
  • apps/www/content/components/sheet.mdx
  • apps/www/content/components/combobox.mdx
  • apps/www/content/components/tags-input.mdx
  • apps/www/content/components/textarea.mdx
  • apps/www/content/components/tabs.mdx
  • apps/www/content/components/accordion.mdx
  • apps/www/content/components/button.mdx
  • apps/www/content/components/tooltip.mdx
  • apps/www/content/components/label.mdx
  • apps/www/content/components/toggle-group.mdx
  • apps/www/content/components/number-input.mdx
  • apps/www/content/components/toast.mdx
  • apps/www/content/components/hover-card.mdx
  • apps/www/content/components/select.mdx
  • apps/www/content/components/pagination.mdx
  • apps/www/content/components/slider.mdx
  • apps/www/content/components/avatar.mdx
  • apps/www/content/components/dialog.mdx
  • apps/www/content/components/collapsible.mdx
  • apps/www/content/components/tree-view.mdx
  • apps/www/content/components/input.mdx
apps/www/**

📄 CodeRabbit inference engine (AGENTS.md)

Host the documentation site code in apps/www (Astro/MDX/Tailwind v4)

Files:

  • apps/www/content/components/rating-group.mdx
  • apps/www/src/layouts/root-layout.astro
  • apps/www/content/components/pin-input.mdx
  • apps/www/src/store/atoms/framework.ts
  • apps/www/content/components/toggle.mdx
  • apps/www/content/components/popover.mdx
  • apps/www/content/components/radio-group.mdx
  • apps/www/content/components/switch.mdx
  • apps/www/content/components/progress.mdx
  • apps/www/content/components/menu.mdx
  • apps/www/content/components/checkbox.mdx
  • apps/www/content/components/sheet.mdx
  • apps/www/content/components/combobox.mdx
  • apps/www/content/components/tags-input.mdx
  • apps/www/content/components/textarea.mdx
  • apps/www/content/components/tabs.mdx
  • apps/www/content/components/accordion.mdx
  • apps/www/content/components/button.mdx
  • apps/www/content/components/tooltip.mdx
  • apps/www/content/components/label.mdx
  • apps/www/src/components/content/component-preview/index.astro
  • apps/www/content/components/toggle-group.mdx
  • apps/www/content/components/number-input.mdx
  • apps/www/content/components/toast.mdx
  • apps/www/content/components/hover-card.mdx
  • apps/www/src/lib/framework-script.ts
  • apps/www/content/components/select.mdx
  • apps/www/src/pages/docs/components/[component].astro
  • apps/www/content/components/pagination.mdx
  • apps/www/content/components/slider.mdx
  • apps/www/content/components/avatar.mdx
  • apps/www/src/components/content/example-source.astro
  • apps/www/src/components/framework-select.tsx
  • apps/www/content/components/dialog.mdx
  • apps/www/src/layouts/doc-layout.astro
  • apps/www/content/components/collapsible.mdx
  • apps/www/content/components/tree-view.mdx
  • apps/www/content/components/input.mdx
  • apps/www/src/lib/source.ts
  • apps/www/src/components/content/component-source.astro
  • apps/www/src/components/site-header.astro
  • apps/www/src/lib/docs.ts
  • apps/www/src/components/sidebar.astro
apps/www/src/**

📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)

The main documentation website source code must be located under apps/www/src/

Files:

  • apps/www/src/layouts/root-layout.astro
  • apps/www/src/store/atoms/framework.ts
  • apps/www/src/components/content/component-preview/index.astro
  • apps/www/src/lib/framework-script.ts
  • apps/www/src/pages/docs/components/[component].astro
  • apps/www/src/components/content/example-source.astro
  • apps/www/src/components/framework-select.tsx
  • apps/www/src/layouts/doc-layout.astro
  • apps/www/src/lib/source.ts
  • apps/www/src/components/content/component-source.astro
  • apps/www/src/components/site-header.astro
  • apps/www/src/lib/docs.ts
  • apps/www/src/components/sidebar.astro
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/code-standards.mdc)

**/*.{ts,tsx}: Function names must use camelCase (e.g. buttonVariants, cn)
Constant names must use SCREAMING_SNAKE_CASE (e.g. DEFAULT_VARIANT)
Type interfaces must use PascalCase with Props suffix (e.g. ButtonProps)

Files:

  • apps/www/src/store/atoms/framework.ts
  • apps/www/src/lib/framework-script.ts
  • apps/www/src/components/framework-select.tsx
  • apps/www/src/lib/source.ts
  • apps/www/src/lib/docs.ts
**/*.{js,jsx,ts,tsx,json,jsonc}

📄 CodeRabbit inference engine (.cursor/rules/overview.mdc)

Maintain code quality and style as configured in biome.jsonc

Files:

  • apps/www/src/store/atoms/framework.ts
  • apps/www/src/lib/framework-script.ts
  • apps/www/src/components/framework-select.tsx
  • apps/www/src/lib/source.ts
  • apps/www/src/lib/docs.ts
**/*.{tsx,vue}

📄 CodeRabbit inference engine (.cursor/rules/code-standards.mdc)

**/*.{tsx,vue}: Component variable and function names must use PascalCase (e.g. Button, ToggleGroup)
Prefer Tailwind built-in classes for styling
Use semantic design tokens for styling
Support dark theme in component styles
Use Ark UI components as foundation for accessibility
Support keyboard navigation in components
Provide appropriate ARIA attributes in components
Support screen readers in components
Avoid unnecessary re-renders in components
Handle event listeners properly in components

Files:

  • apps/www/src/components/framework-select.tsx
**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/code-standards.mdc)

Organize complex styles through CVA (Class Variance Authority)

Files:

  • apps/www/src/components/framework-select.tsx
🧠 Learnings (2)
📚 Learning: 2025-08-30T18:58:30.720Z
Learnt from: CR
PR: shipbase/ui#0
File: AGENTS.md:0-0
Timestamp: 2025-08-30T18:58:30.720Z
Learning: Applies to packages/{react,vue}/src/**/*.{ts,tsx,vue} : Build components on top of Ark UI primitives in framework source code

Applied to files:

  • apps/www/src/components/content/component-source.astro
  • apps/www/src/components/site-header.astro
📚 Learning: 2025-08-03T17:49:32.389Z
Learnt from: CR
PR: shipbase/ui#0
File: .cursor/rules/component-development.mdc:0-0
Timestamp: 2025-08-03T17:49:32.389Z
Learning: Applies to packages/react/src/components/ui/*.tsx : React components are built on top of Ark UI components

Applied to files:

  • apps/www/src/components/site-header.astro
🧬 Code graph analysis (19)
apps/www/src/store/atoms/framework.ts (3)
apps/www/src/constants/frameworks.ts (1)
  • frameworks (3-3)
apps/www/src/components/ui-library-select.tsx (4)
  • FrameworkSwitcher (29-73)
  • details (52-54)
  • initialValue (32-46)
  • uiLibrary (39-41)
apps/www/src/components/content/component-install-cli/component-install-cli.tsx (1)
  • initialValue (30-44)
apps/www/content/components/toggle.mdx (1)
apps/www/src/components/content/component-preview/preview.tsx (1)
  • Props (8-10)
apps/www/content/components/progress.mdx (1)
apps/www/src/components/content/component-install-cli/component-install-cli.tsx (1)
  • Props (20-22)
apps/www/content/components/menu.mdx (1)
apps/www/src/components/content/component-preview/preview.tsx (1)
  • NotFound (44-54)
apps/www/content/components/sheet.mdx (1)
apps/www/src/components/content/component-install-cli/component-install-cli.tsx (2)
  • ComponentInstallCLI (26-91)
  • Props (20-22)
apps/www/content/components/tags-input.mdx (1)
apps/www/src/components/content/component-install-cli/component-install-cli.tsx (3)
  • ComponentInstallCLI (26-91)
  • Props (20-22)
  • key (81-87)
apps/www/content/components/textarea.mdx (2)
apps/www/src/components/content/component-install-cli/component-install-cli.tsx (1)
  • Props (20-22)
apps/www/src/components/content/component-preview/preview.tsx (1)
  • Props (8-10)
apps/www/content/components/button.mdx (1)
apps/www/src/components/content/component-install-cli/component-install-cli.tsx (1)
  • Props (20-22)
apps/www/content/components/tooltip.mdx (1)
apps/www/src/components/content/component-preview/preview.tsx (1)
  • NotFound (44-54)
apps/www/src/components/content/component-preview/index.astro (2)
apps/www/src/components/content/component-preview/tabs.tsx (2)
  • ComponentPreviewTabs (16-38)
  • Props (11-14)
apps/www/src/lib/remark-code-wrapper.ts (3)
  • remarkCodeWrapper (10-47)
  • node (15-44)
  • tree (11-46)
apps/www/content/components/toggle-group.mdx (1)
apps/www/src/components/content/component-install-cli/component-install-cli.tsx (2)
  • Props (20-22)
  • ComponentInstallCLI (26-91)
apps/www/content/components/number-input.mdx (2)
apps/www/src/components/content/component-install-cli/component-install-cli.tsx (1)
  • Props (20-22)
apps/www/src/components/content/component-preview/preview.tsx (1)
  • Props (8-10)
apps/www/src/lib/framework-script.ts (2)
apps/www/src/store/atoms/framework.ts (1)
  • frameworkAtom (16-16)
apps/www/src/lib/ui-library.ts (1)
  • subscription (10-28)
apps/www/content/components/avatar.mdx (1)
apps/www/src/components/content/component-preview/preview.tsx (1)
  • Props (8-10)
apps/www/src/components/content/example-source.astro (1)
apps/www/src/lib/remark-code-wrapper.ts (2)
  • node (15-44)
  • remarkCodeWrapper (10-47)
apps/www/src/components/framework-select.tsx (3)
apps/www/src/constants/frameworks.ts (1)
  • frameworks (3-3)
apps/www/src/store/atoms/framework.ts (1)
  • frameworkAtom (16-16)
apps/www/src/components/ui-library-select.tsx (3)
  • FrameworkSwitcher (29-73)
  • details (52-54)
  • initialValue (32-46)
apps/www/content/components/input.mdx (2)
apps/www/src/components/content/component-install-cli/component-install-cli.tsx (2)
  • Props (20-22)
  • ComponentInstallCLI (26-91)
apps/www/src/components/content/component-preview/preview.tsx (2)
  • Props (8-10)
  • NotFound (44-54)
apps/www/src/components/content/component-source.astro (1)
apps/www/src/components/content/component-preview/preview.tsx (1)
  • Props (8-10)
apps/www/src/components/site-header.astro (1)
apps/www/src/components/ui-library-select.tsx (2)
  • FrameworkSwitcher (29-73)
  • details (52-54)
🔇 Additional comments (35)
apps/www/content/components/select.mdx (1)

24-24: Prop rename looks good.

component → name aligns with the new API.

apps/www/content/components/slider.mdx (1)

24-24: Prop rename looks good.

component → name aligns with the new API.

apps/www/content/components/pin-input.mdx (1)

24-24: Approve prop rename; no lingering usages found.
Prop rename from component to name is correct and matches the new API. A search for any remaining <ComponentSource component=> occurrences in apps/www/content returned no matches. Approving code changes.

apps/www/content/components/textarea.mdx (1)

24-24: LGTM: ComponentSource now uses name.

Aligned with the new docs API.

apps/www/content/components/pagination.mdx (1)

24-24: LGTM: Prop rename applied.

No further changes needed here.

apps/www/src/layouts/doc-layout.astro (1)

43-43: Removing data-framework is safe
Search across CSS, JS, TS, Astro, JSX/TSX files yielded no selectors or scripts targeting [data-framework] or data-framework="react", so removing it has no downstream impact.

apps/www/content/components/sheet.mdx (1)

24-24: Verified component→name prop rename
No remaining <ComponentSource component= usages; name prop is defined in ComponentSource.

apps/www/content/components/rating-group.mdx (1)

25-25: Consistent prop rename to name.

<ComponentSource name="rating-group" /> matches the updated API and other docs.

apps/www/content/components/radio-group.mdx (1)

24-24: LGTM on the prop rename.

Uses name="radio-group" as expected with the new ComponentSource signature.

apps/www/content/components/checkbox.mdx (1)

24-24: Good: switched to name prop.

<ComponentSource name="checkbox" /> is aligned with the refactor.

apps/www/content/components/popover.mdx (1)

24-24: Correct prop update.

<ComponentSource name="popover" /> is consistent with the new API across docs.

apps/www/content/components/tags-input.mdx (1)

24-24: Prop rename to name is correct and all component prop usages have been removed.

apps/www/content/components/tooltip.mdx (1)

24-24: LGTM: ComponentSource now uses name="tooltip" per the new prop.

apps/www/content/components/combobox.mdx (1)

24-24: LGTM: component → name rename applied correctly.

apps/www/content/components/hover-card.mdx (1)

24-24: LGTM: ComponentSource prop rename is aligned with the refactor.

apps/www/content/components/dialog.mdx (1)

24-24: Prop rename to name is correct and consistent with the new API.

Matches the refactor toward <ComponentSource name="...">. LGTM.

apps/www/content/components/button.mdx (1)

24-24: Prop rename aligned with ComponentSource API.

name="button" is correct post-refactor.

apps/www/content/components/tabs.mdx (1)

24-24: LGTM: uses the new name prop.

No issues spotted.

apps/www/content/components/collapsible.mdx (1)

24-24: LGTM: consistent name prop usage.

Change is correct.

apps/www/content/components/input.mdx (1)

24-24: LGTM: ComponentSource now uses name.

Looks good.

apps/www/content/components/toggle.mdx (1)

27-27: Approve code changes. Prop rename to name aligns with ComponentSource API; sweep across apps/www/content/**/*.mdx confirmed no leftover component= usages.

apps/www/content/components/switch.mdx (1)

24-24: Rename to name is correct here as well.

Matches the new ComponentSource interface.

apps/www/content/components/accordion.mdx (1)

24-24: Accordion doc updated to name prop correctly.

Change is consistent with the global refactor.

apps/www/content/components/label.mdx (1)

24-24: Label doc uses the new name prop as intended.

Looks good.

apps/www/content/components/toast.mdx (1)

25-25: Toast doc updated to name prop; consistent with other pages.

No further changes needed.

apps/www/content/components/toggle-group.mdx (1)

24-24: Approve code changes: prop rename to name is correct and consistent with the new API; no remaining component prop usages found.

apps/www/src/lib/framework-script.ts (1)

16-20: No duplicate script inclusion found. Confirmed only one <script src="@/lib/framework-script.ts"> in apps/www/src/layouts/root-layout.astro (line 36).

apps/www/content/components/number-input.mdx (1)

24-24: Prop rename LGTM — no remaining component= prop usages detected.

apps/www/content/components/avatar.mdx (1)

24-24: Approve prop rename of component to name across MDX files
No further concerns.

apps/www/content/components/progress.mdx (1)

24-24: Approve code changes — no remaining component prop usages found
Verification script returned zero matches for component= in any ComponentSource within apps/www/content.

apps/www/content/components/tree-view.mdx (1)

25-25: Prop rename to name looks correct for ComponentSource.

Matches the new public API; nothing else to change here.

apps/www/src/components/site-header.astro (1)

8-8: Import source updated to named export — correct.

Switch to ./framework-select with a named export aligns with the new TSX component.

apps/www/src/components/content/component-preview/index.astro (1)

3-3: Good swap to ExampleSource for multi-framework code.

Import and usage are consistent with the new framework-toggling flow.

Also applies to: 29-29

apps/www/src/pages/docs/components/[component].astro (1)

12-20: Static paths simplification to per-component looks good.

Removes framework from params cleanly and keeps entry intact.

apps/www/src/components/content/component-source.astro (1)

7-11: All <ComponentSource> call sites have been updated to name=; the lone component= prop in ComponentPreview’s NotFound fallback (apps/www/src/components/content/component-preview/preview.tsx:14) is unrelated and expected.

Comment thread apps/www/content/components/dialog.mdx
Comment thread apps/www/src/components/content/component-source.astro
Comment thread apps/www/src/components/content/example-source.astro
Comment thread apps/www/src/components/sidebar.astro
Comment thread apps/www/src/layouts/root-layout.astro Outdated
Comment thread apps/www/src/lib/docs.ts
@iamdin
iamdin force-pushed the refactor/framework-switch branch from cc9c41a to c1e042e Compare August 31, 2025 10:12

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (7)
apps/www/src/components/content/component-preview/index.astro (1)

29-29: Render ExampleSource in code tab — consider lazy evaluation (optional)

If ExampleSource emits multi-framework blocks, rendering it by default adds markup cost even when “Code” tab isn’t active. Consider conditional render on tab change to defer work.

apps/www/src/store/atoms/framework.ts (2)

5-15: Harden initialization and centralize default

LocalStorage can throw (e.g., Safari private mode). Also, a shared DEFAULT avoids “react” string duplication.

+const DEFAULT_FRAMEWORK: Framework = "react"
+
 // Get initial value from localStorage or default to "react"
 const getInitialFramework = (): Framework => {
-  if (typeof window === "undefined") return "react"
-  const stored = localStorage.getItem(FRAMEWORK_STORAGE_KEY)
-  return stored && frameworks.includes(stored as Framework)
-    ? (stored as Framework)
-    : "react"
+  if (typeof window === "undefined") return DEFAULT_FRAMEWORK
+  try {
+    const stored = localStorage.getItem(FRAMEWORK_STORAGE_KEY)
+    return stored && frameworks.includes(stored as Framework)
+      ? (stored as Framework)
+      : DEFAULT_FRAMEWORK
+  } catch {
+    return DEFAULT_FRAMEWORK
+  }
 }

19-23: Guard persistence with try/catch

Avoid crashes if storage is unavailable.

 if (typeof window !== "undefined") {
   frameworkAtom.subscribe((framework) => {
-    localStorage.setItem(FRAMEWORK_STORAGE_KEY, framework)
+    try {
+      localStorage.setItem(FRAMEWORK_STORAGE_KEY, framework)
+    } catch {
+      /* no-op */
+    }
   })
 }
.github/workflows/deploy.yml (4)

4-5: Preview only runs on pushes to next

With this trigger, the “preview” job won’t run for feature branches or PRs. If you want branch/PR previews, add pull_request and/or broaden branches.

 on:
-  push: 
-    branches: ['next']
+  push:
+    branches: ['**']
+  pull_request:
+    branches: ['next']

33-41: YAML style nits and wrangler command check

Fix extra spaces; verify the “versions upload” command is the intended Workers flow for previews.

-      - name:  Deploy to Cloudflare Workers
+      - name: Deploy to Cloudflare Workers
         id: deploy
-        uses:  cloudflare/wrangler-action@v3
+        uses: cloudflare/wrangler-action@v3
         with:
           apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
           workingDirectory: "apps/www"
           packageManager: pnpm
           command: versions upload --message=${{ github.ref_name }} --tag=${{ github.sha }}

42-46: Output variable may differ

Confirm wrangler-action exposes deployment-url for Workers “versions upload”. Adjust key if needed and remove trailing space.

       - name: Deployed URL
         env:
           DEPLOYMENT_URL: ${{ steps.deploy.outputs.deployment-url }}
-        run: echo $DEPLOYMENT_URL
-  
+        run: echo "$DEPLOYMENT_URL"

72-78: Production step spacing

Normalize spacing to satisfy linters; mirrors preview fix.

-      - name:  Deploy to Cloudflare Workers
-        uses:  cloudflare/wrangler-action@v3
+      - name: Deploy to Cloudflare Workers
+        uses: cloudflare/wrangler-action@v3
         with:
           apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
           workingDirectory: "apps/www"
           packageManager: pnpm
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 47215b7 and c1e042e.

📒 Files selected for processing (46)
  • .github/workflows/deploy.yml (1 hunks)
  • apps/www/content/components/accordion.mdx (1 hunks)
  • apps/www/content/components/avatar.mdx (1 hunks)
  • apps/www/content/components/button.mdx (1 hunks)
  • apps/www/content/components/checkbox.mdx (1 hunks)
  • apps/www/content/components/collapsible.mdx (1 hunks)
  • apps/www/content/components/combobox.mdx (1 hunks)
  • apps/www/content/components/dialog.mdx (1 hunks)
  • apps/www/content/components/hover-card.mdx (1 hunks)
  • apps/www/content/components/input.mdx (1 hunks)
  • apps/www/content/components/label.mdx (1 hunks)
  • apps/www/content/components/menu.mdx (1 hunks)
  • apps/www/content/components/number-input.mdx (1 hunks)
  • apps/www/content/components/pagination.mdx (1 hunks)
  • apps/www/content/components/pin-input.mdx (1 hunks)
  • apps/www/content/components/popover.mdx (1 hunks)
  • apps/www/content/components/progress.mdx (1 hunks)
  • apps/www/content/components/radio-group.mdx (1 hunks)
  • apps/www/content/components/rating-group.mdx (1 hunks)
  • apps/www/content/components/select.mdx (1 hunks)
  • apps/www/content/components/sheet.mdx (1 hunks)
  • apps/www/content/components/slider.mdx (1 hunks)
  • apps/www/content/components/switch.mdx (1 hunks)
  • apps/www/content/components/tabs.mdx (1 hunks)
  • apps/www/content/components/tags-input.mdx (1 hunks)
  • apps/www/content/components/textarea.mdx (1 hunks)
  • apps/www/content/components/toast.mdx (1 hunks)
  • apps/www/content/components/toggle-group.mdx (1 hunks)
  • apps/www/content/components/toggle.mdx (1 hunks)
  • apps/www/content/components/tooltip.mdx (1 hunks)
  • apps/www/content/components/tree-view.mdx (1 hunks)
  • apps/www/src/components/content/accordion.tsx (0 hunks)
  • apps/www/src/components/content/component-preview/index.astro (2 hunks)
  • apps/www/src/components/content/component-source.astro (1 hunks)
  • apps/www/src/components/content/example-source.astro (1 hunks)
  • apps/www/src/components/framework-select.tsx (2 hunks)
  • apps/www/src/components/framework-select/index.astro (0 hunks)
  • apps/www/src/components/sidebar.astro (2 hunks)
  • apps/www/src/components/site-header.astro (2 hunks)
  • apps/www/src/layouts/doc-layout.astro (1 hunks)
  • apps/www/src/layouts/root-layout.astro (1 hunks)
  • apps/www/src/lib/docs.ts (1 hunks)
  • apps/www/src/lib/framework-script.ts (1 hunks)
  • apps/www/src/lib/source.ts (2 hunks)
  • apps/www/src/pages/docs/components/[component].astro (1 hunks)
  • apps/www/src/store/atoms/framework.ts (1 hunks)
💤 Files with no reviewable changes (2)
  • apps/www/src/components/framework-select/index.astro
  • apps/www/src/components/content/accordion.tsx
✅ Files skipped from review due to trivial changes (3)
  • apps/www/content/components/dialog.mdx
  • apps/www/content/components/toggle.mdx
  • apps/www/content/components/popover.mdx
🚧 Files skipped from review as they are similar to previous changes (36)
  • apps/www/content/components/number-input.mdx
  • apps/www/content/components/pagination.mdx
  • apps/www/content/components/avatar.mdx
  • apps/www/content/components/menu.mdx
  • apps/www/content/components/label.mdx
  • apps/www/src/layouts/doc-layout.astro
  • apps/www/content/components/sheet.mdx
  • apps/www/content/components/select.mdx
  • apps/www/content/components/collapsible.mdx
  • apps/www/content/components/tree-view.mdx
  • apps/www/content/components/combobox.mdx
  • apps/www/content/components/input.mdx
  • apps/www/content/components/toast.mdx
  • apps/www/content/components/tooltip.mdx
  • apps/www/content/components/hover-card.mdx
  • apps/www/src/lib/framework-script.ts
  • apps/www/src/layouts/root-layout.astro
  • apps/www/content/components/radio-group.mdx
  • apps/www/src/components/sidebar.astro
  • apps/www/content/components/button.mdx
  • apps/www/content/components/slider.mdx
  • apps/www/src/components/site-header.astro
  • apps/www/content/components/textarea.mdx
  • apps/www/content/components/accordion.mdx
  • apps/www/src/components/framework-select.tsx
  • apps/www/src/lib/docs.ts
  • apps/www/src/components/content/example-source.astro
  • apps/www/content/components/pin-input.mdx
  • apps/www/content/components/progress.mdx
  • apps/www/content/components/rating-group.mdx
  • apps/www/src/lib/source.ts
  • apps/www/content/components/switch.mdx
  • apps/www/content/components/toggle-group.mdx
  • apps/www/content/components/checkbox.mdx
  • apps/www/src/components/content/component-source.astro
  • apps/www/src/pages/docs/components/[component].astro
🧰 Additional context used
📓 Path-based instructions (6)
apps/www/**/*

📄 CodeRabbit inference engine (.cursor/rules/overview.mdc)

Document all components and features in the documentation website (apps/www/)

Files:

  • apps/www/content/components/tags-input.mdx
  • apps/www/content/components/tabs.mdx
  • apps/www/src/store/atoms/framework.ts
  • apps/www/src/components/content/component-preview/index.astro
apps/www/content/**/*.mdx

📄 CodeRabbit inference engine (CLAUDE.md)

Place documentation as MDX files under apps/www/content

Place documentation MDX files under apps/www/content

Files:

  • apps/www/content/components/tags-input.mdx
  • apps/www/content/components/tabs.mdx
apps/www/**

📄 CodeRabbit inference engine (AGENTS.md)

Host the documentation site code in apps/www (Astro/MDX/Tailwind v4)

Files:

  • apps/www/content/components/tags-input.mdx
  • apps/www/content/components/tabs.mdx
  • apps/www/src/store/atoms/framework.ts
  • apps/www/src/components/content/component-preview/index.astro
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/code-standards.mdc)

**/*.{ts,tsx}: Function names must use camelCase (e.g. buttonVariants, cn)
Constant names must use SCREAMING_SNAKE_CASE (e.g. DEFAULT_VARIANT)
Type interfaces must use PascalCase with Props suffix (e.g. ButtonProps)

Files:

  • apps/www/src/store/atoms/framework.ts
**/*.{js,jsx,ts,tsx,json,jsonc}

📄 CodeRabbit inference engine (.cursor/rules/overview.mdc)

Maintain code quality and style as configured in biome.jsonc

Files:

  • apps/www/src/store/atoms/framework.ts
apps/www/src/**

📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)

The main documentation website source code must be located under apps/www/src/

Files:

  • apps/www/src/store/atoms/framework.ts
  • apps/www/src/components/content/component-preview/index.astro
🧠 Learnings (1)
📚 Learning: 2025-08-03T17:49:32.389Z
Learnt from: CR
PR: shipbase/ui#0
File: .cursor/rules/component-development.mdc:0-0
Timestamp: 2025-08-03T17:49:32.389Z
Learning: Applies to {packages/react/src/components/ui/*.tsx,packages/vue/src/components/ui/*/*.vue} : Use cn() utility function to merge class names

Applied to files:

  • apps/www/src/components/content/component-preview/index.astro
🧬 Code graph analysis (3)
apps/www/content/components/tags-input.mdx (1)
apps/www/src/components/content/component-install-cli/component-install-cli.tsx (3)
  • ComponentInstallCLI (26-91)
  • key (81-87)
  • Props (20-22)
apps/www/src/store/atoms/framework.ts (3)
apps/www/src/constants/frameworks.ts (1)
  • frameworks (3-3)
apps/www/src/components/ui-library-select.tsx (3)
  • FrameworkSwitcher (29-73)
  • details (52-54)
  • initialValue (32-46)
apps/www/src/components/content/component-install-cli/component-install-cli.tsx (1)
  • initialValue (30-44)
apps/www/src/components/content/component-preview/index.astro (2)
apps/www/src/components/content/component-preview/tabs.tsx (2)
  • ComponentPreviewTabs (16-38)
  • Props (11-14)
apps/www/src/components/content/component-preview/preview.tsx (3)
  • PreviewReact (12-42)
  • NotFound (44-54)
  • NotFound (15-15)
🪛 YAMLlint (1.37.1)
.github/workflows/deploy.yml

[warning] 33-33: too many spaces after colon

(colons)


[warning] 35-35: too many spaces after colon

(colons)


[error] 46-46: trailing spaces

(trailing-spaces)

🔇 Additional comments (4)
apps/www/content/components/tags-input.mdx (1)

24-24: Approve prop rename; no leftover <ComponentSource component= usages found.
Ran rg -nP '<ComponentSource\s+component=' apps/www -S—returned no matches, confirming all instances updated to name=.

apps/www/content/components/tabs.mdx (1)

24-24: Prop rename applied consistently
Verified that all <ComponentSource> usages now use the name prop; no component prop remains.

apps/www/src/components/content/component-preview/index.astro (1)

3-3: Import switch to ExampleSource is fine

Import path and symbol look correct for the new multi-framework code rendering.

.github/workflows/deploy.yml (1)

27-32: Ensure install/build run in apps/www workspace (if required)

If the monorepo expects app-local build scripts, scope the working directory. Otherwise, ignore.

       - name: Install dependencies
-        run: pnpm install --frozen-lockfile
+        working-directory: apps/www
+        run: pnpm install --frozen-lockfile

       - name: Build
-        run: pnpm run build
+        working-directory: apps/www
+        run: pnpm run build

Replicate in the production job.

Also applies to: 66-71

Comment thread .github/workflows/deploy.yml
@iamdin
iamdin force-pushed the refactor/framework-switch branch from c1e042e to 6330fe6 Compare August 31, 2025 10:21
@iamdin
iamdin force-pushed the refactor/framework-switch branch from 6330fe6 to f158c2d Compare August 31, 2025 10:25
@github-actions

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
apps/www/src/components/content/component-preview/preview.tsx (2)

22-28: ARIA: label the button, hide the decorative icon.

Move aria-label to Button and mark the icon aria-hidden.

Apply this diff:

-      <Button
-        onClick={() => setKey((prev) => prev + 1)}
-        variant="ghost"
-        className="absolute top-2 right-2"
-      >
-        <RotateCcw aria-label="restart-btn" size={16} />
+      <Button
+        aria-label="Restart preview"
+        onClick={() => setKey((prev) => prev + 1)}
+        variant="ghost"
+        className="absolute top-2 right-2"
+      >
+        <RotateCcw aria-hidden size={16} />

31-31: Invalid Tailwind class "max-w-8/12".

Use an arbitrary value or a width utility.

Apply one of:

-        className="flex size-full max-w-8/12 flex-1 items-center justify-center "
+        className="flex size-full max-w-[66%] flex-1 items-center justify-center"

or

-        className="flex size-full max-w-8/12 flex-1 items-center justify-center "
+        className="flex size-full w-8/12 flex-1 items-center justify-center"
apps/www/src/lib/source.ts (1)

43-59: Skip non-source exports to avoid undefined filename/lang.

If an export points to "./style.css" or other unsupported extensions, extractFileInfo returns [], producing "undefined.undefined". Filter by allowed extensions before reading files.

Apply this diff:

-  const sources = await Promise.all(
-    exports
-      .filter((exp) => exp.specifier?.startsWith("./"))
-      .map(async (exp) => {
+  const sources = await Promise.all(
+    exports
+      .filter(
+        (exp) =>
+          exp.specifier?.startsWith("./") &&
+          /\.(vue|ts|tsx)$/.test(exp.specifier!),
+      )
+      .map(async (exp) => {
         // biome-ignore lint/style/noNonNullAssertion: <explanation>
         const [, name, lang] = extractFileInfo(exp.specifier!)
 
         return {
           filename: `${name}.${lang}`,
           content: await fs.readFile(
             // biome-ignore lint/style/noNonNullAssertion: <explanation>
             path.resolve(path.dirname(entryPath.result), exp.specifier!),
             "utf-8"
           ),
           lang: lang as BuiltinLanguage,
         }
       })
   )
♻️ Duplicate comments (1)
.github/workflows/deploy.yml (1)

27-28: Invalid/empty node-version-file may break setup-node.

Pin a Node version or point to a real file. Apply in both jobs.

Apply this diff:

-          node-version-file: ''
+          node-version: 20.x
           cache: pnpm

Also applies to: 75-76

🧹 Nitpick comments (7)
biome.jsonc (1)

11-11: Typo? "packages.json" → "package.json".

The ignore entry likely intends the standard package.json.

Apply this diff:

-      "packages.json"
+      "package.json"
apps/www/src/components/content/component-preview/preview.tsx (2)

14-14: Fallback component creation on every render.

Minor: define the NotFound fallback once to avoid recreating a function each render.

Apply this diff:

-  const Component = Examples[name] ?? (() => <NotFound name={name} />)
+  const Fallback = () => <NotFound name={name} />
+  const Component = Examples[name] ?? Fallback

48-56: Add whitespace around the inline code for readability.

Without explicit spaces, "Component" and "not found…" can butt up against the code element.

Apply this diff:

-    <p className="text-muted-foreground text-sm">
-      Component
-      <code className="rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm">
-        {name}
-      </code>
-      not found in registry.
+    <p className="text-muted-foreground text-sm">
+      Component{" "}
+      <code className="rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm">
+        {name}
+      </code>{" "}
+      not found in registry.
apps/www/src/store/atoms/framework.ts (1)

12-22: Tighten DOM toggle and avoid repeated get().

Use classList.toggle and cache the current value. Also persist after computing UI changes.

Apply this diff:

-const handler = () => {
-  for (const element of document.querySelectorAll("[data-framework]")) {
-    if (element.getAttribute("data-framework") === frameworkAtom.get()) {
-      element.classList.remove("hidden")
-    } else {
-      element.classList.add("hidden")
-    }
-  }
-
-  localStorage.setItem(FRAMEWORK_STORAGE_KEY, frameworkAtom.get())
-}
+const handler = () => {
+  const current = frameworkAtom.get()
+  for (const element of document.querySelectorAll("[data-framework]")) {
+    element.classList.toggle(
+      "hidden",
+      element.getAttribute("data-framework") !== current,
+    )
+  }
+  localStorage.setItem(FRAMEWORK_STORAGE_KEY, current)
+}
.github/workflows/deploy.yml (3)

45-57: deployment-url output may be undefined for wrangler versions upload.

Guard the comment step to avoid posting “undefined”.

Apply this diff:

       - name: Comment PR with Preview URL
         uses: actions/github-script@v7
         with:
           script: |
-            const deploymentUrl = "${{ steps.deploy.outputs.deployment-url }}";
-            const body = `🚀 Preview: ${deploymentUrl}`;
-            
-            github.rest.issues.createComment({
-              issue_number: context.issue.number,
-              owner: context.repo.owner,
-              repo: context.repo.repo,
-              body: body
-            });
+            const deploymentUrl = "${{ steps.deploy.outputs.deployment-url }}";
+            if (!deploymentUrl) {
+              core.warning('wrangler-action did not expose deployment-url output');
+              return;
+            }
+            const body = `🚀 Preview: ${deploymentUrl}`;
+            await github.rest.issues.createComment({
+              issue_number: context.issue.number,
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              body,
+            });

51-51: YAML lint: trailing spaces.

Remove trailing spaces to satisfy yamllint.

Apply this diff:

-            
+
@@
-  
+

Also applies to: 58-58


10-17: Optional: add concurrency to cancel superseded preview runs.

Prevents piling up preview uploads for the same PR.

Apply this block at the job level:

   preview:
     name: Preview Deployment
+    concurrency:
+      group: preview-${{ github.event.pull_request.number || github.ref }}
+      cancel-in-progress: true
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6330fe6 and 94d1819.

📒 Files selected for processing (10)
  • .github/workflows/deploy.yml (2 hunks)
  • apps/www/src/components/content/component-preview/component-code.astro (0 hunks)
  • apps/www/src/components/content/component-preview/index.astro (2 hunks)
  • apps/www/src/components/content/component-preview/preview.tsx (2 hunks)
  • apps/www/src/components/content/example-source.astro (1 hunks)
  • apps/www/src/components/site-header.astro (2 hunks)
  • apps/www/src/layouts/root-layout.astro (1 hunks)
  • apps/www/src/lib/source.ts (3 hunks)
  • apps/www/src/store/atoms/framework.ts (1 hunks)
  • biome.jsonc (1 hunks)
💤 Files with no reviewable changes (1)
  • apps/www/src/components/content/component-preview/component-code.astro
🚧 Files skipped from review as they are similar to previous changes (4)
  • apps/www/src/layouts/root-layout.astro
  • apps/www/src/components/content/example-source.astro
  • apps/www/src/components/site-header.astro
  • apps/www/src/components/content/component-preview/index.astro
🧰 Additional context used
📓 Path-based instructions (9)
biome.jsonc

📄 CodeRabbit inference engine (.cursor/rules/code-standards.mdc)

biome.jsonc: 2 space indentation
Use semicolons for statement endings
Single quote strings
Trailing commas (multiline)

The biome.jsonc file must be present at the root for code formatting and linting configuration

Files:

  • biome.jsonc
**/*.{js,jsx,ts,tsx,json,jsonc}

📄 CodeRabbit inference engine (.cursor/rules/overview.mdc)

Maintain code quality and style as configured in biome.jsonc

Files:

  • biome.jsonc
  • apps/www/src/components/content/component-preview/preview.tsx
  • apps/www/src/store/atoms/framework.ts
  • apps/www/src/lib/source.ts
{package.json,pnpm-workspace.yaml,turbo.json,biome.jsonc}

📄 CodeRabbit inference engine (.cursor/rules/overview.mdc)

Ensure all configuration files are kept up-to-date and valid (package.json, pnpm-workspace.yaml, turbo.json, biome.jsonc)

Files:

  • biome.jsonc
**/*.{tsx,vue}

📄 CodeRabbit inference engine (.cursor/rules/code-standards.mdc)

**/*.{tsx,vue}: Component variable and function names must use PascalCase (e.g. Button, ToggleGroup)
Prefer Tailwind built-in classes for styling
Use semantic design tokens for styling
Support dark theme in component styles
Use Ark UI components as foundation for accessibility
Support keyboard navigation in components
Provide appropriate ARIA attributes in components
Support screen readers in components
Avoid unnecessary re-renders in components
Handle event listeners properly in components

Files:

  • apps/www/src/components/content/component-preview/preview.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/code-standards.mdc)

**/*.{ts,tsx}: Function names must use camelCase (e.g. buttonVariants, cn)
Constant names must use SCREAMING_SNAKE_CASE (e.g. DEFAULT_VARIANT)
Type interfaces must use PascalCase with Props suffix (e.g. ButtonProps)

Files:

  • apps/www/src/components/content/component-preview/preview.tsx
  • apps/www/src/store/atoms/framework.ts
  • apps/www/src/lib/source.ts
**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/code-standards.mdc)

Organize complex styles through CVA (Class Variance Authority)

Files:

  • apps/www/src/components/content/component-preview/preview.tsx
apps/www/**/*

📄 CodeRabbit inference engine (.cursor/rules/overview.mdc)

Document all components and features in the documentation website (apps/www/)

Files:

  • apps/www/src/components/content/component-preview/preview.tsx
  • apps/www/src/store/atoms/framework.ts
  • apps/www/src/lib/source.ts
apps/www/src/**

📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)

The main documentation website source code must be located under apps/www/src/

Files:

  • apps/www/src/components/content/component-preview/preview.tsx
  • apps/www/src/store/atoms/framework.ts
  • apps/www/src/lib/source.ts
apps/www/**

📄 CodeRabbit inference engine (AGENTS.md)

Host the documentation site code in apps/www (Astro/MDX/Tailwind v4)

Files:

  • apps/www/src/components/content/component-preview/preview.tsx
  • apps/www/src/store/atoms/framework.ts
  • apps/www/src/lib/source.ts
🧠 Learnings (3)
📚 Learning: 2025-08-03T17:50:06.904Z
Learnt from: CR
PR: shipbase/ui#0
File: .cursor/rules/project-structure.mdc:0-0
Timestamp: 2025-08-03T17:50:06.904Z
Learning: Applies to biome.jsonc : The biome.jsonc file must be present at the root for code formatting and linting configuration

Applied to files:

  • biome.jsonc
📚 Learning: 2025-08-03T17:49:50.919Z
Learnt from: CR
PR: shipbase/ui#0
File: .cursor/rules/overview.mdc:0-0
Timestamp: 2025-08-03T17:49:50.919Z
Learning: Applies to **/*.{js,jsx,ts,tsx,json,jsonc} : Maintain code quality and style as configured in biome.jsonc

Applied to files:

  • biome.jsonc
📚 Learning: 2025-08-03T17:49:16.881Z
Learnt from: CR
PR: shipbase/ui#0
File: .cursor/rules/code-standards.mdc:0-0
Timestamp: 2025-08-03T17:49:16.881Z
Learning: Applies to biome.jsonc : 2 space indentation

Applied to files:

  • biome.jsonc
🧬 Code graph analysis (1)
apps/www/src/store/atoms/framework.ts (3)
apps/www/src/components/ui-library-select.tsx (4)
  • FrameworkSwitcher (29-73)
  • details (52-54)
  • initialValue (32-46)
  • uiLibrary (39-41)
apps/www/src/components/content/component-install-cli/component-install-cli.tsx (1)
  • initialValue (30-44)
apps/www/src/lib/ui-library.ts (1)
  • subscription (10-28)
🪛 YAMLlint (1.37.1)
.github/workflows/deploy.yml

[error] 51-51: trailing spaces

(trailing-spaces)


[error] 58-58: trailing spaces

(trailing-spaces)

🔇 Additional comments (2)
biome.jsonc (1)

9-10: Ignore additions look good.

Excluding Wrangler and Next build artifacts from tooling is appropriate.

apps/www/src/store/atoms/framework.ts (1)

28-30: Validate stored framework value.

If localStorage contains an unexpected value, you could end up hiding all blocks. Consider validating against the known frameworks list before set.

I can wire this to your frameworks constant (e.g., frameworks.includes(value)) if you confirm where it lives.

Comment on lines +24 to +34
document.addEventListener("astro:page-load", () => {
subscription?.unsubscribe()

// sync state in client
frameworkAtom.set(
(localStorage.getItem(FRAMEWORK_STORAGE_KEY) as Framework) || "react"
)

handler()
subscription = frameworkAtom.subscribe(handler)
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Guard against SSR: document is undefined on the server.

Wrap the event listener to ensure it runs only in the browser.

Apply this diff:

-document.addEventListener("astro:page-load", () => {
+if (typeof document !== "undefined") {
+  document.addEventListener("astro:page-load", () => {
     subscription?.unsubscribe()
 
     // sync state in client
     frameworkAtom.set(
       (localStorage.getItem(FRAMEWORK_STORAGE_KEY) as Framework) || "react"
     )
 
     handler()
     subscription = frameworkAtom.subscribe(handler)
-})
+  })
+}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
document.addEventListener("astro:page-load", () => {
subscription?.unsubscribe()
// sync state in client
frameworkAtom.set(
(localStorage.getItem(FRAMEWORK_STORAGE_KEY) as Framework) || "react"
)
handler()
subscription = frameworkAtom.subscribe(handler)
})
if (typeof document !== "undefined") {
document.addEventListener("astro:page-load", () => {
subscription?.unsubscribe()
// sync state in client
frameworkAtom.set(
(localStorage.getItem(FRAMEWORK_STORAGE_KEY) as Framework) || "react"
)
handler()
subscription = frameworkAtom.subscribe(handler)
})
}
🤖 Prompt for AI Agents
In apps/www/src/store/atoms/framework.ts around lines 24 to 34, the
document.addEventListener call runs during SSR and will throw because document
is undefined; guard this by wrapping the whole block in a runtime browser check
(e.g., if (typeof window !== "undefined" && typeof document !== "undefined") {
... }) so the event listener, localStorage access and subscription logic only
execute in the client, keeping existing behavior otherwise.

@iamdin
iamdin merged commit 65f9121 into next Aug 31, 2025
4 checks passed
@iamdin
iamdin deleted the refactor/framework-switch branch August 31, 2025 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant