From 06e0e757e549112101fede5bd3cc5350aec28bcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Salavisa?= Date: Thu, 12 Mar 2026 22:41:53 +0000 Subject: [PATCH] refactor(web): consolidate commit and PR dialogs to use vcs-dialogs (#426) --- .../components/task/changes-panel-dialogs.tsx | 331 +----------------- .../components/task/changes-panel-hooks.ts | 98 +----- apps/web/components/task/changes-panel.tsx | 118 +------ .../components/task/chat/chat-input-body.tsx | 9 +- .../task/chat/chat-input-container.tsx | 12 +- .../task/chat/chat-input-toolbar.tsx | 58 ++- apps/web/components/vcs/vcs-dialogs.tsx | 112 +++--- 7 files changed, 132 insertions(+), 606 deletions(-) diff --git a/apps/web/components/task/changes-panel-dialogs.tsx b/apps/web/components/task/changes-panel-dialogs.tsx index f496abc1da..4370f89a17 100644 --- a/apps/web/components/task/changes-panel-dialogs.tsx +++ b/apps/web/components/task/changes-panel-dialogs.tsx @@ -1,16 +1,9 @@ "use client"; import { useState } from "react"; -import { - IconGitCommit, - IconGitPullRequest, - IconLoader2, - IconCheck, - IconSparkles, -} from "@tabler/icons-react"; +import { IconGitCommit, IconLoader2, IconCheck } from "@tabler/icons-react"; import { Button } from "@kandev/ui/button"; -import { Tooltip, TooltipContent, TooltipTrigger } from "@kandev/ui/tooltip"; import { Dialog, DialogContent, @@ -29,7 +22,6 @@ import { AlertDialogHeader, AlertDialogTitle, } from "@kandev/ui/alert-dialog"; -import { Checkbox } from "@kandev/ui/checkbox"; import { Label } from "@kandev/ui/label"; import { Input } from "@kandev/ui/input"; import { Textarea } from "@kandev/ui/textarea"; @@ -74,325 +66,6 @@ export function DiscardDialog({ ); } -// --- Generate Button --- - -type GenerateButtonProps = { - onClick: () => void; - isGenerating: boolean; - disabled?: boolean; - tooltip: string; -}; - -function GenerateButton({ onClick, isGenerating, disabled, tooltip }: GenerateButtonProps) { - return ( - - - - - {tooltip} - - ); -} - -// --- Commit Dialog --- - -type CommitDialogProps = { - open: boolean; - onOpenChange: (open: boolean) => void; - commitMessage: string; - onCommitMessageChange: (value: string) => void; - onCommit: () => void; - isLoading: boolean; - stagedFileCount: number; - stagedAdditions: number; - stagedDeletions: number; - isAmend?: boolean; - onAmendChange?: (amend: boolean) => void; - lastCommitMessage?: string | null; - onGenerateMessage?: () => void; - isGenerating?: boolean; -}; - -export function CommitDialog({ - open, - onOpenChange, - commitMessage, - onCommitMessageChange, - onCommit, - isLoading, - stagedFileCount, - stagedAdditions, - stagedDeletions, - isAmend = false, - onAmendChange, - lastCommitMessage, - onGenerateMessage, - isGenerating, -}: CommitDialogProps) { - return ( - - - - - - {isAmend ? "Amend Commit" : "Commit Changes"} - - -
- - {onAmendChange && ( -
- { - onAmendChange(checked === true); - // Pre-fill with last commit message when enabling amend - if (checked === true && lastCommitMessage && !commitMessage.trim()) { - onCommitMessageChange(lastCommitMessage); - } - }} - /> - -
- )} -
-