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, 18:30 UTC
Use action maps for Git dialog title and description
- Replace nested conditional strings with action-to-copy lookup objects - Keep commit/push/create PR dialog text centralized and easier to maintain
Julius Marminge committed
Feb 14, 2026 at 23:08 UTC
58d926fcfba701ebf86f596fc8f1023087493419
1 file changed
+16
-15
apps/web/src/components/GitActionsControl.tsx
+16
-15
@@ -103,6 +103,18 @@ function getMenuActionDisabledReason(
103
return "Create PR is currently unavailable.";
104
}
105
106
+const DIALOG_TITLE_BY_ACTION = {
107
+ commit: "Commit changes",
108
+ push: "Push branch",
109
+ create_pr: "Create pull request",
110
+};
111
+
112
+const DIALOG_DESCRIPTION_BY_ACTION = {
113
+ commit: "Review and confirm your commit. Leave the message blank to auto-generate one.",
114
+ push: "Push this branch now.",
115
+ create_pr: "Create a pull request using generated title/body content.",
116
+};
117
+
118
function GitActionItemIcon({ icon }: { icon: GitActionIconName }) {
119
if (icon === "commit") return <GitCommitIcon />;
120
if (icon === "push") return <CloudUploadIcon />;
@@ -423,19 +435,6 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
435
[api, gitCwd],
436
);
437
426
- const dialogTitle =
427
- activeDialogAction === "commit"
428
- ? "Commit changes"
429
- : activeDialogAction === "push"
430
- ? "Push branch"
431
- : "Create pull request";
432
- const dialogDescription =
433
- activeDialogAction === "commit"
434
- ? "Review and confirm your commit. Leave the message blank to auto-generate one."
435
- : activeDialogAction === "push"
436
- ? "Push this branch now."
437
- : "Create a pull request using generated title/body content.";
438
-
438
if (!gitCwd) return null;
439
440
return (
@@ -576,8 +575,10 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
575
>
576
<DialogPopup>
577
<DialogHeader>
579
- <DialogTitle>{dialogTitle}</DialogTitle>
580
- <DialogDescription>{dialogDescription}</DialogDescription>
578
+ <DialogTitle>{DIALOG_TITLE_BY_ACTION[activeDialogAction ?? "commit"]}</DialogTitle>
579
+ <DialogDescription>
580
+ {DIALOG_DESCRIPTION_BY_ACTION[activeDialogAction ?? "commit"]}
581
+ </DialogDescription>
582
</DialogHeader>
583
<DialogPanel className="space-y-4">
584
<div className="space-y-3 rounded-lg border border-input bg-muted/40 p-3 text-xs">