"use client"; import { useState, useEffect } from "react"; import { RefreshCw, Check, Plus, Minus, FileCode2 } from "lucide-react"; import { toast } from "sonner"; interface GitStatus { staged: string[]; modified: string[]; untracked: string[]; branch: string; } export default function GitPanel() { const [status, setStatus] = useState({ staged: [], modified: [], untracked: [], branch: "main" }); const [message, setMessage] = useState(""); const [loading, setLoading] = useState(false); // Mock initial load for UI demonstration // Real implementation would hit /api/git useEffect(() => { function DefaultState(){ setStatus({ staged: [], modified: ["app/page.tsx", "components/layout/Sidebar.tsx"], untracked: ["components/git/GitPanel.tsx"], branch: "main" }); } DefaultState(); }, []); const refresh = () => { setLoading(true); setTimeout(() => setLoading(false), 500); }; const commit = () => { if (!message) { toast.error("Please enter a commit message"); return; } toast.success(`Committed on ${status.branch}: ${message}`); setMessage(""); setStatus(s => ({ ...s, staged: [], modified: [], untracked: [] })); }; return (
Source Control