'use client'; import Image from 'next/image'; import Link from 'next/link'; import { useSession } from 'next-auth/react'; import { useRouter, usePathname } from 'next/navigation'; import { Tag } from './Tag'; interface ProfileCardProps { firstName: string; lastName: string; isVerified: boolean; title: string; location: string; memberSince: string; bio: string; expertise: string[]; showEditButton?: boolean; editHref?: string; messageHref?: string; requestsHref?: string; } export function ProfileCard({ firstName, lastName, isVerified, title, location, memberSince, bio, expertise, showEditButton = false, editHref = '/agent/edit', messageHref, requestsHref, }: ProfileCardProps) { const { data: session } = useSession(); const router = useRouter(); const pathname = usePathname(); // Handle action click - require login if not authenticated const handleActionClick = (e: React.MouseEvent, targetHref?: string) => { if (!session) { e.preventDefault(); // Store the current page to redirect back after login const returnUrl = encodeURIComponent(pathname); router.push(`/login?callbackUrl=${returnUrl}`); return; } // If logged in and has href, navigation will happen naturally via Link if (!targetHref) { e.preventDefault(); // Handle button click when logged in but no href specified } }; return (
{title}
{bio}
{/* Expertise Tags */}Expertise: