TypeScript
fix(web): remove sidebar pull request link icon (#11179)
maria0a37240a87bb
diff --git a/apps/web/src/components/LegacySidebar.tsx b/apps/web/src/components/LegacySidebar.tsxindex 3a393662327..81fd6047f13 100644--- a/apps/web/src/components/LegacySidebar.tsx+++ b/apps/web/src/components/LegacySidebar.tsx@@ -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 ? (<inputdiff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsxindex b1583a346b5..c269b73ee76 100644--- a/apps/web/src/components/Sidebar.tsx+++ b/apps/web/src/components/Sidebar.tsx@@ -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. Onlythe 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>{" "}diff --git a/apps/web/src/components/pullRequest/LinkBranchPullRequestButton.tsx b/apps/web/src/components/pullRequest/LinkBranchPullRequestButton.tsxdeleted file mode 100644index bbcb9e14419..00000000000--- a/apps/web/src/components/pullRequest/LinkBranchPullRequestButton.tsx+++ /dev/null@@ -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>- );-}