diff --git a/src/components/git-sync/steps/ForcePullDialog.tsx b/src/components/git-sync/steps/ForcePullDialog.tsx new file mode 100644 index 00000000..608e5c0f --- /dev/null +++ b/src/components/git-sync/steps/ForcePullDialog.tsx @@ -0,0 +1,63 @@ +import { AlertTriangle } from 'lucide-react'; +import { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, +} from '@/components/ui/alert-dialog'; + +interface ForcePullDialogProps { + open: boolean; + onOpenChange: (open: boolean) => void; + onConfirm: () => void; +} + +export function ForcePullDialog({ open, onOpenChange, onConfirm }: ForcePullDialogProps) { + const handleConfirm = () => { + onOpenChange(false); + onConfirm(); + }; + + return ( + + + + + + Force Pull - Discard Local Changes? + + +

+ This will permanently discard all local changes and reset your repository to match the remote. +

+

+ This action cannot be undone. Any uncommitted work will be lost. +

+
+

What will happen:

+
    +
  • All local changes will be discarded
  • +
  • Repository will reset to remote state
  • +
  • Latest changes will be pulled from remote
  • +
+
+
+
+ + Cancel + + + Force Pull + + +
+
+ ); +} diff --git a/src/components/git-sync/steps/SyncStep.tsx b/src/components/git-sync/steps/SyncStep.tsx index f3a5dad3..9d967dcc 100644 --- a/src/components/git-sync/steps/SyncStep.tsx +++ b/src/components/git-sync/steps/SyncStep.tsx @@ -1,5 +1,5 @@ import { useState, useCallback } from 'react'; -import { Zap, Copy, Check, RefreshCw, EllipsisVertical, CloudOff, ExternalLink, ChevronDown, ArrowDown, ArrowUp, AlertTriangle } from 'lucide-react'; +import { Zap, Copy, Check, RefreshCw, EllipsisVertical, CloudOff, ExternalLink, ChevronDown, ArrowDown, ArrowUp } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; @@ -9,18 +9,9 @@ import { DropdownMenuItem, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; -import { - AlertDialog, - AlertDialogAction, - AlertDialogCancel, - AlertDialogContent, - AlertDialogDescription, - AlertDialogFooter, - AlertDialogHeader, - AlertDialogTitle, -} from '@/components/ui/alert-dialog'; import { ExternalFavicon } from '@/components/ExternalFavicon'; import { SyncStepError } from './SyncStepError'; +import { ForcePullDialog } from './ForcePullDialog'; import { useGitStatus } from '@/hooks/useGitStatus'; import { useGitSettings } from '@/hooks/useGitSettings'; import { useGit } from '@/hooks/useGit'; @@ -259,8 +250,6 @@ export function SyncStep({ projectId }: StepProps) { } }; - - if (!originRemote) { return null; } @@ -377,46 +366,11 @@ export function SyncStep({ projectId }: StepProps) { - {/* Force Pull Confirmation Dialog */} - - - - - - Force Pull - Discard Local Changes? - - -

- This will permanently discard all local changes and reset your repository to match the remote. -

-

- This action cannot be undone. Any uncommitted work will be lost. -

-
-

What will happen:

-
    -
  • All local changes will be discarded
  • -
  • Repository will reset to remote state
  • -
  • Latest changes will be pulled from remote
  • -
-
-
-
- - Cancel - { - setShowForcePullDialog(false); - handleForcePull(); - }} - className="bg-destructive hover:bg-destructive/90" - > - - Force Pull - - -
-
+ ); }