diff --git a/apps/web/src/components/GitActionsControl.logic.ts b/apps/web/src/components/GitActionsControl.logic.ts
index c8831fb2c1..8d3b7bc305 100644
--- a/apps/web/src/components/GitActionsControl.logic.ts
+++ b/apps/web/src/components/GitActionsControl.logic.ts
@@ -54,14 +54,14 @@ export type DefaultBranchConfirmableAction =
| "commit_push"
| "commit_push_pr";
-const GIT_ACTION_SUCCESS_TOAST_VISIBLE_MS = 10_000;
+export const GIT_ACTION_SUCCESS_VISIBLE_MS = 10_000;
export function resolveGitActionResultToastTiming(
type: "error" | "success",
): GitActionResultToastTiming {
return {
timeout: 0,
- dismissAfterVisibleMs: type === "success" ? GIT_ACTION_SUCCESS_TOAST_VISIBLE_MS : null,
+ dismissAfterVisibleMs: type === "success" ? GIT_ACTION_SUCCESS_VISIBLE_MS : null,
};
}
diff --git a/apps/web/src/components/GitActionsControl.tsx b/apps/web/src/components/GitActionsControl.tsx
index b7fc7d695e..4c1623f351 100644
--- a/apps/web/src/components/GitActionsControl.tsx
+++ b/apps/web/src/components/GitActionsControl.tsx
@@ -39,6 +39,7 @@ import { cn } from "~/lib/utils";
import {
buildMenuItems,
formatGitActionElapsed,
+ GIT_ACTION_SUCCESS_VISIBLE_MS,
type GitActionProgressPresentation,
type GitActionIconName,
type GitActionMenuItem,
@@ -143,6 +144,12 @@ interface RunGitActionWithToastInput {
filePaths?: string[];
}
+interface InlineGitActionSuccess {
+ readonly title: string;
+ readonly description: string | null;
+ readonly scopeKey: string;
+}
+
const GIT_STATUS_WINDOW_REFRESH_DEBOUNCE_MS = 250;
type RefreshVcsStatus = (target: {
@@ -349,17 +356,17 @@ function GitQuickActionIcon({
return ;
}
-function GitActionProgressButtonContent({
- progress,
- isPanel,
+function GitActionElapsedTime({
+ startedAtMs,
+ className,
}: {
- progress: GitActionProgressPresentation;
- isPanel: boolean;
+ startedAtMs: number | null;
+ className?: string;
}) {
const [nowMs, setNowMs] = useState(() => Date.now());
useEffect(() => {
- if (progress.startedAtMs === null) {
+ if (startedAtMs === null) {
return;
}
@@ -367,9 +374,23 @@ function GitActionProgressButtonContent({
setNowMs(Date.now());
}, 1_000);
return () => window.clearInterval(intervalId);
- }, [progress.startedAtMs]);
+ }, [startedAtMs]);
- const elapsed = formatGitActionElapsed(progress.startedAtMs, nowMs);
+ const elapsed = formatGitActionElapsed(startedAtMs, nowMs);
+ if (!elapsed) {
+ return null;
+ }
+
+ return
{elapsed}
;
+}
+
+function GitActionProgressButtonContent({
+ progress,
+ isPanel,
+}: {
+ progress: GitActionProgressPresentation;
+ isPanel: boolean;
+}) {
const hasOutput = progress.output !== null;
return (
@@ -377,17 +398,19 @@ function GitActionProgressButtonContent({
aria-atomic="false"
aria-live="polite"
className={cn(
- "grid min-w-0 flex-1 grid-cols-[auto_minmax(0,1fr)_auto] items-center",
+ "grid min-w-0 flex-1 items-center",
// Pin the title row to the button's minimum content height (min-height
// minus vertical padding and border) so revealing the output row
// extends the button downward without re-centering — the title must
// not shift. No row gap: the collapsed output row must contribute zero
// height so the single-line running button matches the static button
// exactly. The panel column gap matches the static row's icon-to-label
- // distance (gap-2.5 plus the label's ml-0.5).
+ // distance (gap-2.5 plus the label's ml-0.5). In the panel the elapsed
+ // counter renders outside the button (in the menu-chevron slot), so
+ // there is no trailing column.
isPanel
- ? "grid-rows-[1.75rem] gap-x-3"
- : "grid-rows-[1.25rem] gap-x-2.5 sm:grid-rows-[1rem]",
+ ? "grid-cols-[auto_minmax(0,1fr)] grid-rows-[1.75rem] gap-x-3"
+ : "grid-cols-[auto_minmax(0,1fr)_auto] grid-rows-[1.25rem] gap-x-2.5 sm:grid-rows-[1rem]",
)}
role="status"
>
@@ -396,14 +419,16 @@ function GitActionProgressButtonContent({
className="row-start-1 -mx-0.5 size-4 shrink-0 text-muted-foreground"
/>
{progress.status}
- {elapsed ? (
-
- {elapsed}
-
+ {!isPanel ? (
+
) : null}
@@ -420,6 +445,36 @@ function GitActionProgressButtonContent({
);
}
+function GitActionSuccessButtonContent({ success }: { success: InlineGitActionSuccess }) {
+ const hasDescription = success.description !== null;
+
+ return (
+
+
+
{success.title}
+
+
+
+ {success.description}
+
+
+
+
+ );
+}
+
interface PublishRepositoryDialogProps {
readonly open: boolean;
readonly onOpenChange: (open: boolean) => void;
@@ -1039,6 +1094,7 @@ export default function GitActionsControl({
"thread branch metadata update",
);
const activeEnvironmentId = activeThreadRef?.environmentId ?? null;
+ const successScopeKey = `${activeEnvironmentId ?? ""}\u0000${gitCwd ?? ""}`;
const serverConfig = useAtomValue(serverEnvironment.configValueAtom(activeEnvironmentId));
const openInPreferredEditor = useOpenInPreferredEditor(
activeEnvironmentId,
@@ -1062,6 +1118,7 @@ export default function GitActionsControl({
const [excludedFiles, setExcludedFiles] = useState
>(new Set());
const [isEditingFiles, setIsEditingFiles] = useState(false);
const [isPublishDialogOpen, setIsPublishDialogOpen] = useState(false);
+ const [inlineSuccess, setInlineSuccess] = useState(null);
const [pendingDefaultBranchAction, setPendingDefaultBranchAction] =
useState(null);
const sourceControlScope = useMemo(
@@ -1069,8 +1126,17 @@ export default function GitActionsControl({
[activeEnvironmentId, gitCwd],
);
const vcsActionState = useAtomValue(vcsActionManager.stateAtom(sourceControlScope));
+ const visibleInlineSuccess = inlineSuccess?.scopeKey === successScopeKey ? inlineSuccess : null;
let runGitActionWithToast: (input: RunGitActionWithToastInput) => Promise;
+ useEffect(() => {
+ if (!inlineSuccess) return;
+ const timeoutId = window.setTimeout(() => {
+ setInlineSuccess(null);
+ }, GIT_ACTION_SUCCESS_VISIBLE_MS);
+ return () => window.clearTimeout(timeoutId);
+ }, [inlineSuccess]);
+
const persistThreadBranchSync = useCallback(
(branch: string | null) => {
if (!activeThreadRef) {
@@ -1327,6 +1393,7 @@ export default function GitActionsControl({
return;
}
onConfirmed?.();
+ setInlineSuccess(null);
const scopedToastData = threadToastData ? { ...threadToastData } : undefined;
const actionId = randomUUID();
@@ -1360,6 +1427,14 @@ export default function GitActionsControl({
const actionResult = result.value;
syncThreadBranchAfterGitAction(actionResult);
+ if (isPanel) {
+ setInlineSuccess({
+ title: actionResult.toast.title,
+ description: actionResult.toast.description ?? null,
+ scopeKey: successScopeKey,
+ });
+ return;
+ }
let resultToastId: GitActionToastId | null = null;
const closeResultToast = () => {
if (resultToastId !== null) {
@@ -1477,6 +1552,7 @@ export default function GitActionsControl({
}
if (quickAction.kind === "run_pull") {
void (async () => {
+ setInlineSuccess(null);
const result = await pullAction.run();
if (result._tag === "Failure") {
if (isAtomCommandInterrupted(result)) {
@@ -1497,14 +1573,20 @@ export default function GitActionsControl({
}
const pullResult = result.value;
+ const title = pullResult.status === "pulled" ? "Pulled" : "Already up to date";
+ const description =
+ pullResult.status === "pulled"
+ ? `Updated ${pullResult.refName} from ${pullResult.upstreamRef ?? "upstream"}`
+ : `${pullResult.refName} is already synchronized.`;
+ if (isPanel) {
+ setInlineSuccess({ title, description, scopeKey: successScopeKey });
+ return;
+ }
const successToastTiming = resolveGitActionResultToastTiming("success");
toastManager.add({
type: "success",
- title: pullResult.status === "pulled" ? "Pulled" : "Already up to date",
- description:
- pullResult.status === "pulled"
- ? `Updated ${pullResult.refName} from ${pullResult.upstreamRef ?? "upstream"}`
- : `${pullResult.refName} is already synchronized.`,
+ title,
+ description,
timeout: successToastTiming.timeout,
data: {
...threadToastData,
@@ -1658,6 +1740,18 @@ export default function GitActionsControl({
>
+ ) : isPanel && visibleInlineSuccess ? (
+
+
+
) : quickActionDisabledReason ? (
)}
- {isPanel ? (
-
+ {isPanel && gitActionProgress ? (
+ // The menu is disabled while an action runs, so its chevron slot
+ // hosts the elapsed counter instead, leaving the full row width to
+ // the status text. Pinned to the title row so it stays put when
+ // the output row expands below.
+
) : (
-
- )}
- {
- if (open) {
- requestVcsStatusRefresh(refreshVcsStatus, activeEnvironmentId, gitCwd);
- }
- }}
- >
-
- }
- disabled={isGitActionRunning}
- >
-
-
-
- {gitActionMenuItems.map((item) => {
- const disabledReason = getMenuActionDisabledReason({
- item,
- gitStatus: gitStatusForActions,
- isBusy: isGitActionRunning,
- hasPrimaryRemote,
- });
- if (item.disabled && disabledReason) {
- return (
-
- }
- >
-
-
- {item.label}
-
-
-
- {disabledReason}
-
-
- );
- }
-
- return (
- {
- openDialogForMenuItem(item);
- }}
- >
-
- {item.label}
-
- );
- })}
- {canPublishRepository ? (
-
+ {isPanel ? (
+
+ ) : (
+
+ )}
+ {
+ if (open) {
+ requestVcsStatusRefresh(refreshVcsStatus, activeEnvironmentId, gitCwd);
+ }
+ }}
+ >
+
+ }
disabled={isGitActionRunning}
- onClick={() => {
- setIsPublishDialogOpen(true);
- }}
>
-
- Publish repository...
-
- ) : null}
- {gitStatusForActions?.refName === null && (
-
- Detached HEAD: create and checkout a refName to enable push and pull request
- actions.
-
- )}
- {gitStatusForActions &&
- gitStatusForActions.refName !== null &&
- !gitStatusForActions.hasWorkingTreeChanges &&
- gitStatusForActions.behindCount > 0 &&
- gitStatusForActions.aheadCount === 0 && (
-
- Behind upstream. Pull/rebase first.
-
- )}
- {gitStatusError && (
- {gitStatusError}
- )}
-
-
+
+
+
+ {gitActionMenuItems.map((item) => {
+ const disabledReason = getMenuActionDisabledReason({
+ item,
+ gitStatus: gitStatusForActions,
+ isBusy: isGitActionRunning,
+ hasPrimaryRemote,
+ });
+ if (item.disabled && disabledReason) {
+ return (
+
+ }
+ >
+
+
+ {item.label}
+
+
+
+ {disabledReason}
+
+
+ );
+ }
+
+ return (
+ {
+ openDialogForMenuItem(item);
+ }}
+ >
+
+ {item.label}
+
+ );
+ })}
+ {canPublishRepository ? (
+ {
+ setIsPublishDialogOpen(true);
+ }}
+ >
+
+ Publish repository...
+
+ ) : null}
+ {gitStatusForActions?.refName === null && (
+
+ Detached HEAD: create and checkout a refName to enable push and pull request
+ actions.
+
+ )}
+ {gitStatusForActions &&
+ gitStatusForActions.refName !== null &&
+ !gitStatusForActions.hasWorkingTreeChanges &&
+ gitStatusForActions.behindCount > 0 &&
+ gitStatusForActions.aheadCount === 0 && (
+
+ Behind upstream. Pull/rebase first.
+
+ )}
+ {gitStatusError && (
+ {gitStatusError}
+ )}
+
+
+ >
+ )}
)}