feat(blog): add material freshness and authorship
This commit is contained in:
1 parent
3f5258a76c
commit
51ca8c7e34
24 files changed
+187
-52
No files matched your search
@@ -7,6 +7,7 @@ import SafeImage from "./SafeImage";
|
||||
import { useSettingsStore } from "../lib/store/settingsStore";
|
||||
import api, { BASE_DOMAIN } from "../lib/services/api";
|
||||
import { toPersian } from "../lib/utils";
|
||||
import { BLOG_TEAM_FALLBACK, publicationDate, validContentUpdatedAt, persianDate } from "../lib/blogDates";
|
||||
|
||||
export interface BlogPost {
|
||||
id: string;
|
||||
@@ -16,6 +17,10 @@ export interface BlogPost {
|
||||
imageUrl?: string;
|
||||
viewCount: number;
|
||||
createdAt: string;
|
||||
publishedAt?: string;
|
||||
contentUpdatedAt?: string;
|
||||
authorTeam?: string;
|
||||
authorRole?: string;
|
||||
author?: {
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
@@ -108,7 +113,7 @@ export default function BlogPreviewSection() {
|
||||
? `${blog.author.firstName || ""} ${blog.author.lastName || ""}`.trim()
|
||||
: "تحریریه کنینا";
|
||||
|
||||
const formattedDate = new Date(blog.createdAt).toLocaleDateString("fa-IR");
|
||||
|
||||
|
||||
const blogHref = `/blog/${encodeURIComponent(blog.slug || blog.id)}`;
|
||||
|
||||
@@ -134,10 +139,8 @@ export default function BlogPreviewSection() {
|
||||
<div className="p-3.5 sm:p-6 flex-1 flex flex-col justify-between space-y-3 sm:space-y-4">
|
||||
<div className="space-y-1.5 sm:space-y-2">
|
||||
<div className="flex items-center gap-2.5 sm:gap-4 text-[10px] sm:text-xs text-medical-gray-400 font-medium">
|
||||
<span className="flex items-center gap-1">
|
||||
<Calendar className="w-3 h-3 sm:w-3.5 sm:h-3.5" />
|
||||
{toPersian(formattedDate)}
|
||||
</span>
|
||||
<span className="flex items-center gap-1"><Calendar className="w-3 h-3 sm:w-3.5 sm:h-3.5" />تاریخ انتشار: <time dateTime={publicationDate(blog)}>{persianDate(publicationDate(blog))}</time></span>
|
||||
{validContentUpdatedAt(blog) && <span>آخرین بهروزرسانی: <time dateTime={validContentUpdatedAt(blog)}>{persianDate(validContentUpdatedAt(blog))}</time></span>}
|
||||
<span className="flex items-center gap-1">
|
||||
<Eye className="w-3 h-3 sm:w-3.5 sm:h-3.5" />
|
||||
{toPersian(blog.viewCount || 0)}
|
||||
@@ -157,8 +160,8 @@ export default function BlogPreviewSection() {
|
||||
|
||||
<div className="pt-2.5 sm:pt-4 border-t border-medical-gray-200/60 flex items-center justify-between">
|
||||
<span className="text-[10px] sm:text-xs font-bold text-medical-gray-500 truncate max-w-[100px] sm:max-w-none">
|
||||
{authorName}
|
||||
</span>
|
||||
نویسنده: {authorName}
|
||||
</span><span className="text-[10px] sm:text-xs font-bold text-medical-gray-500">تیم: {blog.authorTeam || BLOG_TEAM_FALLBACK}</span>
|
||||
<Link
|
||||
href={blogHref}
|
||||
aria-label={`مطالعه مقاله: ${blog.title}`}
|
||||
|
||||
Reference in new issue
Block a user