import { useEffect, useState } from "react"; import { Link, useParams } from "react-router-dom"; import { ArrowLeft, Briefcase, Building2, Calendar, CheckCircle2, Clock, Globe, KeyRound, Mail, Phone, Shield, User, XCircle, } from "lucide-react"; import { Badge } from "../../components/ui/badge"; import { Card, CardContent, CardHeader, CardTitle } from "../../components/ui/card"; import { Separator } from "../../components/ui/separator"; import { Avatar, AvatarFallback, AvatarImage } from "../../components/ui/avatar"; import { cn } from "../../lib/utils"; import { getTeamMemberById } from "../../api/team.api"; import type { TeamMember } from "../../types/team.types"; function formatDate(dateStr: string | null | undefined): string { if (!dateStr) return "โ"; return new Date(dateStr).toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric", }); } function formatDateTime(dateStr: string | null | undefined): string { if (!dateStr) return "โ"; return new Date(dateStr).toLocaleString("en-US", { year: "numeric", month: "long", day: "numeric", hour: "2-digit", minute: "2-digit", }); } function formatRoleLabel(role: string): string { return role .split("_") .map((w) => w.charAt(0).toUpperCase() + w.slice(1)) .join(" "); } function formatEmploymentType(type: string): string { return type .split("_") .map((w) => w.charAt(0).toUpperCase() + w.slice(1)) .join(" "); } function getRoleBadgeClasses(role: string): string { switch (role) { case "super_admin": return "bg-brand-500/15 text-brand-600 border border-brand-500/25"; case "admin": return "bg-brand-100 text-brand-600 border border-brand-200"; case "content_manager": return "bg-mint-100 text-mint-500 border border-mint-300/40"; case "instructor": return "bg-gold-100 text-gold-600 border border-gold-300/40"; case "support_agent": return "bg-orange-100 text-orange-600 border border-orange-200"; case "finance": return "bg-sky-100 text-sky-600 border border-sky-200"; case "hr": return "bg-pink-100 text-pink-600 border border-pink-200"; case "analyst": return "bg-violet-100 text-violet-600 border border-violet-200"; default: return "bg-grayScale-100 text-grayScale-600 border border-grayScale-200"; } } function LoadingSkeleton() { return (
{member.job_title} ยท {member.department}