diff --git a/apps/web/src/components/ThreadStatusIndicators.tsx b/apps/web/src/components/ThreadStatusIndicators.tsx index 2f72f827e56a..454f2d9e4618 100644 --- a/apps/web/src/components/ThreadStatusIndicators.tsx +++ b/apps/web/src/components/ThreadStatusIndicators.tsx @@ -26,7 +26,7 @@ import { visibleThreadPullRequests, type ThreadPullRequestBadge, } from "@t3tools/shared/threadPullRequests"; -import { type MouseEvent } from "react"; +import { type MouseEvent, type ReactNode } from "react"; import { buttonVariants, InlineButton } from "./ui/button"; import { cn } from "../lib/utils"; @@ -223,7 +223,6 @@ export function ThreadPullRequestBadgeControl({ const presentation = resolveThreadPullRequestBadgePresentation({ badge, number, url, status }); if (presentation === null) return null; const isStack = badge?.kind === "stack"; - const showList = isStack || (badge?.kind === "pull-request" && badge.others > 0); const className = cn( variant === "ghost" ? buttonVariants({ variant: "ghost", size: "xs" }) @@ -271,21 +270,26 @@ export function ThreadPullRequestBadgeControl({ - {showList ? ( + {visibleThreadPullRequests(pullRequests).length > 0 ? ( - ) : ( - presentation.label - )} + ) : number !== undefined && url !== undefined ? ( + + ) : null} ); @@ -316,56 +320,77 @@ export function ThreadPullRequestsMiniList({ snapshot === null ? null : resolvePullRequestState({ state: snapshot.state, isDraft: snapshot.isDraft }); - const content = ( - <> - {presentation ? ( - - ) : ( - - )} - #{line.link.number} - - {snapshot?.title ?? line.link.repository} - + return ( + {line.stack ? ( {line.stack.kind === "native" ? "stack" : "chain"} ยท {line.stack.size} ) : null} - - ); - return ( -
  • - {onOpenPullRequest ? ( - event.stopPropagation()} - onClick={(event) => onOpenPullRequest(event, line.link.url)} - > - {content} - - ) : ( -
    {content}
    - )} -
  • +
    ); })} ); } +function ThreadPullRequestMiniListItem({ + number, + url, + title, + presentation, + depth = 0, + onOpenPullRequest, + children, +}: { + number: number; + url: string; + title: string; + presentation: Pick | null; + depth?: number; + onOpenPullRequest?: ((event: MouseEvent, url: string) => void) | undefined; + children?: ReactNode; +}) { + const Icon = presentation?.Icon ?? PullRequestGlyph.pullRequest; + const content = ( + <> + + #{number} + {title} + {children} + + ); + return ( +
  • + {onOpenPullRequest ? ( + event.stopPropagation()} + onClick={(event) => onOpenPullRequest(event, url)} + > + {content} + + ) : ( +
    {content}
    + )} +
  • + ); +} + export function prStatusIndicator( pr: ThreadPr, provider: VcsStatusResult["sourceControlProvider"] | null | undefined,