diff --git a/client/src/components/run/LaneConsolePane.tsx b/client/src/components/run/LaneConsolePane.tsx index d034531..0e30a6d 100644 --- a/client/src/components/run/LaneConsolePane.tsx +++ b/client/src/components/run/LaneConsolePane.tsx @@ -11,7 +11,7 @@ * @author Nguyễn Ngọc Trí Vĩ */ -import { useCallback, useState } from "react"; +import { useCallback, useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { Play, AlertCircle } from "lucide-react"; import { api } from "../../lib/api"; @@ -39,6 +39,8 @@ export interface LaneConsolePaneProps { cwdSuggestions: CwdSuggestion[]; activeRuns: RunListResponse | null; wsConnected: boolean; + defaultCwd?: string; + onHasActiveRunChange?: (active: boolean) => void; } export function LaneConsolePane({ @@ -51,6 +53,8 @@ export function LaneConsolePane({ cwdSuggestions, activeRuns, wsConnected, + defaultCwd, + onHasActiveRunChange, }: LaneConsolePaneProps) { const { t } = useTranslation("run"); const { t: tLanes } = useTranslation("lanes"); @@ -60,7 +64,7 @@ export function LaneConsolePane({ const [model, setModel] = useState(""); const [permissionMode, setPermissionMode] = useState("acceptEdits"); const [effort, setEffort] = useState(""); - const [cwd, setCwd] = useState(() => lanes.find((l) => l.id === laneId)?.cwd ?? ""); + const [cwd, setCwd] = useState(() => lanes.find((l) => l.id === laneId)?.cwd ?? defaultCwd ?? ""); const [resumeSession, setResumeSession] = useState(null); const [handle, setHandle] = useState(null); const [busy, setBusy] = useState<"start" | "kill" | "attach" | null>(null); @@ -69,6 +73,10 @@ export function LaneConsolePane({ const currentLane = laneId !== null ? lanes.find((l) => l.id === laneId) : null; + useEffect(() => { + onHasActiveRunChange?.(handle !== null); + }, [handle, onHasActiveRunChange]); + const refreshList = useCallback(() => { if (laneId !== null) { api.run @@ -259,7 +267,7 @@ export function LaneConsolePane({ setError(null); }, []); - if (laneId === null) { + if (laneId === null && !showLaneSelector) { return (