From 0dbe51fd88cc3acb0997ee1a014763d5ce661897 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 24 Dec 2025 15:49:55 -0600 Subject: [PATCH] Add separate pull and push actions to sync --- src/components/git-sync/steps/SyncStep.tsx | 109 ++++++++++++++++++--- 1 file changed, 97 insertions(+), 12 deletions(-) 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 + + +
- + ); }