tahamajs/IE / Projects /front /src /components /dashboard /RecentComments.tsx
tahamajs's picture
download
raw
3.01 kB
// src/components/dashboard/RecentComments.tsx
import { Link } from "react-router-dom";
import { MessageCircle, Sparkles, ArrowRight } from "lucide-react";
interface RecentCommentsProps {
comments: any[];
}
export function RecentComments({ comments: rawComments }: RecentCommentsProps) {
const comments = Array.isArray(rawComments) ? rawComments : [];
return (
<div className="rounded-[2rem] border border-slate-200 bg-white p-5 shadow-sm dark:border-slate-700 dark:bg-slate-800">
<div className="mb-4 flex flex-wrap items-start justify-between gap-3">
<div>
<div className="inline-flex items-center gap-2 rounded-full bg-violet-50 px-3 py-1 text-xs font-semibold text-violet-700 dark:bg-violet-950/40 dark:text-violet-300">
<Sparkles className="h-3.5 w-3.5" />
Reader feedback
</div>
<h2 className="mt-3 flex items-center gap-2 text-xl font-semibold text-slate-900 dark:text-white">
<MessageCircle className="h-5 w-5 text-primary" /> Recent Comments
</h2>
<p className="mt-1 text-sm text-slate-500 dark:text-slate-400">
The newest responses to your work, ready for review and follow-up.
</p>
</div>
</div>
{comments.length === 0 ? (
<div className="rounded-[1.75rem] border border-dashed border-slate-200 bg-slate-50/80 p-6 text-center dark:border-slate-700 dark:bg-slate-900/60">
<MessageCircle className="mx-auto h-10 w-10 text-slate-400" />
<p className="mt-2 text-sm font-medium text-slate-700 dark:text-slate-200">No recent comments yet</p>
<p className="mt-1 text-xs text-slate-500 dark:text-slate-400">
Once people comment on your articles, the latest replies will appear here.
</p>
<Link to="/articles" className="mt-4 inline-flex items-center gap-2 rounded-full bg-primary px-4 py-2 text-xs font-medium text-white transition hover:bg-primary/90">
Review articles <ArrowRight className="h-3.5 w-3.5" />
</Link>
</div>
) : (
<div className="space-y-3">
{comments.map((comment) => (
<div
key={comment.id}
className="rounded-[1.5rem] border border-slate-200 bg-slate-50/80 p-4 dark:border-slate-700 dark:bg-slate-900/70"
>
<p className="text-sm leading-6 line-clamp-2 text-slate-700 dark:text-slate-200">{comment.body}</p>
<Link
to={`/articles/${comment.articleId}`}
className="mt-2 inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline"
>
on "{comment.articleTitle?.substring(0, 50)}..."
</Link>
<p className="mt-2 text-xs text-slate-400 dark:text-slate-500">
{new Date(comment.createdAt).toLocaleDateString()}
</p>
</div>
))}
</div>
)}
</div>
);
}

Xet Storage Details

Size:
3.01 kB
·
Xet hash:
455de76e44d0f360c500b3ebfeddd0904929c28c1829756b302967f7afba0003

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.