Skip to content

Commit c2f7b99

Browse files
committed
Push client boundary down from page to AgentRunner component
Static header markup now renders server-side instead of shipping as client JS.
1 parent e29f1d4 commit c2f7b99

2 files changed

Lines changed: 32 additions & 23 deletions

File tree

cursor-cli-demo/app/page.tsx

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
"use client";
2-
3-
import { ControlBar, useRunState } from "@/components/control-bar";
4-
import { Terminal } from "@/components/terminal";
1+
import { AgentRunner } from "@/components/agent-runner";
52

63
export default function Home() {
7-
const { runState, startRun, reset, markComplete } = useRunState();
8-
9-
const showTerminal = runState.status === "running" || runState.status === "complete";
10-
114
return (
125
<main className="min-h-screen p-6 md:p-10 max-w-4xl mx-auto flex flex-col gap-6">
136
<div>
@@ -19,21 +12,7 @@ export default function Home() {
1912
</p>
2013
</div>
2114

22-
<ControlBar runState={runState} onRun={startRun} onReset={reset} />
23-
24-
{showTerminal && (
25-
<Terminal
26-
runId={runState.runId}
27-
publicAccessToken={runState.publicAccessToken}
28-
onComplete={markComplete}
29-
/>
30-
)}
31-
32-
{runState.status === "failed" && (
33-
<div className="bg-red-500/10 border border-red-500/20 rounded-lg p-4 text-sm text-red-400 font-mono">
34-
{runState.error}
35-
</div>
36-
)}
15+
<AgentRunner />
3716
</main>
3817
);
3918
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"use client";
2+
3+
import { ControlBar, useRunState } from "@/components/control-bar";
4+
import { Terminal } from "@/components/terminal";
5+
6+
export function AgentRunner() {
7+
const { runState, startRun, reset, markComplete } = useRunState();
8+
9+
const showTerminal = runState.status === "running" || runState.status === "complete";
10+
11+
return (
12+
<>
13+
<ControlBar runState={runState} onRun={startRun} onReset={reset} />
14+
15+
{showTerminal && (
16+
<Terminal
17+
runId={runState.runId}
18+
publicAccessToken={runState.publicAccessToken}
19+
onComplete={markComplete}
20+
/>
21+
)}
22+
23+
{runState.status === "failed" && (
24+
<div className="bg-red-500/10 border border-red-500/20 rounded-lg p-4 text-sm text-red-400 font-mono">
25+
{runState.error}
26+
</div>
27+
)}
28+
</>
29+
);
30+
}

0 commit comments

Comments
 (0)