import { useState, useEffect } from "react"; import Layout from "@/components/Layout"; import SEO from "@/components/SEO"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; import { Heart, Calendar, MapPin, Users, Shield, Zap, Award, Loader2, ChevronDown, ChevronUp, } from "lucide-react"; import { useAuth } from "@/contexts/AuthContext"; import { aethexToast } from "@/lib/aethex-toast"; interface HandbookSection { id: string; category: string; title: string; content: string; order_index: number; } const getCategoryIcon = (category: string) => { switch (category) { case "Benefits": return ; case "Policies": return ; case "Time Off": return ; case "Remote Work": return ; case "Development": return ; case "Recognition": return ; default: return ; } }; export default function StaffTeamHandbook() { const { session } = useAuth(); const [sections, setSections] = useState([]); const [grouped, setGrouped] = useState>({}); const [categories, setCategories] = useState([]); const [expandedCategory, setExpandedCategory] = useState(null); const [loading, setLoading] = useState(true); useEffect(() => { if (session?.access_token) { fetchHandbook(); } }, [session?.access_token]); const fetchHandbook = async () => { try { const res = await fetch("/api/staff/handbook", { headers: { Authorization: `Bearer ${session?.access_token}` }, }); const data = await res.json(); if (res.ok) { setSections(data.sections || []); setGrouped(data.grouped || {}); setCategories(data.categories || []); } } catch (err) { aethexToast.error("Failed to load handbook"); } finally { setLoading(false); } }; if (loading) { return (
); } return (
{/* Background effects */}
{/* Header */}

Team Handbook

Benefits, policies, and team culture

{/* Quick Stats */}

25

Days PTO

100%

Health Coverage

$5K

Learning Budget

Flexible

Remote Work

{/* Handbook Sections by Category */}
{categories.map((category) => ( setExpandedCategory(expandedCategory === category ? null : category)} >
{getCategoryIcon(category)}
{category} {grouped[category]?.length || 0} sections
{expandedCategory === category ? ( ) : ( )}
{expandedCategory === category && (
{grouped[category]?.map((section) => (

{section.title}

{section.content}

))}
)}
))}
{categories.length === 0 && (

No handbook sections found

)} {/* Additional Resources */}

Have Questions?

HR team is here to help with any handbook-related questions or to clarify company policies.

); }