diff --git a/src/components/git-sync/steps/SyncStep.tsx b/src/components/git-sync/steps/SyncStep.tsx index 83a3d962..75bab97c 100644 --- a/src/components/git-sync/steps/SyncStep.tsx +++ b/src/components/git-sync/steps/SyncStep.tsx @@ -1,5 +1,5 @@ import { useState } from 'react'; -import { Zap, GitBranch, Copy, Check, RefreshCw, EllipsisVertical, CloudOff, ExternalLink } from 'lucide-react'; +import { Zap, GitBranch, 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'; @@ -78,6 +78,60 @@ export function SyncStep({ projectId }: StepProps) { } }; + const handlePull = async () => { + if (!originRemote) return; + + setIsSyncing(true); + setError(null); + setSyncSuccess(false); + + try { + const dir = `${projectsPath}/${projectId}`; + + await git.pull({ + dir, + ref: gitStatus?.currentBranch || 'main', + singleBranch: true, + }); + + // Show success feedback + setSyncSuccess(true); + setTimeout(() => setSyncSuccess(false), 1500); + } catch (err) { + const message = err instanceof Error ? err.message : 'Failed to pull'; + setError(message); + } finally { + setIsSyncing(false); + } + }; + + const handlePush = async () => { + if (!originRemote) return; + + setIsSyncing(true); + setError(null); + setSyncSuccess(false); + + try { + const dir = `${projectsPath}/${projectId}`; + + await git.push({ + dir, + remote: 'origin', + ref: gitStatus?.currentBranch || 'main', + }); + + // Show success feedback + setSyncSuccess(true); + setTimeout(() => setSyncSuccess(false), 1500); + } catch (err) { + const message = err instanceof Error ? err.message : 'Failed to push'; + setError(message); + } finally { + setIsSyncing(false); + } + }; + const handleCopyUrl = async () => { if (!originRemote) return; @@ -229,18 +283,49 @@ export function SyncStep({ projectId }: StepProps) { )} - +
+ + + + + + + + Pull + + + + Push + + +
- + ); }