Direct Messages
{t("title")}
{t("subtitle")}
{locale === "zh" ? `${unread} 条未读私信` : `${unread} unread message${unread === 1 ? "" : "s"}`}
) : null}{t("loginRequired")}
{t("loginAction")}{t("emptyTitle")}
{t("emptySubtitle")}
{t("goMatching")}"use client"; import { useEffect, useState } from "react"; import { Link } from "@/i18n/navigation"; import { useLocale, useTranslation } from "@/i18n/navigation"; import Footer from "@/app/components/Footer"; import { fetchAuthMe } from "@/app/lib/api-client"; import { fetchConversations, type ConversationItem } from "@/app/lib/chat"; import { mediaUrl } from "@/app/lib/media"; function formatTime(value?: string, locale = "zh"): string { if (!value) return ""; const date = new Date(value); if (Number.isNaN(date.getTime())) return ""; const diff = Date.now() - date.getTime(); const minutes = Math.floor(diff / 60000); if (minutes < 1) return locale === "zh" ? "刚刚" : "Now"; if (minutes < 60) return locale === "zh" ? `${minutes} 分钟前` : `${minutes}m`; const hours = Math.floor(minutes / 60); if (hours < 24) return locale === "zh" ? `${hours} 小时前` : `${hours}h`; const days = Math.floor(hours / 24); if (days < 7) return locale === "zh" ? `${days} 天前` : `${days}d`; return `${date.getMonth() + 1}/${date.getDate()}`; } function ConversationRow({ item, locale }: { item: ConversationItem; locale: string }) { const peerName = item.peer?.name || (locale === "zh" ? "成员" : "Member"); const preview = item.lastMessagePreview || (locale === "zh" ? "开始聊天吧" : "Say hello"); const unread = Number(item.unreadCount || 0); return (
{peerName}
{formatTime(item.lastMessageAt, locale)}{item.peer?.location ? `📍 ${item.peer.location} · ` : ""} {preview}
Direct Messages
{t("subtitle")}
{locale === "zh" ? `${unread} 条未读私信` : `${unread} unread message${unread === 1 ? "" : "s"}`}
) : null}{t("loginRequired")}
{t("loginAction")}{t("emptyTitle")}
{t("emptySubtitle")}
{t("goMatching")}