Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/web/src/components/BranchToolbarBranchSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ export function BranchToolbarBranchSelector({
number={prNumber}
url={prUrl}
status={displayedPrStatus}
onOpenStack={() => useRightPanelStore.getState().open(threadRef, "pull-requests")}
onOpenList={() => useRightPanelStore.getState().open(threadRef, "pull-requests")}
onOpenPullRequest={(event) => {
if (prUrl) openPrLink(event, prUrl);
}}
Expand Down
7 changes: 4 additions & 3 deletions apps/web/src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1499,11 +1499,12 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
);

// Stacks show their layer count; multiple unrelated links show their total count.
// Plain clicks open T3; individual PR links also support opening the host in a new tab.
// Either opens the thread's pull requests tab; a single PR link opens that PR and still
// supports opening the host in a new tab.
const prBadgeShape = supportsMultiplePullRequests
? resolveThreadPullRequestBadge(thread.pullRequests)
: null;
const handlePrStackClick = useCallback(() => {
const handlePrListClick = useCallback(() => {
useRightPanelStore.getState().open(threadRef, "pull-requests");
if (!props.isActive) onThreadActivate(threadRef);
}, [onThreadActivate, props.isActive, threadRef]);
Expand All @@ -1515,7 +1516,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
number={pr?.number ?? currentLinkedPr?.number}
url={pr?.url ?? currentLinkedPr?.url}
status={prStatus}
onOpenStack={handlePrStackClick}
onOpenList={handlePrListClick}
onOpenPullRequest={handlePrClick}
/>
) : null;
Expand Down
25 changes: 13 additions & 12 deletions apps/web/src/components/ThreadStatusIndicators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,23 +195,24 @@ export function resolveThreadPullRequestBadgePresentation({
* The linked-PR badge shared by the sidebar and composer footer. The badge owns what it shows:
* the state glyph and number at the meta size, in the state's color. The caller owns the control
* it sits in through `render` (an inline link in a sidebar row, a toolbar control in the
* composer), and the badge fills in the link or stack button behavior.
* composer), and the badge fills in the behavior: a single PR is a link to it, while a stack or
* several linked PRs is a button that opens the thread's pull requests tab.
*/
export function ThreadPullRequestBadgeControl({
render,
badge,
number,
url,
status,
onOpenStack,
onOpenList,
onOpenPullRequest,
}: {
render: ReactElement<{ render?: useRender.RenderProp }>;
badge: ThreadPullRequestBadge | null;
number?: number | undefined;
url?: string | undefined;
status: PrStatusIndicator | null;
onOpenStack: () => void;
onOpenList: () => void;
onOpenPullRequest: (event: MouseEvent<HTMLElement>) => void;
}) {
const presentation = resolveThreadPullRequestBadgePresentation({ badge, number, url, status });
Expand All @@ -220,9 +221,9 @@ export function ThreadPullRequestBadgeControl({
<PullRequestBadge
render={render}
presentation={presentation}
isStack={badge?.kind === "stack"}
opensList={badge !== null && (badge.kind === "stack" || badge.others > 0)}
url={url}
onOpenStack={onOpenStack}
onOpenList={onOpenList}
onOpenPullRequest={onOpenPullRequest}
/>
);
Expand All @@ -231,26 +232,26 @@ export function ThreadPullRequestBadgeControl({
function PullRequestBadge({
render,
presentation,
isStack,
opensList,
url,
onOpenStack,
onOpenList,
onOpenPullRequest,
}: {
render: ReactElement<{ render?: useRender.RenderProp }>;
presentation: NonNullable<ReturnType<typeof resolveThreadPullRequestBadgePresentation>>;
isStack: boolean;
opensList: boolean;
url: string | undefined;
onOpenStack: () => void;
onOpenList: () => void;
onOpenPullRequest: (event: MouseEvent<HTMLElement>) => void;
}) {
const onClick = isStack
const onClick = opensList
? (event: MouseEvent<HTMLElement>) => {
event.preventDefault();
event.stopPropagation();
onOpenStack();
onOpenList();
}
: onOpenPullRequest;
const element = isStack ? (
const element = opensList ? (
<button type="button" />
) : (
<a href={url} target="_blank" rel="noopener noreferrer" />
Expand Down
2 changes: 1 addition & 1 deletion docs/user/source-control.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ on the Pull Requests page, **Link to thread** lets you search for an active thre
also lists the threads that link to it, including archived threads, so you can return to their context.

Thread badges show a stack's layer count or the current review number with a count of additional
links. On mobile, the Git overview lists linked reviews and their stacks; tap a review to open it.
links. Clicking a badge with more than one review opens the **Linked pull requests** panel. On mobile, the Git overview lists linked reviews and their stacks; tap a review to open it.
Linking and unlinking are available in the web and desktop clients.

The **Linked pull requests** panel lists every review and groups stacks. Unlink a review from its
Expand Down
Loading