Просмотр исходного кода

Merge pull request #8457 from weseek/fix/140392-page-list-count-is-wrong

fix: Page list count is wrong
Yuki Takei 2 лет назад
Родитель
Сommit
dde9016123

+ 2 - 1
apps/app/src/components/Common/CountBadge.tsx

@@ -1,4 +1,5 @@
-import React, { FC } from 'react';
+import type { FC } from 'react';
+import React from 'react';
 
 
 type CountProps = {
 type CountProps = {
   count?: number,
   count?: number,

+ 3 - 2
apps/app/src/components/PageSideContents/PageAccessoriesControl.tsx

@@ -13,12 +13,13 @@ type Props = {
   icon: ReactNode,
   icon: ReactNode,
   label: ReactNode,
   label: ReactNode,
   count?: number,
   count?: number,
+  offset?: number,
   onClick?: () => void,
   onClick?: () => void,
 }
 }
 
 
 export const PageAccessoriesControl = memo((props: Props): JSX.Element => {
 export const PageAccessoriesControl = memo((props: Props): JSX.Element => {
   const {
   const {
-    icon, label, count,
+    icon, label, count, offset,
     className,
     className,
     onClick,
     onClick,
   } = props;
   } = props;
@@ -34,7 +35,7 @@ export const PageAccessoriesControl = memo((props: Props): JSX.Element => {
         {label}
         {label}
         {/* Do not display CountBadge if '/trash/*': https://github.com/weseek/growi/pull/7600 */}
         {/* Do not display CountBadge if '/trash/*': https://github.com/weseek/growi/pull/7600 */}
         { count != null
         { count != null
-          ? <CountBadge count={count} />
+          ? <CountBadge count={count} offset={offset} />
           : <div className="px-2"></div>}
           : <div className="px-2"></div>}
       </span>
       </span>
     </button>
     </button>

+ 1 - 0
apps/app/src/components/PageSideContents/PageSideContents.tsx

@@ -105,6 +105,7 @@ export const PageSideContents = (props: PageSideContentsProps): JSX.Element => {
               label={t('page_list')}
               label={t('page_list')}
               // Do not display CountBadge if '/trash/*': https://github.com/weseek/growi/pull/7600
               // Do not display CountBadge if '/trash/*': https://github.com/weseek/growi/pull/7600
               count={!isTrash && pageInfo != null ? (pageInfo as IPageInfoForOperation).descendantCount : undefined}
               count={!isTrash && pageInfo != null ? (pageInfo as IPageInfoForOperation).descendantCount : undefined}
+              offset={1}
               onClick={() => openDescendantPageListModal(pagePath)}
               onClick={() => openDescendantPageListModal(pagePath)}
             />
             />
           </div>
           </div>