'use client' import { useSession } from 'next-auth/react' import { trpc } from '@/lib/trpc/client' import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from '@/components/ui/card' import { Skeleton } from '@/components/ui/skeleton' import { MentorChat } from '@/components/shared/mentor-chat' import { WorkspaceFilesPanel } from '@/components/mentor/workspace-files-panel' import { MessageSquare, UserCircle, FileText, } from 'lucide-react' export default function ApplicantMentorPage() { const { data: session, status: sessionStatus } = useSession() const isAuthenticated = sessionStatus === 'authenticated' const { data: dashboardData, isLoading: dashLoading } = trpc.applicant.getMyDashboard.useQuery( undefined, { enabled: isAuthenticated } ) const projectId = dashboardData?.project?.id const { data: mentorMessages, isLoading: messagesLoading } = trpc.applicant.getMentorMessages.useQuery( { projectId: projectId! }, { enabled: !!projectId } ) const utils = trpc.useUtils() const sendMessage = trpc.applicant.sendMentorMessage.useMutation({ onSuccess: () => { utils.applicant.getMentorMessages.invalidate({ projectId: projectId! }) }, }) if (dashLoading) { return (
) } if (!projectId) { return (

Mentor

No Project

Submit a project first to communicate with your mentor.

) } // TODO(PR8 Task 7): show ALL assigned mentors. For now we display only the // first one until the multi-mentor applicant UI ships. const primaryAssignment = dashboardData?.project?.mentorAssignments?.[0] ?? null const mentor = primaryAssignment?.mentor return (
{/* Header */}

Mentor Communication

Chat with your assigned mentor

{/* Mentor info */} {mentor ? (

{mentor.name || 'Mentor'}

{mentor.email}

) : (

No mentor has been assigned to your project yet. You'll be notified when a mentor is assigned.

)} {/* Chat */} {mentor && ( Messages Your conversation history with {mentor.name || 'your mentor'} { await sendMessage.mutateAsync({ projectId: projectId!, message }) }} isLoading={messagesLoading} isSending={sendMessage.isPending} /> )} {/* Files */} {primaryAssignment?.id && projectId && ( )}
) }