fix(web): remove sidebar pull request link icon (#11179)
This commit is contained in:
1 parent
4d06156dd7
commit
0a37240a87
3 files changed
+2
-85
No files matched your search
@@ -1,10 +1,6 @@
|
||||
import { useSupportsMultiplePullRequests } from "~/hooks/useSupportsMultiplePullRequests";
|
||||
import { GitPullRequestIcon } from "lucide-react";
|
||||
import { LinkBranchPullRequestButton } from "./pullRequest/LinkBranchPullRequestButton";
|
||||
import {
|
||||
resolveThreadCurrentPullRequestLink,
|
||||
visibleThreadPullRequests,
|
||||
} from "@t3tools/shared/threadPullRequests";
|
||||
import { resolveThreadCurrentPullRequestLink } from "@t3tools/shared/threadPullRequests";
|
||||
import { Spinner } from "~/components/ui/spinner";
|
||||
import {
|
||||
ArchiveIcon,
|
||||
@@ -764,12 +760,6 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
|
||||
<GitPullRequestIcon className="size-3" />
|
||||
</a>
|
||||
) : null}
|
||||
{pr &&
|
||||
(supportsMultiplePullRequests
|
||||
? visibleThreadPullRequests(thread.pullRequests).length === 0
|
||||
: thread.linkedPullRequest == null) ? (
|
||||
<LinkBranchPullRequestButton threadRef={threadRef} url={pr.url} />
|
||||
) : null}
|
||||
{threadStatus && <ThreadStatusLabel status={threadStatus} />}
|
||||
{renamingThreadKey === threadKey ? (
|
||||
<input
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import { useSupportsMultiplePullRequests } from "~/hooks/useSupportsMultiplePullRequests";
|
||||
import { LinkBranchPullRequestButton } from "./pullRequest/LinkBranchPullRequestButton";
|
||||
import {
|
||||
resolveThreadCurrentPullRequestLink,
|
||||
visibleThreadPullRequests,
|
||||
} from "@t3tools/shared/threadPullRequests";
|
||||
import { resolveThreadCurrentPullRequestLink } from "@t3tools/shared/threadPullRequests";
|
||||
import { useAtomValue } from "@effect/atom-react";
|
||||
import * as Schema from "effect/Schema";
|
||||
import {
|
||||
@@ -1617,14 +1613,6 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
|
||||
remain visible AND clickable while the row is hovered. Only
|
||||
the time/jump label yields to the settle affordance. */}
|
||||
{prBadge}
|
||||
{prBadge &&
|
||||
variantAction !== "unsettle" &&
|
||||
pr &&
|
||||
(supportsMultiplePullRequests
|
||||
? visibleThreadPullRequests(thread.pullRequests).length === 0
|
||||
: thread.linkedPullRequest == null) ? (
|
||||
<LinkBranchPullRequestButton threadRef={threadRef} url={pr.url} />
|
||||
) : null}
|
||||
{sortable?.isDragging ? (
|
||||
dragDestination
|
||||
) : (
|
||||
@@ -1925,13 +1913,6 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
|
||||
)}
|
||||
{terminalStatusIcon}
|
||||
{prBadge}
|
||||
{prBadge &&
|
||||
pr &&
|
||||
(supportsMultiplePullRequests
|
||||
? visibleThreadPullRequests(thread.pullRequests).length === 0
|
||||
: thread.linkedPullRequest == null) ? (
|
||||
<LinkBranchPullRequestButton threadRef={threadRef} url={pr.url} />
|
||||
) : null}
|
||||
{diff ? (
|
||||
<span className="shrink-0 font-mono">
|
||||
<span className="text-diff-addition-foreground">+{diff.insertions}</span>{" "}
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
import type { ScopedThreadRef } from "@t3tools/contracts";
|
||||
import { Link2 } from "lucide-react";
|
||||
import { useState } from "react";
|
||||
import { usePullRequestLinking } from "~/hooks/usePullRequestLinking";
|
||||
import { Button } from "../ui/button";
|
||||
import { toastManager } from "../ui/toast";
|
||||
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
|
||||
|
||||
/** Adopts a branch discovery as a durable link, even after the thread changes branches. */
|
||||
export function LinkBranchPullRequestButton({
|
||||
threadRef,
|
||||
url,
|
||||
}: {
|
||||
threadRef: ScopedThreadRef;
|
||||
url: string;
|
||||
}) {
|
||||
const linking = usePullRequestLinking(threadRef.environmentId);
|
||||
const [pending, setPending] = useState(false);
|
||||
if (!linking.canLink(url)) return null;
|
||||
return (
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
render={
|
||||
<Button
|
||||
size="icon-tiny"
|
||||
variant="ghost-muted"
|
||||
aria-label="Link this PR"
|
||||
disabled={pending}
|
||||
onPointerDown={(event) => event.stopPropagation()}
|
||||
onClick={async (event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
setPending(true);
|
||||
try {
|
||||
await linking.changeLink(threadRef, url, true);
|
||||
} catch (error) {
|
||||
toastManager.add({
|
||||
type: "error",
|
||||
title: "Could not link pull request",
|
||||
description: error instanceof Error ? error.message : String(error),
|
||||
});
|
||||
} finally {
|
||||
setPending(false);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Link2 className="size-3" />
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
<TooltipPopup>Link this PR to keep it with this thread</TooltipPopup>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user