From 117cc2ee1ed905e9d83e8c12f9d8445225211f7b Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 22 Dec 2025 18:20:34 -0600 Subject: [PATCH] Improve design of git success state --- src/components/GitSyncButton.tsx | 76 ++++++++++++++------------------ 1 file changed, 34 insertions(+), 42 deletions(-) diff --git a/src/components/GitSyncButton.tsx b/src/components/GitSyncButton.tsx index 6fbe3402..84899879 100644 --- a/src/components/GitSyncButton.tsx +++ b/src/components/GitSyncButton.tsx @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react'; -import { CloudUpload, Zap, GitBranch, Copy, Check } from 'lucide-react'; +import { CloudUpload, Zap, GitBranch, Copy, Check, CheckCircle2 } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; @@ -11,7 +11,6 @@ import { useGitSettings } from '@/hooks/useGitSettings'; import { useCurrentUser } from '@/hooks/useCurrentUser'; import { useGit } from '@/hooks/useGit'; import { useFSPaths } from '@/hooks/useFSPaths'; -import { useToast } from '@/hooks/useToast'; import { Link } from 'react-router-dom'; import { cn } from '@/lib/utils'; import type { GitCredential } from '@/contexts/GitSettingsContext'; @@ -44,7 +43,6 @@ export function GitSyncButton({ projectId, className }: GitSyncButtonProps) { const { user } = useCurrentUser(); const { git } = useGit(); const { projectsPath } = useFSPaths(); - const { toast } = useToast(); // Determine if we have a remote configured const originRemote = gitStatus?.remotes.find(r => r.name === 'origin'); @@ -177,12 +175,13 @@ export function GitSyncButton({ projectId, className }: GitSyncButtonProps) { }); setSyncState('success'); - } - toast({ - title: 'Push Successful', - description: 'Your code has been synced to the remote repository.', - }); + // Auto-dismiss after 2 seconds + setTimeout(() => { + setOpen(false); + setSyncState('default'); + }, 2000); + } } catch (error) { const message = error instanceof Error ? error.message : 'Failed to push'; setErrorMessage(message); @@ -216,18 +215,17 @@ export function GitSyncButton({ projectId, className }: GitSyncButtonProps) { }, }); - toast({ - title: 'Pull Successful', - description: 'Your local code has been updated from the remote repository.', - }); + setSyncState('success'); + + // Auto-dismiss after 2 seconds + setTimeout(() => { + setOpen(false); + setSyncState('default'); + }, 2000); } catch (error) { const message = error instanceof Error ? error.message : 'Failed to pull'; setErrorMessage(message); - toast({ - title: 'Pull Failed', - description: message, - variant: 'destructive', - }); + setSyncState('error'); } finally { setIsPushing(false); } @@ -257,18 +255,17 @@ export function GitSyncButton({ projectId, className }: GitSyncButtonProps) { }, }); - toast({ - title: 'Push Successful', - description: 'Your code has been synced to the remote repository.', - }); + setSyncState('success'); + + // Auto-dismiss after 2 seconds + setTimeout(() => { + setOpen(false); + setSyncState('default'); + }, 2000); } catch (error) { const message = error instanceof Error ? error.message : 'Failed to push'; setErrorMessage(message); - toast({ - title: 'Push Failed', - description: message, - variant: 'destructive', - }); + setSyncState('error'); } finally { setIsPushing(false); } @@ -391,22 +388,17 @@ export function GitSyncButton({ projectId, className }: GitSyncButtonProps) { // Success state if (syncState === 'success') { return ( -
- - - Successfully synced to remote repository! - - - - +
+
+ +
+
+
+

Successfully Synced!

+

+ Your code has been synced to the remote repository. +

+
); }