@devries-cameron20 / t3code Mirror · read-only / commits / 5a0f5e9f5e
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 25, 19:45 UTC

Improve Git action modal state and PR link handling

- Add an `Open PR` button in the result footer and handle link-open errors - Populate the commit message field with the generated subject when available - Refine disabled/selected action option styling while git actions are running

Julius Marminge committed Feb 12, 2026 at 14:28 UTC 5a0f5e9f5e779f27ccfdcee316d06750d697672d
1 file changed +45 -12
apps/web/src/components/GitActionsControl.tsx
+45 -12
@@ -350,6 +350,20 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
350 });
351 }, [api, gitStatus?.openPr?.url]);
352
353 + const openPrFromResult = useCallback(() => {
354 + if (!api) {
355 + setGitModalError("Link opening is unavailable.");
356 + return;
357 + }
358 +
359 + const prUrl = gitModalResult?.pr.url ?? null;
360 + if (!prUrl) return;
361 +
362 + void api.shell.openExternal(prUrl).catch((error) => {
363 + setGitModalError(error instanceof Error ? error.message : "Unable to open PR link.");
364 + });
365 + }, [api, gitModalResult?.pr.url]);
366 +
367 const runGitAction = useCallback(async () => {
368 if (!api || !gitCwd || !isGitModalOpen) return;
369 if (!selectedGitModalActionOption || selectedGitModalActionOption.disabled) return;
@@ -398,12 +412,12 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
412
413 if (includeGeneratedCommitMessage) {
414 if (commitRun.commit.status === "created") {
415 + if (commitRun.commit.subject) {
416 + setGitModalCommitMessage(commitRun.commit.subject);
417 + }
418 updateStep(
419 "generate",
420 "completed",
404 - commitRun.commit.subject
405 - ? `Generated: ${commitRun.commit.subject}`
406 - : "Generated commit message.",
421 );
422 } else {
423 updateStep("generate", "skipped", "No local changes to commit.");
@@ -694,15 +708,20 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
708 const borderClass =
709 index < gitModalActionOptions.length - 1 ? "border-b border-border/70" : "";
710 const selected = option.action === gitModalSelectedAction && !option.disabled;
711 + const disabled = option.disabled || isGitActionRunning;
712
713 return (
714 <button
715 key={option.action}
716 type="button"
717 className={`flex w-full items-start gap-3 px-4 py-3 text-left transition-colors duration-150 ${borderClass} ${
703 - selected ? "bg-accent/55" : "bg-card/45 hover:bg-accent/35"
704 - } disabled:cursor-not-allowed disabled:bg-card/45 disabled:text-muted-foreground/65`}
705 - disabled={option.disabled || isGitActionRunning}
718 + selected
719 + ? "bg-accent/55"
720 + : disabled
721 + ? "bg-card/25"
722 + : "bg-card/45 hover:bg-accent/35"
723 + } disabled:cursor-not-allowed`}
724 + disabled={disabled}
725 onClick={() => {
726 setGitModalSelectedAction(option.action);
727 }}
@@ -711,14 +730,20 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
730 <GitActionIcon icon={option.icon} disabled={option.disabled} />
731 </span>
732 <div className="min-w-0 flex-1">
714 - <p className="text-sm text-foreground">{option.label}</p>
733 + <p
734 + className={`text-sm ${disabled ? "text-muted-foreground/60" : "text-foreground"}`}
735 + >
736 + {option.label}
737 + </p>
738 {option.detail && (
716 - <p className="mt-0.5 text-xs text-muted-foreground/70">
739 + <p
740 + className={`mt-0.5 text-xs ${disabled ? "text-muted-foreground/55" : "text-muted-foreground/70"}`}
741 + >
742 {option.detail}
743 </p>
744 )}
745 </div>
721 - {selected ? (
746 + {selected && !disabled ? (
747 <CheckIcon className="mt-0.5 h-4 w-4 shrink-0 text-foreground" />
748 ) : null}
749 </button>
@@ -731,9 +756,7 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
756 const statusTextClass =
757 step.status === "failed"
758 ? "text-rose-500 dark:text-rose-300"
734 - : step.status === "completed"
735 - ? "text-emerald-600 dark:text-emerald-300"
736 - : "text-muted-foreground/70";
759 + : "text-muted-foreground/70";
760
761 return (
762 <div
@@ -783,6 +806,16 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
806 </div>
807 )}
808 <div className="mt-6 flex justify-end gap-2">
809 + {gitModalResult?.pr.url && (
810 + <button
811 + type="button"
812 + className="rounded-xl border border-border px-4 py-2 text-sm text-foreground transition-colors duration-150 hover:bg-accent disabled:cursor-not-allowed disabled:opacity-60"
813 + onClick={openPrFromResult}
814 + disabled={isGitActionRunning}
815 + >
816 + Open PR
817 + </button>
818 + )}
819 <button
820 type="button"
821 className="rounded-xl border border-border px-4 py-2 text-sm text-foreground transition-colors duration-150 hover:bg-accent disabled:cursor-not-allowed disabled:opacity-60"