فهرست منبع

92080 add count badge in page list

yuken 4 سال پیش
والد
کامیت
e73a409b8c
1فایلهای تغییر یافته به همراه3 افزوده شده و 1 حذف شده
  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,
   useCurrentPagePath, useIsSharedUser, useIsEditable, useCurrentPageId, useIsUserPage, usePageUser,
 } from '~/stores/context';
 } from '~/stores/context';
 import { useSWRxPageComment } from '~/stores/comment';
 import { useSWRxPageComment } from '~/stores/comment';
+import { useSWRxPageList } from '~/stores/page';
 
 
 
 
 import { smoothScrollIntoView } from '~/client/util/smooth-scroll';
 import { smoothScrollIntoView } from '~/client/util/smooth-scroll';
@@ -45,6 +46,7 @@ const DisplaySwitcher = (): JSX.Element => {
   const { data: isEditable } = useIsEditable();
   const { data: isEditable } = useIsEditable();
   const { data: pageUser } = usePageUser();
   const { data: pageUser } = usePageUser();
   const { data: comments } = useSWRxPageComment(currentPageId);
   const { data: comments } = useSWRxPageComment(currentPageId);
+  const { data: pagingResult } = useSWRxPageList(currentPath ?? null);
 
 
   const { data: editorMode } = useEditorMode();
   const { data: editorMode } = useEditorMode();
 
 
@@ -74,7 +76,7 @@ const DisplaySwitcher = (): JSX.Element => {
                       >
                       >
                         <PageListIcon />
                         <PageListIcon />
                         {t('page_list')}
                         {t('page_list')}
-                        <span></span> {/* for a count badge */}
+                        <span>{pagingResult?.totalCount}</span> {/* for a count badge */}
                       </button>
                       </button>
                     ) }
                     ) }
                   </div>
                   </div>