diff --git a/src/components/git-sync/GitSyncButton.tsx b/src/components/git-sync/GitSyncButton.tsx
index a1b22f18..2b2f7ee9 100644
--- a/src/components/git-sync/GitSyncButton.tsx
+++ b/src/components/git-sync/GitSyncButton.tsx
@@ -1,5 +1,5 @@
import { useState, useEffect, useRef } from 'react';
-import { CloudUpload, Loader2, Check } from 'lucide-react';
+import { CloudUpload, Loader2, Check, AlertTriangle } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
import { useGitStatus } from '@/hooks/useGitStatus';
@@ -16,6 +16,8 @@ interface GitSyncButtonProps {
export function GitSyncButton({ projectId, className }: GitSyncButtonProps) {
const [open, setOpen] = useState(false);
const [syncSuccess, setSyncSuccess] = useState(false);
+ const [showWarningPopover, setShowWarningPopover] = useState(false);
+ const warningDismissed = useRef(false);
const { data: gitStatus, isLoading: isGitStatusLoading } = useGitStatus(projectId);
const { getError, getState } = useGitSyncState();
@@ -38,6 +40,29 @@ export function GitSyncButton({ projectId, className }: GitSyncButtonProps) {
prevIsGitActionOccurring.current = isGitActionOccurring;
}, [isGitActionOccurring, hasError]);
+ // Check if we need to show the warning popover
+ const needsRemote = !isGitStatusLoading && gitStatus &&
+ !gitStatus.remotes.find(r => r.name === 'origin') &&
+ gitStatus.totalCommits > 1;
+
+ // Show warning popover when purple indicator is visible (only if not dismissed)
+ useEffect(() => {
+ if (needsRemote && !warningDismissed.current) {
+ setShowWarningPopover(true);
+ } else {
+ setShowWarningPopover(false);
+ }
+ }, [needsRemote]);
+
+ // Handle button click - dismiss warning popover permanently
+ const handleButtonClick = () => {
+ if (showWarningPopover) {
+ warningDismissed.current = true;
+ setShowWarningPopover(false);
+ }
+ setOpen(true);
+ };
+
// Determine which indicator to show (only one at a time, in priority order)
const renderIndicator = () => {
// Checkmark: sync just completed successfully - highest priority
@@ -69,7 +94,6 @@ export function GitSyncButton({ projectId, className }: GitSyncButtonProps) {
}
// Purple indicator: no remote configured, but has commits - lowest priority
- const needsRemote = !hasRemote && totalCommits > 1;
if (needsRemote) {
return
+ Your project files are stored in your browser session and could be deleted. Sync with git to back up your project. +
+