Files
aragrp/components/changelog-version-card.tsx
ar.badieiandCursor c2376b3b9e
Build & Push Docker Image / build (push) Has been cancelled
feat: redesign landing page with brand system and section blocks
Refresh the homepage around new hero/services/roadmap sections, shared design tokens, and updated brand assets.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-23 17:00:55 +03:30

90 lines
2.6 KiB
TypeScript

import {
CHANGELOG_SECTION_LABELS,
type ChangelogRelease,
} from "@/lib/changelog-types";
import {
buildReleaseParagraph,
formatReleaseDate,
shouldUseParagraphSummary,
} from "@/lib/changelog-display";
import { ChangelogItem } from "@/components/changelog-item";
import { type } from "@/lib/typography";
import { cn } from "@/lib/utils";
import { APP_VERSION } from "@/lib/version";
type ChangelogVersionCardProps = {
release: ChangelogRelease;
};
export function ChangelogVersionCard({ release }: ChangelogVersionCardProps) {
const isCurrent = release.version === APP_VERSION;
const useParagraph =
Boolean(release.summary) ||
shouldUseParagraphSummary(release.sections);
return (
<article
className={cn(
"rounded-xl border bg-card text-start shadow-sm",
isCurrent && "border-primary/30 ring-1 ring-primary/15"
)}
>
<div className="p-4">
<header>
<div className="flex flex-wrap items-center gap-2">
<h2 className={cn(type.h4, "font-mono tracking-normal text-foreground")}>
v{release.version}
</h2>
{isCurrent && (
<span
className={cn(
type.micro,
"rounded-full bg-primary/10 px-2 py-0.5 font-medium text-primary"
)}
>
نسخه فعلی
</span>
)}
</div>
<time
className={cn(type.caption, "mt-1.5 block")}
dateTime={release.date}
dir="ltr"
>
{formatReleaseDate(release.date)}
</time>
</header>
<div
className="my-4 h-px bg-border/70"
role="separator"
aria-hidden
/>
<div className={cn(type["body-sm"], "text-muted-foreground")}>
{release.summary ? (
<p>{release.summary}</p>
) : useParagraph ? (
<p>{buildReleaseParagraph(release.sections)}</p>
) : (
<div className="space-y-2">
{release.sections.map((section) => (
<section key={section.title}>
<h3 className={cn(type.label, "mb-1 text-foreground/80")}>
{CHANGELOG_SECTION_LABELS[section.title]}
</h3>
<ul className="space-y-1 ps-4">
{section.items.map((item, index) => (
<ChangelogItem key={index} text={item} />
))}
</ul>
</section>
))}
</div>
)}
</div>
</div>
</article>
);
}