'use client' import Link from 'next/link' import { trpc } from '@/lib/trpc/client' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { Skeleton } from '@/components/ui/skeleton' import { MessageCircle } from 'lucide-react' function formatRelativePast(date: Date | string | null): string { if (!date) return '' const d = typeof date === 'string' ? new Date(date) : date const ms = Date.now() - d.getTime() const minutes = Math.floor(ms / 60_000) const hours = Math.floor(ms / 3_600_000) const days = Math.floor(ms / 86_400_000) if (days > 0) return `${days}d ago` if (hours > 0) return `${hours}h ago` return `${Math.max(0, minutes)}m ago` } export function RecentMessagesCard() { const { data, isLoading } = trpc.mentor.getRecentMessages.useQuery({ limit: 5 }) return ( Recent Messages {isLoading ? (
{[1, 2, 3].map((i) => ( ))}
) : !data || data.unread.length === 0 ? (

No new messages. Your mentees will appear here when they reach out.

) : ( )}
) }