fixes integration

This commit is contained in:
IGNY8 VPS (Salman)
2026-01-13 00:17:38 +00:00
parent 5c3aa90e91
commit 25caea5d90
4 changed files with 78 additions and 16 deletions

View File

@@ -147,18 +147,63 @@ export function createApprovedPageConfig(params: {
date: true,
width: '150px',
render: (value: string, row: Content) => {
if (!value) {
return <span className="text-gray-400 dark:text-gray-500 text-[11px]">Not scheduled</span>;
}
const publishDate = new Date(value);
const now = new Date();
const isFuture = publishDate > now;
const siteStatus = row.site_status;
return (
<span className={isFuture ? "text-blue-600 dark:text-blue-400 font-medium" : "text-amber-600 dark:text-amber-400 font-medium"}>
{formatRelativeDate(value)}
</span>
);
// For published items: show when it was published
if (siteStatus === 'published') {
// Use site_status_updated_at if available, otherwise updated_at
const publishedAt = row.site_status_updated_at || row.updated_at;
if (publishedAt) {
return (
<span className="text-success-600 dark:text-success-400 font-medium">
{formatRelativeDate(publishedAt)}
</span>
);
}
return <span className="text-success-600 dark:text-success-400 text-[11px]">Published</span>;
}
// For failed items: show when the failure occurred
if (siteStatus === 'failed') {
const failedAt = row.site_status_updated_at || row.updated_at;
if (failedAt) {
return (
<span className="text-red-600 dark:text-red-400 font-medium">
{formatRelativeDate(failedAt)}
</span>
);
}
return <span className="text-red-600 dark:text-red-400 text-[11px]">Failed</span>;
}
// For scheduled items: show when it will be published
if (siteStatus === 'scheduled' || siteStatus === 'publishing') {
if (value) {
const publishDate = new Date(value);
const now = new Date();
const isFuture = publishDate > now;
return (
<span className={isFuture ? "text-blue-600 dark:text-blue-400 font-medium" : "text-amber-600 dark:text-amber-400 font-medium"}>
{formatRelativeDate(value)}
</span>
);
}
return <span className="text-amber-600 dark:text-amber-400 text-[11px]">Pending</span>;
}
// For not_published items: show scheduled date if available
if (value) {
const publishDate = new Date(value);
const now = new Date();
const isFuture = publishDate > now;
return (
<span className={isFuture ? "text-blue-600 dark:text-blue-400 font-medium" : "text-amber-600 dark:text-amber-400 font-medium"}>
{formatRelativeDate(value)}
</span>
);
}
return <span className="text-gray-400 dark:text-gray-500 text-[11px]">Not scheduled</span>;
},
},