diff --git a/app/[type]/[slug]/page.tsx b/app/[type]/[slug]/page.tsx
index 5c289e6..3187654 100644
--- a/app/[type]/[slug]/page.tsx
+++ b/app/[type]/[slug]/page.tsx
@@ -220,7 +220,7 @@ export default async function Page({ params }: { params: Promise<{ type: string;
if (!PAGE_TYPES.includes(pageType)) notFound();
const page = await getPageBySlug(slug, pageType);
- if (!page || (!user?.isAdmin && page.status == "ARCHIVED")) notFound();
+ if (!page || (!user?.isAdmin && (page.status === "ARCHIVED" || page.status === "DRAFT"))) notFound();
const navlink = await getNavLinkByPageId(page.id);
@@ -233,7 +233,8 @@ export default async function Page({ params }: { params: Promise<{ type: string;
const isNews = page.type === "NEWS";
const isArchived = page.status === "ARCHIVED";
- const wasUpdated = formatDate(page.publishedAt) !== formatDate(page.updatedAt);
+ const isDraft = page.status === "DRAFT";
+ const wasUpdated = page.updatedAt !== page.publishedAt;
const location = (page.meta as PageMeta)?.location;
const wasUpdatedByOther = page.updatedBy && page.createdBy !== page.updatedBy;
@@ -241,8 +242,15 @@ export default async function Page({ params }: { params: Promise<{ type: string;
publishedAt: isNews ? formatDate(page.publishedAt) : null,
updatedAt: (wasUpdated || !isNews) ? formatDate(page.updatedAt) : null,
location: location ?? null,
- author: user?.isAdmin ? `${createdBy?.firstName} ${createdBy?.secondName}` : null,
- updatedBy: user?.isAdmin && wasUpdatedByOther ? `${updatedBy?.firstName} ${updatedBy?.secondName}` : null,
+ author:
+ user?.isAdmin && createdBy
+ ? `${createdBy.firstName} ${createdBy.secondName}`
+ : null,
+
+ updatedBy:
+ user?.isAdmin && wasUpdatedByOther && updatedBy
+ ? `${updatedBy.firstName} ${updatedBy.secondName}`
+ : null,
};
return (
@@ -255,8 +263,8 @@ export default async function Page({ params }: { params: Promise<{ type: string;
- {!isArchived &&