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
10 changes: 8 additions & 2 deletions apps/web/src/components/pullRequest/PullRequestDetailCrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import type { MouseEvent as ReactMouseEvent } from "react";

import { useOpenLink } from "~/browser/useOpenLink";
import { cn } from "~/lib/utils";
import { readLocalApi } from "~/localApi";
import { Button } from "../ui/button";
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
import { openOnHostLabel, showPullRequestLinkContextMenu } from "./pullRequestLinkContextMenu";
Expand Down Expand Up @@ -132,6 +131,7 @@ export function PullRequestDetailCrumbs({
onBack: (() => void) | undefined;
}) {
const gt = useGT();
const openLink = useOpenLink(threadRef);
const ready = detail !== null && toneClassName !== null;
return (
<div className="pl-4 grid h-7 min-w-0 items-center overflow-hidden">
Expand All @@ -155,7 +155,13 @@ export function PullRequestDetailCrumbs({
repositoryUrl ? (
<button
type="button"
onClick={() => void readLocalApi()?.shell.openExternal(repositoryUrl)}
onClick={(event) =>
void openLink(repositoryUrl, { event }).catch(console.error)
}
onAuxClick={(event) => {
if (event.button === 1)
void openLink(repositoryUrl, { event }).catch(console.error);
}}
className="min-w-0 cursor-pointer truncate text-left font-medium text-muted-foreground underline-offset-2 hover:text-foreground hover:underline"
>
{detail.repository}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1529,6 +1529,7 @@ export function PullRequestDetailPanel({
number={reference.number}
tabs={visibleTabs}
activeTab={tab}
threadRef={threadRef}
{...(onBack ? { onBack } : {})}
{...(onClose ? { onClose } : {})}
actions={
Expand Down
12 changes: 9 additions & 3 deletions apps/web/src/components/pullRequest/PullRequestGhosts.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PullRequestListEntry, PullRequestSummary } from "@t3tools/contracts";
import type { PullRequestListEntry, PullRequestSummary, ScopedThreadRef } from "@t3tools/contracts";
import {
ArrowLeftIcon,
ChevronRightIcon,
Expand All @@ -16,7 +16,7 @@ import {
type ChangeRequestTerminology,
} from "@t3tools/client-runtime/source-control-clients";

import { readLocalApi } from "~/localApi";
import { useOpenLink } from "~/browser/useOpenLink";
import { cn } from "~/lib/utils";
import { RelativeTime } from "~/components/RelativeTime";

Expand Down Expand Up @@ -93,6 +93,7 @@ export function PullRequestDetailGhost({
onBack,
onClose,
onCheckoutError,
threadRef = null,
}: {
seed?: PullRequestListEntry | null;
summary?: PullRequestSummary | null;
Expand All @@ -104,9 +105,11 @@ export function PullRequestDetailGhost({
onBack?: (() => void) | undefined;
onClose?: (() => void) | undefined;
onCheckoutError?: ((error: Error) => void) | undefined;
threadRef?: ScopedThreadRef | null | undefined;
}) {
const gt = useGT();
const resolve = useMessages();
const openLink = useOpenLink(threadRef);
const tabs = requestedTabs ?? resolveFilterOptions(DEFAULT_DETAIL_TABS, resolve);
const seed = summary
? {
Expand Down Expand Up @@ -165,7 +168,10 @@ export function PullRequestDetailGhost({
<>
<span className="min-w-0 truncate font-medium">{seed.repository}</span>
<InlineButton
onClick={() => void readLocalApi()?.shell.openExternal(seed.url)}
onClick={(event) => void openLink(seed.url, { event }).catch(console.error)}
onAuxClick={(event) => {
if (event.button === 1) void openLink(seed.url, { event }).catch(console.error);
}}
aria-label={gt(
"Open {term, select, mr {merge request} cr {change request} other {pull request}} #{number} on host",
{
Expand Down
Loading