| author | |
| committer | |
| log | 0a37240a87bb2fed8f48cf20dc8312ee3b94eba6 |
| tree | b487ec92882344b12871fcffe968d55f5875d22e |
| parent | 4d06156dd7821851007e61489105f33dbb241a7f |
| signature | Signed by PGP key B5690EEEBB952194 |
3 files changed, 2 insertions(+), 85 deletions(-)
apps/web/src/components/LegacySidebar.tsx+1-11| ... | @@ -1,10 +1,6 @@ | ... | @@ -1,10 +1,6 @@ |
| 1 | import { useSupportsMultiplePullRequests } from "~/hooks/useSupportsMultiplePullRequests"; | 1 | import { useSupportsMultiplePullRequests } from "~/hooks/useSupportsMultiplePullRequests"; |
| 2 | import { GitPullRequestIcon } from "lucide-react"; | 2 | import { GitPullRequestIcon } from "lucide-react"; |
| 3 | import { LinkBranchPullRequestButton } from "./pullRequest/LinkBranchPullRequestButton"; | 3 | import { resolveThreadCurrentPullRequestLink } from "@t3tools/shared/threadPullRequests"; |
| 4 | import { | ||
| 5 | resolveThreadCurrentPullRequestLink, | ||
| 6 | visibleThreadPullRequests, | ||
| 7 | } from "@t3tools/shared/threadPullRequests"; | ||
| 8 | import { Spinner } from "~/components/ui/spinner"; | 4 | import { Spinner } from "~/components/ui/spinner"; |
| 9 | import { | 5 | import { |
| 10 | ArchiveIcon, | 6 | ArchiveIcon, |
| ... | @@ -764,12 +760,6 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP | ... | @@ -764,12 +760,6 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP |
| 764 | <GitPullRequestIcon className="size-3" /> | 760 | <GitPullRequestIcon className="size-3" /> |
| 765 | </a> | 761 | </a> |
| 766 | ) : null} | 762 | ) : null} |
| 767 | {pr && | ||
| 768 | (supportsMultiplePullRequests | ||
| 769 | ? visibleThreadPullRequests(thread.pullRequests).length === 0 | ||
| 770 | : thread.linkedPullRequest == null) ? ( | ||
| 771 | <LinkBranchPullRequestButton threadRef={threadRef} url={pr.url} /> | ||
| 772 | ) : null} | ||
| 773 | {threadStatus && <ThreadStatusLabel status={threadStatus} />} | 763 | {threadStatus && <ThreadStatusLabel status={threadStatus} />} |
| 774 | {renamingThreadKey === threadKey ? ( | 764 | {renamingThreadKey === threadKey ? ( |
| 775 | <input | 765 | <input |
apps/web/src/components/Sidebar.tsx+1-20| ... | @@ -1,9 +1,5 @@ | ... | @@ -1,9 +1,5 @@ |
| 1 | import { useSupportsMultiplePullRequests } from "~/hooks/useSupportsMultiplePullRequests"; | 1 | import { useSupportsMultiplePullRequests } from "~/hooks/useSupportsMultiplePullRequests"; |
| 2 | import { LinkBranchPullRequestButton } from "./pullRequest/LinkBranchPullRequestButton"; | 2 | import { resolveThreadCurrentPullRequestLink } from "@t3tools/shared/threadPullRequests"; |
| 3 | import { | ||
| 4 | resolveThreadCurrentPullRequestLink, | ||
| 5 | visibleThreadPullRequests, | ||
| 6 | } from "@t3tools/shared/threadPullRequests"; | ||
| 7 | import { useAtomValue } from "@effect/atom-react"; | 3 | import { useAtomValue } from "@effect/atom-react"; |
| 8 | import * as Schema from "effect/Schema"; | 4 | import * as Schema from "effect/Schema"; |
| 9 | import { | 5 | import { |
| ... | @@ -1617,14 +1613,6 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: { | ... | @@ -1617,14 +1613,6 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: { |
| 1617 | remain visible AND clickable while the row is hovered. Only | 1613 | remain visible AND clickable while the row is hovered. Only |
| 1618 | the time/jump label yields to the settle affordance. */} | 1614 | the time/jump label yields to the settle affordance. */} |
| 1619 | {prBadge} | 1615 | {prBadge} |
| 1620 | {prBadge && | ||
| 1621 | variantAction !== "unsettle" && | ||
| 1622 | pr && | ||
| 1623 | (supportsMultiplePullRequests | ||
| 1624 | ? visibleThreadPullRequests(thread.pullRequests).length === 0 | ||
| 1625 | : thread.linkedPullRequest == null) ? ( | ||
| 1626 | <LinkBranchPullRequestButton threadRef={threadRef} url={pr.url} /> | ||
| 1627 | ) : null} | ||
| 1628 | {sortable?.isDragging ? ( | 1616 | {sortable?.isDragging ? ( |
| 1629 | dragDestination | 1617 | dragDestination |
| 1630 | ) : ( | 1618 | ) : ( |
| ... | @@ -1925,13 +1913,6 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: { | ... | @@ -1925,13 +1913,6 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: { |
| 1925 | )} | 1913 | )} |
| 1926 | {terminalStatusIcon} | 1914 | {terminalStatusIcon} |
| 1927 | {prBadge} | 1915 | {prBadge} |
| 1928 | {prBadge && | ||
| 1929 | pr && | ||
| 1930 | (supportsMultiplePullRequests | ||
| 1931 | ? visibleThreadPullRequests(thread.pullRequests).length === 0 | ||
| 1932 | : thread.linkedPullRequest == null) ? ( | ||
| 1933 | <LinkBranchPullRequestButton threadRef={threadRef} url={pr.url} /> | ||
| 1934 | ) : null} | ||
| 1935 | {diff ? ( | 1916 | {diff ? ( |
| 1936 | <span className="shrink-0 font-mono"> | 1917 | <span className="shrink-0 font-mono"> |
| 1937 | <span className="text-diff-addition-foreground">+{diff.insertions}</span>{" "} | 1918 | <span className="text-diff-addition-foreground">+{diff.insertions}</span>{" "} |
apps/web/src/components/pullRequest/LinkBranchPullRequestButton.tsx deleted-54| ... | @@ -1,54 +0,0 @@ | ||
| 1 | import type { ScopedThreadRef } from "@t3tools/contracts"; | ||
| 2 | import { Link2 } from "lucide-react"; | ||
| 3 | import { useState } from "react"; | ||
| 4 | import { usePullRequestLinking } from "~/hooks/usePullRequestLinking"; | ||
| 5 | import { Button } from "../ui/button"; | ||
| 6 | import { toastManager } from "../ui/toast"; | ||
| 7 | import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip"; | ||
| 8 | |||
| 9 | /** Adopts a branch discovery as a durable link, even after the thread changes branches. */ | ||
| 10 | export function LinkBranchPullRequestButton({ | ||
| 11 | threadRef, | ||
| 12 | url, | ||
| 13 | }: { | ||
| 14 | threadRef: ScopedThreadRef; | ||
| 15 | url: string; | ||
| 16 | }) { | ||
| 17 | const linking = usePullRequestLinking(threadRef.environmentId); | ||
| 18 | const [pending, setPending] = useState(false); | ||
| 19 | if (!linking.canLink(url)) return null; | ||
| 20 | return ( | ||
| 21 | <Tooltip> | ||
| 22 | <TooltipTrigger | ||
| 23 | render={ | ||
| 24 | <Button | ||
| 25 | size="icon-tiny" | ||
| 26 | variant="ghost-muted" | ||
| 27 | aria-label="Link this PR" | ||
| 28 | disabled={pending} | ||
| 29 | onPointerDown={(event) => event.stopPropagation()} | ||
| 30 | onClick={async (event) => { | ||
| 31 | event.preventDefault(); | ||
| 32 | event.stopPropagation(); | ||
| 33 | setPending(true); | ||
| 34 | try { | ||
| 35 | await linking.changeLink(threadRef, url, true); | ||
| 36 | } catch (error) { | ||
| 37 | toastManager.add({ | ||
| 38 | type: "error", | ||
| 39 | title: "Could not link pull request", | ||
| 40 | description: error instanceof Error ? error.message : String(error), | ||
| 41 | }); | ||
| 42 | } finally { | ||
| 43 | setPending(false); | ||
| 44 | } | ||
| 45 | }} | ||
| 46 | > | ||
| 47 | <Link2 className="size-3" /> | ||
| 48 | </Button> | ||
| 49 | } | ||
| 50 | /> | ||
| 51 | <TooltipPopup>Link this PR to keep it with this thread</TooltipPopup> | ||
| 52 | </Tooltip> | ||
| 53 | ); | ||
| 54 | } | ||