Skip to content

Unify app headers and brand metadata#4

Open
Acex187x wants to merge 1 commit into
mainfrom
t3code/7e6cefab
Open

Unify app headers and brand metadata#4
Acex187x wants to merge 1 commit into
mainfrom
t3code/7e6cefab

Conversation

@Acex187x

@Acex187x Acex187x commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Introduce a shared AppHeader component in @wikipefia/ui and use it across admin to standardize app chrome.
  • Align brand metadata in chat so the product name and product label are split consistently.
  • Simplify Convex client/env loading in admin and tighten shell/header implementations in portal, studio, and library.
  • Refresh thread/sidebar and page masthead components to match the shared branding and layout patterns.

Testing

  • Not run
  • Checked the diff for header, branding, and provider updates across admin, chat, library, portal, and studio.
  • Not run: app-level build/typecheck for admin, chat, library, portal, and studio.

Summary by CodeRabbit

  • New Features

    • Added new header UI components for standardized branding across Admin, Studio, Library, and Portal applications.
    • Enhanced chat interface with badge-based styling and component updates.
  • Refactor

    • Standardized header layouts and typography across multiple apps for improved consistency.
    • Reorganized design token sourcing to improve code maintainability.

- Replace bespoke admin chrome with shared `AppHeader`
- Split product name/product branding for chat shell
- Add reusable header component to `@wikipefia/ui`
@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds AppHeader and AppWordmark as shared forwardRef components to packages/ui and migrates all app-level headers (admin, library, portal, studio) and the chat ThreadSidebar to consume them. Design token C re-exports in portal and studio are moved from @wikipefia/mdx-renderer to @wikipefia/ui. The chat ThreadView replaces a custom span with the shared Badge component.

Changes

Shared AppHeader/AppWordmark Rollout

Layer / File(s) Summary
AppHeader and AppWordmark components
packages/ui/src/components/app-header.tsx, packages/ui/src/components/index.ts
Defines AppWordmark (brand text + optional accent product suffix) and AppHeader (full-width dark header bar with left brand slot, conditional ThemeToggle, and right slot) as forwardRef components, then re-exports them from the package index.
Design token C re-export migration
apps/portal/lib/theme.ts, apps/studio/lib/theme.ts
Switches the C constant re-export source from @wikipefia/mdx-renderer to @wikipefia/ui in both the portal and studio theme modules.
Admin, Library, and Portal header adoption
apps/admin/components/layout/admin-shell.tsx, apps/library/components/masthead.tsx, apps/library/app/file/[id]/page.tsx, apps/portal/components/shared/page-shell.tsx
Replaces inline header markup with AppHeader/AppWordmark in admin shell, library masthead (with conditional Upload button via right prop), and portal page-shell (AppWordmark in home link). Updates library file page Download link to use buttonVariants-composed className.
Studio page header and WelcomeHeader refactor
apps/studio/app/page.tsx
Imports AppHeader, AppWordmark, and ThemeToggle from shared UI; removes the local useTheme dependency; replaces the custom editor header block and theme toggle button; simplifies WelcomeHeader to a zero-prop function returning <AppHeader product="Studio" />; adds a "use no memo" directive.
Chat package brand field and component polish
packages/chat/src/react/transport-context.tsx, packages/chat/src/react/components/ThreadSidebar.tsx, packages/chat/src/react/components/ThreadView.tsx, apps/chat/components/ChatProvider.tsx
Adds optional product field to ChatHostConfig.brand and ThreadSidebarProps.brand; renders AppWordmark in ThreadSidebar header with C.headerBg/C.headerText styling; replaces the custom ThreadModeBadge <span> with the Badge component in ThreadView; updates ChatProvider brand config to product: "Chat".

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Wikipefia/wikipefia-ck#1: Introduces the initial shared UI primitives and styles in packages/ui that this PR builds on by adding AppHeader/AppWordmark and adopting them across apps.

Poem

