"use client"; import React, { useEffect, useState } from "react"; import { getAuth, onAuthStateChanged, User } from "firebase/auth"; import { Button } from "@heroui/button"; import { Link } from "@heroui/link"; import { motion } from "framer-motion"; import firebaseApp from "@/config/firebase"; import { title } from "@/components/primitives"; const ADMIN_EMAIL = process.env.NEXT_PUBLIC_ADMIN_EMAIL; export const AdminLinks = () => { const [user, setUser] = useState(null); const [loading, setLoading] = useState(true); useEffect(() => { const auth = getAuth(firebaseApp()); const unsubscribe = onAuthStateChanged(auth, (currentUser) => { setUser(currentUser); setLoading(false); }); return () => unsubscribe(); }, []); if (loading || !user || user.email !== ADMIN_EMAIL) { return null; } const adminTools = [ { name: "Invitation Maker", description: "Create and manage guest invitations", href: "/invitation/maker", icon: "✉️", color: "gold", }, { name: "Updates Maker", description: "Post new announcements for guests", href: "/updates/maker", icon: "📢", color: "pink", }, { name: "Guestbook", description: "Review wishes and messages", href: "/guestbook", icon: "📖", color: "blue", }, ]; return (
{/* Decorative background elements */}
Secure Admin Access

Control Center 

Welcome, {user.email}. What would you like to manage today?

Last Sync

{new Date().toLocaleTimeString()}

{adminTools.map((tool, index) => (
{tool.icon}

{tool.name}

{tool.description}

))}
); };