jam411 3 лет назад
Родитель
Сommit
095386f31d

+ 7 - 5
packages/app/src/components/PageComment.tsx

@@ -131,7 +131,7 @@ export const PageComment: FC<PageCommentProps> = memo((props:PageCommentProps):
   commentTitleClasses = titleAlign != null ? `${commentTitleClasses} text-${titleAlign}` : `${commentTitleClasses} text-center`;
 
   if (commentsFromOldest == null || commentsExceptReply == null || rendererOptions == null || currentPagePath == null || currentPage == null) {
-    if (hideIfEmpty) {
+    if (hideIfEmpty && comments?.length === 0) {
       return <></>;
     }
     return (
@@ -219,10 +219,12 @@ export const PageComment: FC<PageCommentProps> = memo((props:PageCommentProps):
               })}
             </div>
             {/* TODO: Check if identical-page */}
-            <CommentEditorLazyRenderer
-              pageId={pageId}
-              rendererOptions={rendererOptions}
-            />
+            {(!isReadOnly) && (
+              <CommentEditorLazyRenderer
+                pageId={pageId}
+                rendererOptions={rendererOptions}
+              />
+            )}
           </div>
         </div>
       </div>

+ 2 - 9
packages/app/src/components/SearchPage/SearchResultContent.tsx

@@ -81,8 +81,7 @@ export const SearchResultContent: FC<Props> = (props: Props) => {
   const SubNavButtons = dynamic<SubNavButtonsProps>(() => import('../Navbar/SubNavButtons').then(mod => mod.SubNavButtons), { ssr: false });
   const RevisionLoader = dynamic(() => import('../Page/RevisionLoader'), { ssr: false });
   const PageComment = dynamic(() => import('../PageComment').then(mod => mod.PageComment), { ssr: false });
-  // Commentout for eslint error, PageContentFooter is imported in PgaeComment
-  // const PageContentFooter = dynamic(() => import('../PageContentFooter'), { ssr: false });
+  const PageContentFooter = dynamic(() => import('../PageContentFooter').then(mod => mod.PageContentFooter), { ssr: false });
 
   const scrollElementRef = useRef(null);
 
@@ -218,13 +217,7 @@ export const SearchResultContent: FC<Props> = (props: Props) => {
           highlightKeywords={highlightKeywords}
         />
         <PageComment pageId={page._id} highlightKeywords={highlightKeywords} isReadOnly hideIfEmpty />
-        {/* TODO: Commentout for eslint error */}
-        {/* <PageContentFooter
-          // createdAt={new Date(pageWithMeta.data.createdAt)}
-          // updatedAt={new Date(pageWithMeta.data.updatedAt)}
-          // creator={pageWithMeta.data.creator}
-          // revisionAuthor={pageWithMeta.data.lastUpdateUser}
-        /> */}
+        <PageContentFooter />
       </div>
     </div>
   );