Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.
Python aicode-complexitycode-healthcode-intelligencecode-qualitydead-codedeveloper-toolsdocumentationgit-analyticsmcpopen-sourcepythonrefactoringstatic-analysistechnical-debt
fix(ui): merge RepoAvatar className with cn() (#2583)
XU56597b80a181
diff --git a/packages/ui/__tests__/overview/repo-avatar.test.tsx b/packages/ui/__tests__/overview/repo-avatar.test.tsxindex 5f32e550e..9d90a8b14 100644--- a/packages/ui/__tests__/overview/repo-avatar.test.tsx+++ b/packages/ui/__tests__/overview/repo-avatar.test.tsx@@ -60,4 +60,28 @@ describe("RepoAvatar", () => {expect(container.textContent).toBe("?");});++ it("lets a caller's display utility replace the built-in inline-flex", () => {+ // RepoIdentityHeader hides one of two avatars per breakpoint:+ // `className="hidden sm:inline-flex"` on the desktop one, `"sm:hidden"` on+ // the mobile one. Both `inline-flex` (built in) and `hidden` (from the+ // caller) set `display`; keeping both leaves the winner to stylesheet+ // order, which is how the desktop avatar ended up visible on phones.+ const { container } = render(<RepoAvatar name="repowise" className="hidden sm:inline-flex" />);++ const classes = container.firstElementChild?.className.split(/\s+/) ?? [];+ expect(classes).toContain("hidden");+ expect(classes).toContain("sm:inline-flex");+ expect(classes).not.toContain("inline-flex");+ });++ it("keeps inline-flex when the caller only hides at a breakpoint", () => {+ // The other half of the pair: a `sm:hidden` avatar must still be laid out+ // below `sm`, so the base `inline-flex` has to survive.+ const { container } = render(<RepoAvatar name="repowise" className="sm:hidden" />);++ const classes = container.firstElementChild?.className.split(/\s+/) ?? [];+ expect(classes).toContain("inline-flex");+ expect(classes).toContain("sm:hidden");+ });});diff --git a/packages/ui/src/overview/repo-avatar.tsx b/packages/ui/src/overview/repo-avatar.tsxindex 9a34d7a78..38c4a49ae 100644--- a/packages/ui/src/overview/repo-avatar.tsx+++ b/packages/ui/src/overview/repo-avatar.tsx@@ -1,5 +1,6 @@import * as React from "react";import { githubAvatarUrl, githubOwnerFromRemote } from "../lib/github";+import { cn } from "../lib/cn";// Re-exported because `overview/index.ts` and the existing tests import it// from here. The implementation moved to `lib/github` so the owner avatar can@@ -38,7 +39,10 @@ export function RepoAvatar({ name, remoteUrl, size = 40, className }: RepoAvatarreturn (<spanaria-hidden- className={`relative inline-flex shrink-0 items-center justify-center overflow-hidden rounded-xl border border-[var(--color-border-default)] bg-[var(--color-accent-muted)] ${className ?? ""}`}+ className={cn(+ "relative inline-flex shrink-0 items-center justify-center overflow-hidden rounded-xl border border-[var(--color-border-default)] bg-[var(--color-accent-muted)]",+ className,+ )}style={{ width: size, height: size }}><span