🐇 Hoppity-hop through the header land,
Where AppHeader now rules, sleek and grand!
No more inline markup, no scattered spans,
One wordmark to rule all wikipefia plans.
The token C hops from mdx to ui,
And every shell shines — oh my, oh my! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 38.46% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Unify app headers and brand metadata' directly and clearly summarizes the main objective of this changeset: introducing a unified AppHeader component and standardizing brand metadata across multiple applications.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch t3code/7e6cefab

Comment @coderabbitai help to get the list of available commands and usage tips.

@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: 3

Caution

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

⚠️ Outside diff range comments (1)
apps/library/app/file/[id]/page.tsx (1)

148-155: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Align the new Download CTA with tokenized colors and uppercase label rules.

The updated button composition still includes a hardcoded color (text-white) and non-uppercase label text.

Suggested patch
-import { FONT } from "`@/lib/theme`";
+import { C, FONT } from "`@/lib/theme`";
@@
               className={cn(
                 buttonVariants({ size: "sm" }),
-                "border-accent bg-accent text-white",
+                "uppercase tracking-wider",
               )}
-              style={{ fontFamily: FONT.mono }}
+              style={{
+                fontFamily: FONT.mono,
+                borderColor: C.accent,
+                backgroundColor: C.accent,
+                color: C.bgWhite,
+              }}
             >
-              ↓ Download
+              ↓ DOWNLOAD
             </a>

