Skip to content

Commit c021011

Browse files
committed
feat(pingdotgg#6315): add Git History client
1 parent 51ca862 commit c021011

41 files changed

Lines changed: 6984 additions & 30 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/web/src/components/ChatView.tsx‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ import {
544544
ATTACHMENT_ONLY_BOOTSTRAP_PROMPT,
545545
recallableComposerPrompt,
546546
} from "./chat/composerPromptHistory";
547+
import { hasGitHistoryCapability } from "../gitHistoryCapability";
547548

548549
const EMPTY_ACTIVITIES: OrchestrationThreadActivity[] = [];
549550
const EMPTY_QUEUED_MESSAGES: QueuedComposerMessage[] = [];
@@ -632,6 +633,7 @@ const selectAutoShowFloatingPreview = (settings: { browserAutoShowFloatingPrevie
632633
const DevicePanel = lazy(() =>
633634
import("./device/DevicePanel").then((module) => ({ default: module.DevicePanel })),
634635
);
636+
const GitHistoryPanel = lazy(() => import("./GitHistoryPanel"));
635637
const FilePreviewPanel = lazy(() => import("./files/FilePreviewPanel"));
636638
const EMPTY_PENDING_FILE_SURFACE_IDS: ReadonlySet<string> = new Set();
637639
const TYPE_TO_FOCUS_EDITABLE_SELECTOR = [
@@ -2629,6 +2631,7 @@ export default function ChatView(props: ChatViewProps) {
26292631
const issuesCapabilityKnown = serverConfig !== null;
26302632
const supportsPullRequests = serverConfig?.environment.capabilities.pullRequests === true;
26312633
const supportsIssues = serverConfig?.environment.capabilities.issues === true;
2634+
const supportsGitHistory = hasGitHistoryCapability(serverConfig?.environment.capabilities);
26322635
const issuesSurfaceCapabilityState = resolveSourceControlSurfaceCapability({
26332636
capabilityKnown: issuesCapabilityKnown,
26342637
supported: supportsIssues,
@@ -4586,6 +4589,10 @@ export default function ChatView(props: ChatViewProps) {
45864589
useRightPanelStore.getState().open(activeThreadRef, "diff");
45874590
onDiffPanelOpen?.();
45884591
}, [activeThreadRef, isGitRepo, isServerThread, onDiffPanelOpen]);
4592+
const addGitHistorySurface = useCallback(() => {
4593+
if (!activeThreadRef || !isGitRepo || !supportsGitHistory) return;
4594+
useRightPanelStore.getState().open(activeThreadRef, "git-history");
4595+
}, [activeThreadRef, isGitRepo, supportsGitHistory]);
45894596
const addFilesSurface = useCallback(() => {
45904597
if (!activeThreadRef || !activeProject) return;
45914598
useRightPanelStore.getState().open(activeThreadRef, "files");
@@ -9741,6 +9748,13 @@ export default function ChatView(props: ChatViewProps) {
97419748
workspaceMutationId={workspaceMutationId}
97429749
/>
97439750
</Suspense>
9751+
) : renderedRightPanelSurface?.kind === "git-history" &&
9752+
supportsGitHistory &&
9753+
isGitRepo &&
9754+
gitCwd !== null ? (
9755+
<Suspense fallback={null}>
9756+
<GitHistoryPanel environmentId={environmentId} cwd={gitCwd} active={rightPanelOpen} />
9757+
</Suspense>
97449758
) : renderedRightPanelSurface?.kind === "pull-request" && !pullRequestsCapabilityKnown ? (
97459759
<DetailGhost label="Loading pull request" />
97469760
) : renderedRightPanelSurface?.kind === "pull-request" && !supportsPullRequests ? (
@@ -10506,6 +10520,7 @@ export default function ChatView(props: ChatViewProps) {
1050610520
onAddBrowserInProfile={createBrowserSurface}
1050710521
onAddTerminal={addTerminalSurface}
1050810522
onAddDiff={addDiffSurface}
10523+
onAddGitHistory={addGitHistorySurface}
1050910524
onAddFiles={addFilesSurface}
1051010525
onAddPullRequest={addPullRequestSurface}
1051110526
onAddIssue={addIssueSurface}
@@ -10515,6 +10530,7 @@ export default function ChatView(props: ChatViewProps) {
1051510530
browserAvailable={isPreviewSupportedInRuntime()}
1051610531
terminalAvailable={activeProject !== null}
1051710532
diffAvailable={isServerThread && isGitRepo}
10533+
gitHistoryAvailable={isGitRepo && supportsGitHistory}
1051810534
filesAvailable={activeProject !== null}
1051910535
pullRequestAvailable={pullRequestSurfaceAvailable}
1052010536
issueAvailable={issueSurfaceAvailable}
@@ -10567,6 +10583,7 @@ export default function ChatView(props: ChatViewProps) {
1056710583
onAddBrowserInProfile={createBrowserSurface}
1056810584
onAddTerminal={addTerminalSurface}
1056910585
onAddDiff={addDiffSurface}
10586+
onAddGitHistory={addGitHistorySurface}
1057010587
onAddFiles={addFilesSurface}
1057110588
onAddPullRequest={addPullRequestSurface}
1057210589
onAddIssue={addIssueSurface}
@@ -10576,6 +10593,7 @@ export default function ChatView(props: ChatViewProps) {
1057610593
browserAvailable={isPreviewSupportedInRuntime()}
1057710594
terminalAvailable={activeProject !== null}
1057810595
diffAvailable={isServerThread && isGitRepo}
10596+
gitHistoryAvailable={isGitRepo && supportsGitHistory}
1057910597
filesAvailable={activeProject !== null}
1058010598
pullRequestAvailable={pullRequestSurfaceAvailable}
1058110599
issueAvailable={issueSurfaceAvailable}

0 commit comments

Comments
 (0)