fix(admin-dashboard): статьи с будущим published_at показывать как «Запланировано» (синий), не «Опубликовано»
This commit is contained in:
@@ -159,13 +159,19 @@ export default async function AdminDashboard() {
|
|||||||
{a.title}
|
{a.title}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-2 mt-0.5">
|
<div className="flex items-center gap-2 mt-0.5">
|
||||||
<span className={`text-xs px-1.5 py-0.5 rounded-full font-medium ${
|
{(() => {
|
||||||
a.status === 'published'
|
const future = a.status === 'published' && a.published_at && new Date(a.published_at) > new Date();
|
||||||
|
const cls = future
|
||||||
|
? 'bg-blue-50 dark:bg-blue-950 text-blue-600 dark:text-blue-400'
|
||||||
|
: a.status === 'published'
|
||||||
? 'bg-emerald-50 dark:bg-emerald-950 text-emerald-600 dark:text-emerald-400'
|
? 'bg-emerald-50 dark:bg-emerald-950 text-emerald-600 dark:text-emerald-400'
|
||||||
: 'bg-amber-50 dark:bg-amber-950 text-amber-600 dark:text-amber-400'
|
: 'bg-amber-50 dark:bg-amber-950 text-amber-600 dark:text-amber-400';
|
||||||
}`}>
|
return (
|
||||||
{a.status === 'published' ? 'Опубликовано' : 'Черновик'}
|
<span className={`text-xs px-1.5 py-0.5 rounded-full font-medium ${cls}`}>
|
||||||
|
{future ? 'Запланировано' : (a.status === 'published' ? 'Опубликовано' : 'Черновик')}
|
||||||
</span>
|
</span>
|
||||||
|
);
|
||||||
|
})()}
|
||||||
{a.tags?.slice(0, 2).map(t => (
|
{a.tags?.slice(0, 2).map(t => (
|
||||||
<span key={t} className="text-xs text-neutral-400">#{t}</span>
|
<span key={t} className="text-xs text-neutral-400">#{t}</span>
|
||||||
))}
|
))}
|
||||||
|
|||||||
Reference in New Issue
Block a user