import React, { useEffect, useState } from 'react'; import { base44 } from '@/api/base44Client'; import { Card } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { Shield, Calendar, Briefcase, LogOut, Activity as ActivityIcon } from 'lucide-react'; const EVENT_LABELS = { signup: 'Signed up', login: 'Logged in', logout: 'Logged out', create_position: 'Created a position', screen_candidate: 'Screened a candidate', hire_candidate: 'Hired a candidate', apply_job: 'Applied for a job', start_interview: 'Started an interview', }; export default function Profile() { const [user, setUser] = useState(null); const [activities, setActivities] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { (async () => { try { const me = await base44.auth.me(); setUser(me); const acts = await base44.entities.UserActivity.filter( { user_email: me.email }, '-created_date', 20 ); setActivities(acts); } catch {} setLoading(false); })(); }, []); if (loading) { return (
); } if (!user) { return
Unable to load profile.
; } const initials = (user.full_name || user.email || 'U') .split(' ') .map((p) => p[0]) .join('') .slice(0, 2) .toUpperCase(); return (
{/* Profile header */}
{initials}

{user.full_name || 'User'}

{user.email}

{/* Info grid */}
Role
{user.role || 'user'}
Account Type
{user.account_type || 'applicant'}
Member Since
{user.created_date ? new Date(user.created_date).toLocaleDateString() : '—'}
{/* Recent activity */}

Recent Activity

{activities.length === 0 ? (

No recent activity.

) : (
{activities.map((a) => (
{EVENT_LABELS[a.event_type] || a.event_type} {a.details && {a.details}}
{a.created_date ? new Date(a.created_date).toLocaleString() : ''}
))}
)}
{/* Logout */}
); }