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
8 changes: 6 additions & 2 deletions apps/web/src/components/desktopUpdate.toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function ReleaseNotesLink({
}) {
return (
<button
className="ml-2 inline-flex cursor-pointer items-center gap-1 align-baseline text-muted-foreground underline decoration-dotted underline-offset-4 transition-colors hover:text-foreground"
className="ml-2 inline cursor-pointer text-muted-foreground underline decoration-dotted underline-offset-4 transition-colors hover:text-foreground"
onClick={() => {
void (async () => {
try {
Expand All @@ -32,7 +32,11 @@ function ReleaseNotesLink({
type="button"
>
Read more
<ArrowRightIcon aria-hidden className="size-3 -rotate-45" strokeWidth={2.25} />
<ArrowRightIcon
aria-hidden
className="ml-1 inline size-3 -rotate-45 align-[-0.125em]"
strokeWidth={2.25}
/>
</button>
);
}
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/ui/tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function TooltipPopup({
<TooltipPrimitive.Positioner
align={align}
anchor={anchor}
className="pointer-events-none z-70 h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) transition-[top,left,right,bottom,transform] data-instant:transition-none"
className="pointer-events-none z-[140] h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) transition-[top,left,right,bottom,transform] data-instant:transition-none"
data-slot="tooltip-positioner"
side={side}
sideOffset={sideOffset}
Expand Down
12 changes: 12 additions & 0 deletions apps/web/src/lib/openPullRequestLink.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
openPullRequestLink,
parseChangeRequestUrl,
PullRequestLinkOpenError,
shouldOpenPullRequestExternally,
} from "./openPullRequestLink";

describe("openPullRequestLink", () => {
Expand Down Expand Up @@ -34,6 +35,17 @@ describe("openPullRequestLink", () => {
});
});

describe("shouldOpenPullRequestExternally", () => {
it("uses the browser for command-click and control-click", () => {
expect(shouldOpenPullRequestExternally({ metaKey: true, ctrlKey: false })).toBe(true);
expect(shouldOpenPullRequestExternally({ metaKey: false, ctrlKey: true })).toBe(true);
});

it("keeps an unmodified click in the pull request view", () => {
expect(shouldOpenPullRequestExternally({ metaKey: false, ctrlKey: false })).toBe(false);
});
});

describe("parseChangeRequestUrl", () => {
it("reads a GitHub pull request", () => {
expect(parseChangeRequestUrl("https://github.com/T3Tools/T3Code/pull/123")).toEqual({
Expand Down
12 changes: 11 additions & 1 deletion apps/web/src/lib/openPullRequestLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,19 @@ export function findProjectForChangeRequest(
* should still be reading it afterwards. Any change request opens there, not only the thread's
* own, since the panel is told which one to show.
*/
export function shouldOpenPullRequestExternally(
event: Pick<MouseEvent<HTMLElement>, "metaKey" | "ctrlKey">,
): boolean {
return event.metaKey || event.ctrlKey;
}

export function useOpenChangeRequestLink(
threadRef?: ScopedThreadRef,
): (
event: Pick<MouseEvent<HTMLElement>, "preventDefault" | "stopPropagation">,
event: Pick<
MouseEvent<HTMLElement>,
"preventDefault" | "stopPropagation" | "metaKey" | "ctrlKey"
>,
targetUrl: string,
targetThreadRef?: ScopedThreadRef,
) => boolean {
Expand All @@ -186,6 +195,7 @@ export function useOpenChangeRequestLink(
const primaryEnvironmentId = usePrimaryEnvironmentId();
return useCallback(
(event, targetUrl, targetThreadRef) => {
if (shouldOpenPullRequestExternally(event)) return false;
const resolvedThreadRef = targetThreadRef ?? threadRef;
const environmentId = resolvedThreadRef?.environmentId ?? primaryEnvironmentId;
if (
Expand Down
Loading