As per coding guidelines, "Use CSS variables (C.bg, C.bgWhite, C.text, C.textMuted, C.accent, C.border, C.borderLight, C.headerBg, C.headerText) imported from @/lib/theme for all styling; never hardcode colors except for subject palette colors" and "Apply uppercase styling to all headers, labels, navigation, badges, and breadcrumbs using text-transform or Tailwind uppercase utility".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/library/app/file/`[id]/page.tsx around lines 148 - 155, The Download
button in the download link element uses a hardcoded color class text-white
instead of a theme CSS variable, and the label text is not uppercase. Replace
the hardcoded text-white in the className with an appropriate CSS variable from
`@/lib/theme` (such as C.text or C.headerText based on design requirements), and
apply uppercase styling to the button label by adding the Tailwind uppercase
utility class to the className or wrapping the text with a text-transform style,
ensuring the button follows the tokenized color system and uppercase label
conventions defined in the coding guidelines.

Source: Coding guidelines

🧹 Nitpick comments (1)
apps/studio/app/page.tsx (1)

814-880: ⚡ Quick win

Prefer AppHeader for the IDE path too, instead of a bespoke <header>.

Line [814] reintroduces custom header chrome in Studio. Since AppHeader already supports brand and right slots, this path will otherwise drift from shared behavior over time.

Refactor direction
-      <header className="flex h-12 shrink-0 items-center justify-between border-b border-line bg-invert px-5 text-invert-fg">
-        ...
-      </header>
+      <AppHeader
+        brand={
+          <div className="flex items-center gap-3">
+            <AppWordmark product="Studio" />
+            {/* existing picker button + syncing indicator */}
+          </div>
+        }
+        right={
+          <div className="flex items-center gap-2">
+            {/* existing status indicator */}
+            <ThemeToggle
+              size="icon-sm"
+              className="border-invert-fg/25 text-invert-fg hover:border-accent hover:text-accent"
+            />
+          </div>
+        }
+        themeToggle={false}
+      />
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/studio/app/page.tsx` around lines 814 - 880, Replace the custom
`<header>` element (the one with className containing "flex h-12 shrink-0") with
the `AppHeader` component instead. Move the left section containing the
AppWordmark and project picker button into the `brand` slot of `AppHeader`, and
move the right section containing the AnimatePresence and ThemeToggle into the
`right` slot of `AppHeader`. This ensures the IDE path uses the same shared
AppHeader component as other parts of the application, preventing future
divergence in header behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/library/components/masthead.tsx`:
- Around line 22-27: The Button component in the Upload action has two issues:
it uses a hardcoded color className text-white instead of theme color tokens,
and the button label is mixed-case. Replace the hardcoded text-white in the
className with the appropriate theme color token from the imported theme
constants (similar to how border-accent and bg-accent are already used), and
change the button label from plus Upload to uppercase format (either as UPLOAD
or by applying the appropriate text-transform or Tailwind uppercase utility
class) to align with the repository's styling conventions for headers, labels,
and navigation elements.

In `@packages/chat/src/react/components/ThreadSidebar.tsx`:
- Around line 4-6: The import statement on line 4 of ThreadSidebar.tsx imports
motion from framer-motion, which does not follow the coding guidelines for
animation libraries in TSX files. Change the import source from framer-motion to
motion/react for the motion import to comply with the requirement to use
motion/react for all animations in TSX files.

In `@packages/ui/src/components/app-header.tsx`:
- Around line 95-103: The AppHeader component in the outer div and inner flex
container is using outdated header layout specifications. Replace the
positioning classes `relative z-20` with `sticky top-0 z-40` in the outer
className, and change the height class from `h-12` to `h-14` in the inner flex
div className. This aligns the header with the required app header contract of
sticky positioning at the top with proper z-index and a 56px height instead of
the current 48px.

---

Outside diff comments:
In `@apps/library/app/file/`[id]/page.tsx:
- Around line 148-155: The Download button in the download link element uses a
hardcoded color class text-white instead of a theme CSS variable, and the label
text is not uppercase. Replace the hardcoded text-white in the className with an
appropriate CSS variable from `@/lib/theme` (such as C.text or C.headerText based
on design requirements), and apply uppercase styling to the button label by
adding the Tailwind uppercase utility class to the className or wrapping the
text with a text-transform style, ensuring the button follows the tokenized
color system and uppercase label conventions defined in the coding guidelines.

---

Nitpick comments:
In `@apps/studio/app/page.tsx`:
- Around line 814-880: Replace the custom `<header>` element (the one with
className containing "flex h-12 shrink-0") with the `AppHeader` component
instead. Move the left section containing the AppWordmark and project picker
button into the `brand` slot of `AppHeader`, and move the right section
containing the AnimatePresence and ThemeToggle into the `right` slot of
`AppHeader`. This ensures the IDE path uses the same shared AppHeader component
as other parts of the application, preventing future divergence in header
behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: de973d66-a12d-4156-b410-1b94175156a3

📥 Commits

Reviewing files that changed from the base of the PR and between 7f8916a and e685af1.

📒 Files selected for processing (14)
  • apps/admin/components/layout/admin-shell.tsx
  • apps/chat/components/ChatProvider.tsx
  • apps/chat/tsconfig.tsbuildinfo
  • apps/library/app/file/[id]/page.tsx
  • apps/library/components/masthead.tsx
  • apps/portal/components/shared/page-shell.tsx
  • apps/portal/lib/theme.ts
  • apps/studio/app/page.tsx
  • apps/studio/lib/theme.ts
  • packages/chat/src/react/components/ThreadSidebar.tsx
  • packages/chat/src/react/components/ThreadView.tsx
  • packages/chat/src/react/transport-context.tsx
  • packages/ui/src/components/app-header.tsx
  • packages/ui/src/components/index.ts

Comment on lines +22 to +27
<Button
size="sm"
onClick={onUpload}
className="border-accent bg-accent text-white hover:opacity-80"
>
+ Upload

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use theme color tokens and uppercase label for the Upload action.

This new button uses a hardcoded color (text-white) and a mixed-case label, which breaks the TSX styling conventions in this repo.

Suggested patch
 import { AppHeader, AppWordmark, Button } from "`@wikipefia/ui`";
 import Link from "next/link";
+import { C } from "`@/lib/theme`";
@@
           <Button
             size="sm"
             onClick={onUpload}
-            className="border-accent bg-accent text-white hover:opacity-80"
+            className="uppercase tracking-wider hover:opacity-80"
+            style={{
+              borderColor: C.accent,
+              backgroundColor: C.accent,
+              color: C.bgWhite,
+              fontFamily: "var(--font-mono)",
+            }}
           >
-            + Upload
+            + UPLOAD
           </Button>

As per coding guidelines, "Use CSS variables (C.bg, C.bgWhite, C.text, C.textMuted, C.accent, C.border, C.borderLight, C.headerBg, C.headerText) imported from @/lib/theme for all styling; never hardcode colors except for subject palette colors" and "Apply uppercase styling to all headers, labels, navigation, badges, and breadcrumbs using text-transform or Tailwind uppercase utility".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/library/components/masthead.tsx` around lines 22 - 27, The Button
component in the Upload action has two issues: it uses a hardcoded color
className text-white instead of theme color tokens, and the button label is
mixed-case. Replace the hardcoded text-white in the className with the
appropriate theme color token from the imported theme constants (similar to how
border-accent and bg-accent are already used), and change the button label from
plus Upload to uppercase format (either as UPLOAD or by applying the appropriate
text-transform or Tailwind uppercase utility class) to align with the
repository's styling conventions for headers, labels, and navigation elements.

