feat(web): use the linked pull request row layout on the pull requests page #12536
Mergedmaria-rcksmerged 23 commits into
main fromrefs/pull/12536/headmerged by maria-rcks View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/web/src/components/pullRequest/PullRequestListRow.tsx lines 87 to 87OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +67,21 @@67+ number: ReactNode;68+ title: ReactNode;69+ /** Right end of the first line: review verdict, checks, diff counts. */70+ status?: ReactNode;71+ /** Left of the second line: author, branches, labels. */72+ meta?: ReactNode;73+ metaClassName?: string;74+ updatedAt?: string | null | undefined;75+}) {76+ return (77+ <span className="min-w-0 flex-1">78+ <span className="flex min-w-0 items-center gap-1.5">79+ {number}80+ <span className="min-w-0 flex-1 truncate text-sm">{title}</span>81+ {status ? (82+ <span className="ml-auto flex shrink-0 items-center gap-1.5 text-[11px]">{status}</span>83+ ) : null}84+ </span>85+ <span86+ className={cn(87+ "flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground",
- apps/web/src/components/pullRequest/PullRequestRow.tsx lines 62 to 62Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -63,3 +63,10 @@6363 );6464 }656566+/**67+ * The page row keeps a little more room around the shared lines than the panel, which sits in68+ * a narrow column. The intrinsic size is the row's own block size at this padding, for the69+ * `content-visibility` skip below.70+ */71+const PAGE_ROW_CLASS = "px-3 py-2 [contain-intrinsic-block-size:52px]";72+
- @@ -218,20 +221 @@218- #{entry.number}219- </span>220- </span>221- {showProjectTitle ? <span className="truncate">{entry.repository}</span> : null}222- {environmentLabel ? (223- <span className="min-w-0 max-w-32 truncate">{environmentLabel}</span>224- ) : null}225- <PullRequestActorLabel226- actor={entry.author}227- className="min-w-4 max-w-40"228- labelClassName="sr-only @xs/pr-row-meta:not-sr-only @xs/pr-row-meta:truncate"229- />230- {entry.labels.length > 0 ? <PullRequestRowLabels labels={entry.labels} /> : null}231- </PullRequestMetaLine>232- <span className="col-start-2 row-start-2 flex items-center justify-self-end gap-3 whitespace-nowrap text-[11px] text-muted-foreground/70 tabular-nums">233- <span className="hidden @sm/pr-row:inline">234- {formatRelativeTimeLabel(entry.updatedAt)}235- </span>236- </span>237- </span>221+ <PullRequestRowAuthor
- @@ -0,0 +46,21 @@46+}) {47+ return (48+ <span className="relative inline-flex shrink-0">49+ <PullRequestStateGlyph state={state} isDraft={isDraft} />50+ {/* The wrapper takes the offset, not the icon, so the tooltip trigger inside keeps the51+ badge's size and anchors the popup to it. */}52+ <span className="absolute -right-1 -bottom-1 inline-flex">53+ <PullRequestConflictGlyph54+ state={state}55+ isDraft={isDraft}56+ {...(mergeability === undefined ? {} : { mergeability })}57+ {...(baseBranch === undefined ? {} : { baseBranch })}58+ className="size-3 fill-background [stroke-width:2.5]"59+ />60+ </span>61+ </span>62+ );63+}64+65+export function PullRequestRowLines({66+ number,
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XL
- apps/web/src/components/pullRequest/PullRequestRow.tsx lines 159 to 163OutdatedResolvedby maria-rcks@@ -184,0 +143,21 @@143+ signals={144+ <>145+ {entry.checksState === undefined ? null : (146+ <PullRequestChecksPopover147+ checksState={entry.checksState}148+ environmentId={entry.environmentId}149+ reference={{150+ projectId: entry.projectId,151+ repository: entry.repository,152+ number: entry.number,153+ }}154+ />155+ )}156+ {/* An open pull request with no verdict is awaiting one, and says so: green checks157+ on an unreviewed pull request must not look like green checks on an approved158+ one. Drafts and closed ones are not waiting on anybody. */}159+ {entry.reviewDecision !== undefined ? (160+ <PullRequestReviewDecisionGlyph decision={entry.reviewDecision} />161+ ) : entry.state === "open" && !entry.isDraft ? (162+ <PullRequestReviewDecisionGlyph decision="review-required" />163+ ) : null}
- apps/web/src/components/pullRequest/pullRequestPresentation.tsx lines 61 to 65OutdatedResolvedby maria-rcks@@ -31,0 +45,21 @@45+export function PullRequestLabelChip({46+ label,47+ size = "sm",48+ className,49+ children,50+}: {51+ label: Pick<PullRequestLabel, "name" | "color">;52+ size?: "sm" | "default";53+ className?: string;54+ children?: ReactNode;55+}) {56+ const color = pullRequestLabelColor(label.color);57+ return (58+ <Badge59+ size={size}60+ variant="secondary"61+ className={cn(62+ "min-w-0 max-w-40 shrink justify-start gap-1 px-1.5",63+ size === "sm" && "h-4 text-[.625rem]",64+ color &&65+ "bg-[color-mix(in_srgb,var(--label)_12%,transparent)] text-[color-mix(in_srgb,var(--label)_30%,var(--color-foreground))] dark:bg-[color-mix(in_srgb,var(--label)_18%,transparent)] dark:text-[color-mix(in_srgb,var(--label)_45%,var(--color-foreground))]",
- apps/web/src/routes/_chat.pull-requests.tsx line 214OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -190,0 +194,21 @@194+ * A group reads like the sidebar's shelves: its glyph, its name, how many, then a rule out195+ * to the edge. The glyph is the one the involvement filter uses for the same idea.196+ */197+const GROUP_ICONS: Record<string, LucideIcon> = {198+ authored: PenLineIcon,199+ reviewRequested: EyeIcon,200+ others: UsersIcon,201+};202+203+function PullRequestGroupHeader({204+ group,205+}: {206+ group: { key: string; label: string; entries: ReadonlyArray<unknown> };207+}) {208+ const Icon = GROUP_ICONS[group.key] ?? LayersIcon;209+ return (210+ <h2 className="flex items-center gap-2 px-3 pb-1 text-xs font-medium text-muted-foreground/70">211+ <Icon aria-hidden className="size-3.5 shrink-0" />212+ <span className="shrink-0">{group.label}</span>213+ <span className="shrink-0 tabular-nums text-muted-foreground/50">{group.entries.length}</span>214+ <span aria-hidden className="h-px min-w-2 flex-1 bg-border/60" />
- apps/web/src/components/pullRequest/ThreadPullRequestsPanel.tsx lines 182 to 182OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -192,12 +174,9 @@192- Copy link193- </MenuItem>194- <MenuItem onClick={(event) => openPrLink(event, link.url, threadRef)}>195- <ArrowUpRightIcon className="size-3.5" />196- Open197- </MenuItem>198- <MenuItem onClick={() => onUnlink(link)}>199- <PullRequestGlyph.unlink className="size-3.5" />200- {link.source === "stack" ? "Dismiss from thread" : "Unlink from thread"}201- </MenuItem>202- </MenuPopup>203- </Menu>174+ </a>175+ {/* Out of the row's flow, so no row reserves a column for a button only the hovered one176+ shows. It sits over the right end of the second line on the row's own hover color,177+ fading in from the left, so it covers the time and leaves the diff counts alone. */}178+ <span179+ className={cn(180+ "absolute right-0 bottom-0.5 flex items-center rounded-r-md bg-background pr-1 pl-5",181+ "[mask-image:linear-gradient(to_right,transparent,black_1rem)]",182+ "opacity-0 group-hover/pr-row:opacity-100 has-[[data-popup-open]]:opacity-100 has-[:focus-visible]:opacity-100",
maria-rcks merged this411da2a
maria-rcks closed this
Sign in to join this conversation.























macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed