import { getConversations } from "@/lib/conversations-queries"; import Link from "next/link"; const MAX_ROWS = 4; export async function MessagesWidget() { const conversations = await getConversations(); const unread = conversations.filter((c) => c.unread); if (unread.length === 0) { return (

Messaggi Clienti

Nessun messaggio in attesa ✓

); } const visible = unread.slice(0, MAX_ROWS); return (

Messaggi Clienti

{unread.length} {unread.length === 1 ? "Nuovo" : "Nuovi"}
{visible.map((conv) => (

{conv.brand_name}

{conv.lastMessage}

Rispondi → ))}
{unread.length > MAX_ROWS && ( Vedi tutti i messaggi )}
); }