"use client"; import { IconGitCommit, IconGitPullRequest, IconLoader2, IconCheck } from "@tabler/icons-react"; import { Button } from "@kandev/ui/button"; import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter, DialogClose, } from "@kandev/ui/dialog"; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, 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"; // --- Discard Confirmation Dialog --- type DiscardDialogProps = { open: boolean; onOpenChange: (open: boolean) => void; fileToDiscard: string | null; onConfirm: () => void; }; export function DiscardDialog({ open, onOpenChange, fileToDiscard, onConfirm, }: DiscardDialogProps) { return ( Discard changes? This will permanently discard all changes to{" "} {fileToDiscard}. This action cannot be undone. Cancel Discard ); } // --- 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; }; export function CommitDialog({ open, onOpenChange, commitMessage, onCommitMessageChange, onCommit, isLoading, stagedFileCount, stagedAdditions, stagedDeletions, }: CommitDialogProps) { return ( Commit Changes
onCommitMessageChange(e.target.value)} autoFocus />
); } function CommitDialogStats({ stagedFileCount, stagedAdditions, stagedDeletions, }: { stagedFileCount: number; stagedAdditions: number; stagedDeletions: number; }) { return (
{stagedFileCount > 0 ? ( {stagedFileCount} staged file {stagedFileCount !== 1 ? "s" : ""} {(stagedAdditions > 0 || stagedDeletions > 0) && ( (+{stagedAdditions} {" / "} -{stagedDeletions}) )} ) : ( No staged files to commit )}
); } // --- Create PR Dialog --- type PRDialogProps = { open: boolean; onOpenChange: (open: boolean) => void; prTitle: string; onPrTitleChange: (value: string) => void; prBody: string; onPrBodyChange: (value: string) => void; prDraft: boolean; onPrDraftChange: (value: boolean) => void; onCreatePR: () => void; isLoading: boolean; displayBranch: string | null; baseBranch: string | undefined; }; export function PRDialog({ open, onOpenChange, prTitle, onPrTitleChange, prBody, onPrBodyChange, prDraft, onPrDraftChange, onCreatePR, isLoading, displayBranch, baseBranch, }: PRDialogProps) { return ( Create Pull Request
{displayBranch && }
onPrTitleChange(e.target.value)} className="flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50" autoFocus />