From 924fe0ebae0de6fbec41a279f6fdc11100cf10f9 Mon Sep 17 00:00:00 2001 From: Nurfirliana Muzanella Date: Wed, 25 Sep 2024 09:48:55 +0700 Subject: [PATCH 1/4] fix wrong documentType data --- libs/domain-frontend/src/models/TanamDocument.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/domain-frontend/src/models/TanamDocument.ts b/libs/domain-frontend/src/models/TanamDocument.ts index 9d77a810..719401af 100644 --- a/libs/domain-frontend/src/models/TanamDocument.ts +++ b/libs/domain-frontend/src/models/TanamDocument.ts @@ -20,8 +20,8 @@ export class TanamDocument extends TanamDocumentBase { snap.id, data.createdAt, data.updatedAt, - data.data, data.documentType, + data.data, data.revision, data.publishedAt, ); From 05e328f37033c8eee271d41e57b69442082ee0cb Mon Sep 17 00:00:00 2001 From: Nurfirliana Muzanella Date: Wed, 25 Sep 2024 09:51:56 +0700 Subject: [PATCH 2/4] fix title not showing in the DocumentTypeGenericList --- .../src/DocumentType/DocumentTypeGenericList.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/ui-components/src/DocumentType/DocumentTypeGenericList.tsx b/libs/ui-components/src/DocumentType/DocumentTypeGenericList.tsx index ccfb1469..553bb507 100644 --- a/libs/ui-components/src/DocumentType/DocumentTypeGenericList.tsx +++ b/libs/ui-components/src/DocumentType/DocumentTypeGenericList.tsx @@ -8,14 +8,14 @@ interface TableOverviewGenericProps { isLoading?: boolean; } -export function DocumentTypeGenericList({documents, documentType, isLoading}: TableOverviewGenericProps) { +export function DocumentTypeGenericList({documents, isLoading}: TableOverviewGenericProps) { return ( [ -

{document.data[documentType.titleField] as string}

+

{(document.data.title as string) || ""}

,

{document.createdAt?.toDate().toUTCString()} From a009447c439fb595cb23bacecd984673d6ef15c9 Mon Sep 17 00:00:00 2001 From: Nurfirliana Muzanella Date: Wed, 25 Sep 2024 10:00:53 +0700 Subject: [PATCH 3/4] fix title and update title not working in detail article --- .../content/article/[documentId]/page.tsx | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/apps/cms/src/app/(protected)/content/article/[documentId]/page.tsx b/apps/cms/src/app/(protected)/content/article/[documentId]/page.tsx index a584ba97..f04f2048 100644 --- a/apps/cms/src/app/(protected)/content/article/[documentId]/page.tsx +++ b/apps/cms/src/app/(protected)/content/article/[documentId]/page.tsx @@ -28,18 +28,9 @@ export default function DocumentDetailsPage() { useEffect(() => { if (updateTitleShown) return; - async function onDocumentTitleChange(title: string) { - console.log("[onDocumentTitleChange]", title); - if (!document) { - return; - } - - document.data.title = title; - await update(document); - } onDocumentTitleChange(title); - }, [document, title, update, updateTitleShown]); + }, [updateTitleShown]); useEffect(() => { if (document) { @@ -49,6 +40,16 @@ export default function DocumentDetailsPage() { return () => setTitle(""); }, [document]); + async function onDocumentTitleChange(title: string) { + console.log("[onDocumentTitleChange]", title); + if (!document) { + return; + } + + document.data.title = title; + await update(document); + } + async function onDocumentContentChange(content: string) { console.log("[onDocumentContentChange]", content); if (!document) { From 7440ddc73bf151c6412de93192496cbdc430816a Mon Sep 17 00:00:00 2001 From: Nurfirliana Muzanella Date: Wed, 25 Sep 2024 10:35:55 +0700 Subject: [PATCH 4/4] put back to the original --- .../src/DocumentType/DocumentTypeGenericList.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/ui-components/src/DocumentType/DocumentTypeGenericList.tsx b/libs/ui-components/src/DocumentType/DocumentTypeGenericList.tsx index 553bb507..ccfb1469 100644 --- a/libs/ui-components/src/DocumentType/DocumentTypeGenericList.tsx +++ b/libs/ui-components/src/DocumentType/DocumentTypeGenericList.tsx @@ -8,14 +8,14 @@ interface TableOverviewGenericProps { isLoading?: boolean; } -export function DocumentTypeGenericList({documents, isLoading}: TableOverviewGenericProps) { +export function DocumentTypeGenericList({documents, documentType, isLoading}: TableOverviewGenericProps) { return (

[ -

{(document.data.title as string) || ""}

+

{document.data[documentType.titleField] as string}

,

{document.createdAt?.toDate().toUTCString()}