Source: Coding guidelines

Comment on lines 4 to +6
import { motion } from "framer-motion";
import { C } from "@wikipefia/mdx-renderer/theme";
import { AppWordmark } from "@wikipefia/ui";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify remaining imports that still use framer-motion in React view files.
rg -n --iglob '**/*.{tsx,jsx}' 'from ["'\'']framer-motion["'\'']|require\(["'\'']framer-motion["'\'']\)'

Repository: Wikipefia/wikipefia-ck

Length of output: 1767


Switch animation import from framer-motion to motion/react.

Line 4 uses framer-motion in a TSX file, but the standard is motion/react.

Proposed fix
-import { motion } from "framer-motion";
+import { motion } from "motion/react";

Per coding guidelines, Use motion/react for all animations; no other animation libraries in .tsx files.

📝 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
import { motion } from "framer-motion";
import { C } from "@wikipefia/mdx-renderer/theme";
import { AppWordmark } from "@wikipefia/ui";
import { motion } from "motion/react";
import { C } from "`@wikipefia/mdx-renderer/theme`";
import { AppWordmark } from "`@wikipefia/ui`";
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/chat/src/react/components/ThreadSidebar.tsx` around lines 4 - 6, The
import statement on line 4 of ThreadSidebar.tsx imports motion from
framer-motion, which does not follow the coding guidelines for animation
libraries in TSX files. Change the import source from framer-motion to
motion/react for the motion import to comply with the requirement to use
motion/react for all animations in TSX files.

Source: Coding guidelines

Comment on lines +95 to +103
"relative z-20 shrink-0 border-b border-line bg-invert text-invert-fg",
className,
)}
{...rest}
>
<div
className={cn(
"flex h-12 items-center justify-between px-5",
innerClassName,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Align shared header layout contract (h-14 + sticky positioning).

Line [95] and Line [102] currently render a 48px non-sticky header (h-12, relative z-20). This diverges from the required app header contract and will propagate everywhere AppHeader is used.

Proposed fix
       <header
         ref={ref}
         className={cn(
-          "relative z-20 shrink-0 border-b border-line bg-invert text-invert-fg",
+          "sticky top-0 z-40 shrink-0 border-b border-line bg-invert text-invert-fg",
           className,
         )}
         {...rest}
       >
         <div
           className={cn(
-            "flex h-12 items-center justify-between px-5",
+            "flex h-14 items-center justify-between px-5",
             innerClassName,
           )}
         >

As per coding guidelines, "Header layout: use h-14, sticky top-0 z-40, with border-b".

📝 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
"relative z-20 shrink-0 border-b border-line bg-invert text-invert-fg",
className,
)}
{...rest}
>
<div
className={cn(
"flex h-12 items-center justify-between px-5",
innerClassName,
"sticky top-0 z-40 shrink-0 border-b border-line bg-invert text-invert-fg",
className,
)}
{...rest}
>
<div
className={cn(
"flex h-14 items-center justify-between px-5",
innerClassName,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ui/src/components/app-header.tsx` around lines 95 - 103, The
AppHeader component in the outer div and inner flex container is using outdated
header layout specifications. Replace the positioning classes `relative z-20`
with `sticky top-0 z-40` in the outer className, and change the height class
from `h-12` to `h-14` in the inner flex div className. This aligns the header
with the required app header contract of sticky positioning at the top with
proper z-index and a 56px height instead of the current 48px.

Source: Coding guidelines

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