qudoco-fe/app/(admin)/admin/content-website/page.tsx

48 lines
1.3 KiB
TypeScript
Raw Normal View History

2026-02-17 10:02:35 +00:00
"use client";
2026-02-27 08:52:08 +00:00
import Cookies from "js-cookie";
2026-02-17 10:02:35 +00:00
import ContentWebsite from "@/components/main/content-website";
import {
isApproverOrAdmin,
isContributorRole,
} from "@/constants/user-roles";
2026-02-27 08:52:08 +00:00
2026-02-17 10:02:35 +00:00
import { motion } from "framer-motion";
import { useEffect, useState } from "react";
2026-02-27 08:52:08 +00:00
import ApproverContentWebsite from "@/components/main/content-website-approver";
2026-02-17 10:02:35 +00:00
export default function ContentWebsitePage() {
const [mounted, setMounted] = useState(false);
2026-02-27 08:52:08 +00:00
const [levelId, setLevelId] = useState<string | undefined>();
2026-02-17 10:02:35 +00:00
useEffect(() => {
setMounted(true);
setLevelId(Cookies.get("urie"));
2026-02-17 10:02:35 +00:00
}, []);
if (!mounted) {
return (
<div className="h-full overflow-auto bg-gradient-to-br from-slate-50/50 via-white to-slate-50/50 flex items-center justify-center">
<div className="animate-spin rounded-full h-32 w-32 border-b-2 border-blue-500"></div>
</div>
);
}
return (
<motion.div
className="h-full overflow-auto bg-gradient-to-br from-slate-50/50 via-white to-slate-50/50"
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{ duration: 0.3 }}
>
<div className="p-6">
{isApproverOrAdmin(levelId) ? (
<ApproverContentWebsite />
) : (
<ContentWebsite contributorMode={isContributorRole(levelId)} />
)}
2026-02-17 10:02:35 +00:00
</div>
</motion.div>
);
}