first commit

This commit is contained in:
a.alinaghipour
2026-04-05 15:53:20 +03:30
commit aa9ed69dd2
96 changed files with 7721 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
"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 <span className="text-xs text-green-600 font-medium px-3 py-1.5"> فعال</span>;
return (
<button onClick={activate} disabled={loading}
className="bg-blue-600 text-white px-3 py-1.5 rounded-lg text-sm hover:bg-blue-700 transition disabled:opacity-50">
{loading ? "..." : "فعال‌سازی"}
</button>
);
}