From a6ff5eee45215effb3344cb5d631a27a7c0369aa Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Fri, 22 Sep 2023 19:34:01 +0200
Subject: refactor(components): rewrite form components

---
 src/components/templates/page/page-layout.tsx | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

(limited to 'src/components/templates/page/page-layout.tsx')

diff --git a/src/components/templates/page/page-layout.tsx b/src/components/templates/page/page-layout.tsx
index 3c6ff17..72bfd3f 100644
--- a/src/components/templates/page/page-layout.tsx
+++ b/src/components/templates/page/page-layout.tsx
@@ -126,11 +126,11 @@ export const PageLayout: FC<PageLayoutProps> = ({
   const saveComment: CommentFormProps['saveComment'] = async (data, reset) => {
     if (!id) throw new Error('Page id missing. Cannot save comment.');
 
-    const { comment: commentBody, email, name, parentId, website } = data;
+    const { author, comment: commentBody, email, parentId, website } = data;
     const commentData: SendCommentInput = {
-      author: name,
+      author,
       authorEmail: email,
-      authorUrl: website || '',
+      authorUrl: website ?? '',
       clientMutationId: 'contact',
       commentOn: id,
       content: commentBody,
@@ -248,13 +248,13 @@ export const PageLayout: FC<PageLayoutProps> = ({
                 comments={comments}
                 depth={2}
                 Notice={
-                  isReplyRef.current === true && (
+                  isReplyRef.current === true && statusMessage ? (
                     <Notice
                       className={styles.notice}
                       kind={status}
                       message={statusMessage}
                     />
-                  )
+                  ) : null
                 }
                 saveComment={saveComment}
               />
@@ -275,13 +275,13 @@ export const PageLayout: FC<PageLayoutProps> = ({
               title={commentFormTitle}
               titleAlignment="center"
               Notice={
-                isReplyRef.current === false && (
+                isReplyRef.current === false && statusMessage ? (
                   <Notice
                     className={styles.notice}
                     kind={status}
                     message={statusMessage}
                   />
-                )
+                ) : null
               }
             />
           </section>
-- 
cgit v1.2.3

