Răsfoiți Sursa

92080 add count badge in page list

yuken 4 ani în urmă
părinte
comite
e73a409b8c
1 a modificat fișierele cu 3 adăugiri și 1 ștergeri
  1. 3 1
      packages/app/src/components/Page/DisplaySwitcher.tsx

+ 3 - 1
packages/app/src/components/Page/DisplaySwitcher.tsx

@@ -10,6 +10,7 @@ import {
   useCurrentPagePath, useIsSharedUser, useIsEditable, useCurrentPageId, useIsUserPage, usePageUser,
 } from '~/stores/context';
 import { useSWRxPageComment } from '~/stores/comment';
+import { useSWRxPageList } from '~/stores/page';
 
 
 import { smoothScrollIntoView } from '~/client/util/smooth-scroll';
@@ -45,6 +46,7 @@ const DisplaySwitcher = (): JSX.Element => {
   const { data: isEditable } = useIsEditable();
   const { data: pageUser } = usePageUser();
   const { data: comments } = useSWRxPageComment(currentPageId);
+  const { data: pagingResult } = useSWRxPageList(currentPath ?? null);
 
   const { data: editorMode } = useEditorMode();
 
@@ -74,7 +76,7 @@ const DisplaySwitcher = (): JSX.Element => {
                       >
                         <PageListIcon />
                         {t('page_list')}
-                        <span></span> {/* for a count badge */}
+                        <span>{pagingResult?.totalCount}</span> {/* for a count badge */}
                       </button>
                     ) }
                   </div>