import type { PostItem, Notification, OnlineStats } from '../api/types'; interface Props { hot: PostItem[]; notifications: Notification[]; online: OnlineStats | null; onPostClick: (id: number) => void; } export default function RightPanel({ hot, notifications, online, onPostClick }: Props) { const hotList = hot?.slice(0, 8) ?? []; const noticeList = notifications?.slice(0, 6) ?? []; const members = online?.users ?? []; return ( <>
🔥 热门帖子
{hotList.length === 0 ? (
暂无数据
) : hotList.map((item, i) => (
onPostClick(item.id)}> {i + 1} {item.title}
))}
📢 最新动态
{noticeList.length === 0 ? (
暂无动态
) : noticeList.map(item => (
onPostClick(item.id)}> {item.title} {item.created_at}
))}
👀 当前浏览 {online?.count ?? '—'} 人
会员 {online?.members ?? 0} · 游客 {online?.guests ?? 0}
{members.map(u => ( {u.nickname?.[0] || '?'} ))} {members.length === 0 && ( 暂无会员在线 )}

姜十三论坛 拾三一隅,自在交流。轻量社区,专为小圈子打造。

); }