import { Button } from "@/components/ui/button"; import { ArrowLeft } from "lucide-react"; import { useParams, useSearchParams } from "next/navigation"; import { toast } from "sonner"; export const HistoryView = function () { const { repoId } = useParams<{ repoId: string }>(); const searchParams = useSearchParams(); const commitId = searchParams.get("commit"); const handleSetAsDefault = async () => { const confirmation = confirm( "This action will set this historical version as the default version of the project. Are you sure you want to proceed?" ); if (!confirmation) return; const response = await fetch(`/api/projects/${repoId}/${commitId}`, { method: "POST", }).then(async (response) => { if (response.ok) { const data = await response.json(); return data; } throw new Error("Failed to save changes"); }); if (response.success) { toast.success("Set as default version successfully!"); setTimeout(() => { close(); }, 500); } else { alert("Failed to set as default version, try again later."); } }; const close = () => { window.location.replace(window.location.pathname); }; return (
✏️
👀
🔒

History View Enabled

You are currently viewing a historical version of this project. Editing is disabled in this mode.

); };