"use client";
import { useState } from "react";
import { useRouter } from "next/navigation";
export default function ActivateRoundButton({ roundId, isActive }: { roundId: string; isActive: boolean }) {
const router = useRouter();
const [loading, setLoading] = useState(false);
async function activate() {
setLoading(true);
await fetch(`/api/rounds/${roundId}/activate`, { method: "POST" });
router.refresh();
setLoading(false);
}
if (isActive) return ✓ فعال;
return (
);
}