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
15 changes: 10 additions & 5 deletions apps/web/src/components/ChatView.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useLoadBalancedEnvironment } from "../hooks/useLoadBalancedEnvironment";
import { visibleThreadPullRequests } from "@t3tools/shared/threadPullRequests";
import type { UsageLimitSourceSnapshots } from "@t3tools/contracts";
import {
collectProviderUsageLimits,
Expand Down Expand Up @@ -4203,10 +4204,14 @@ export default function ChatView(props: ChatViewProps) {
}, [activeThreadRef]);
const supportsThreadPullRequests =
serverConfig?.environment.capabilities.threadPullRequests === true;
const pullRequestsSurfaceAvailable =
isServerThread &&
supportsThreadPullRequests &&
visibleThreadPullRequests((activeThreadShell ?? activeThread)?.pullRequests ?? []).length > 0;
const addPullRequestsSurface = useCallback(() => {
if (!activeThreadRef || !supportsThreadPullRequests) return;
if (!activeThreadRef || !pullRequestsSurfaceAvailable) return;
useRightPanelStore.getState().open(activeThreadRef, "pull-requests");
}, [activeThreadRef, supportsThreadPullRequests]);
}, [activeThreadRef, pullRequestsSurfaceAvailable]);
const { state: deviceState, loaded: deviceStateLoaded } = useDeviceState(
activeThreadRef?.environmentId ?? null,
);
Expand Down Expand Up @@ -8340,7 +8345,7 @@ export default function ChatView(props: ChatViewProps) {
}
composerDraftTarget={composerDraftTarget}
onBack={
activeThreadRef !== null && supportsThreadPullRequests
activeThreadRef !== null && pullRequestsSurfaceAvailable
? addPullRequestsSurface
: undefined
}
Expand Down Expand Up @@ -8981,7 +8986,7 @@ export default function ChatView(props: ChatViewProps) {
diffAvailable={isServerThread && isGitRepo}
filesAvailable={activeProject !== null}
pullRequestAvailable={pullRequestSurfaceAvailable}
pullRequestsAvailable={isServerThread && supportsThreadPullRequests}
pullRequestsAvailable={pullRequestsSurfaceAvailable}
agentsAvailable
deviceAvailable={activeThreadRef !== null}
liveAgentCount={agentPanelModel.liveCount}
Expand Down Expand Up @@ -9039,7 +9044,7 @@ export default function ChatView(props: ChatViewProps) {
diffAvailable={isServerThread && isGitRepo}
filesAvailable={activeProject !== null}
pullRequestAvailable={pullRequestSurfaceAvailable}
pullRequestsAvailable={isServerThread && supportsThreadPullRequests}
pullRequestsAvailable={pullRequestsSurfaceAvailable}
agentsAvailable
deviceAvailable={activeThreadRef !== null}
liveAgentCount={agentPanelModel.liveCount}
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/components/CommandPalette.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"use client";

import { threadPullRequestLinkMode } from "@t3tools/client-runtime/thread-pull-request-compatibility";
import { visibleThreadPullRequests } from "@t3tools/shared/threadPullRequests";

import { scopeProjectRef, scopeThreadRef } from "@t3tools/client-runtime/environment";
import {
Expand Down Expand Up @@ -1708,6 +1709,7 @@ function OpenCommandPaletteDialog(props: {
value: "action:open-thread-pull-requests",
searchTerms: ["pull requests", "linked", "stack", "prs"],
title: "Show linked pull requests",
disabled: visibleThreadPullRequests(activeThread.pullRequests).length === 0,
icon: <GitPullRequestArrowIcon className={ITEM_ICON_CLASS} />,
run: async () => {
useRightPanelStore.getState().open(threadRef, "pull-requests");
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/RightPanelTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ const SURFACE_DISABLED_REASONS = {
files: "Files are only available when a project is open.",
diff: "Diff is only available for server threads in Git repositories.",
pullRequest: "This thread's branch has no pull request yet.",
pullRequests: "Linked pull requests are only available for server threads.",
pullRequests: "No linked pull requests are available for this thread.",
agents: "Agents are only available from a thread.",
device: "Devices are only available from a thread.",
} as const;
Expand All @@ -178,7 +178,7 @@ const SURFACE_UNAVAILABLE_HINTS = {
files: "Available when a project is open.",
diff: "Available for Git repositories.",
pullRequest: "No pull request on this branch yet.",
pullRequests: "Available for server threads.",
pullRequests: "No linked pull requests available.",
agents: "Available from a thread.",
device: "Available from a thread.",
} as const;
Expand Down
Loading