Yuki Takei пре 2 година
родитељ
комит
a1c5bdfc2e

+ 3 - 3
apps/app/src/client/services/layout.ts

@@ -9,14 +9,14 @@ export const useEditorModeClassName = (): string => {
   return `${getClassNamesByEditorMode().join(' ') ?? ''}`;
 };
 
-const useShouldLayoutFluid = (expandContentWidth?: boolean | null): boolean => {
+const useDetermineExpandContent = (expandContentWidth?: boolean | null): boolean => {
   const { data: dataIsContainerFluid } = useIsContainerFluid();
 
   const isContainerFluidDefault = dataIsContainerFluid;
   return expandContentWidth ?? isContainerFluidDefault ?? false;
 };
 
-export const useLayoutFluid = (data?: IPage | boolean | null): boolean => {
+export const useShouldExpandContent = (data?: IPage | boolean | null): boolean => {
   const expandContentWidth = (() => {
     // when data is null
     if (data == null) {
@@ -33,5 +33,5 @@ export const useLayoutFluid = (data?: IPage | boolean | null): boolean => {
     return data.expandContentWidth;
   })();
 
-  return useShouldLayoutFluid(expandContentWidth);
+  return useDetermineExpandContent(expandContentWidth);
 };

+ 3 - 3
apps/app/src/components/Common/PageViewLayout.tsx

@@ -11,16 +11,16 @@ type Props = {
   headerContents?: ReactNode,
   sideContents?: ReactNode,
   footerContents?: ReactNode,
-  isLayoutFluid?: boolean,
+  expandContentWidth?: boolean,
 }
 
 export const PageViewLayout = (props: Props): JSX.Element => {
   const {
     children, headerContents, sideContents, footerContents,
-    isLayoutFluid,
+    expandContentWidth,
   } = props;
 
-  const fluidLayoutClass = isLayoutFluid ? _fluidLayoutClass : '';
+  const fluidLayoutClass = expandContentWidth ? _fluidLayoutClass : '';
 
   return (
     <>

+ 5 - 5
apps/app/src/components/Navbar/GrowiContextualSubNavigation.tsx

@@ -11,11 +11,12 @@ import dynamic from 'next/dynamic';
 import { useRouter } from 'next/router';
 import { DropdownItem } from 'reactstrap';
 
+import { useShouldExpandContent } from '~/client/services/layout';
 import { exportAsMarkdown, updateContentWidth } from '~/client/services/page-operation';
 import type { OnDuplicatedFunction, OnRenamedFunction, OnDeletedFunction } from '~/interfaces/ui';
 import {
   useCurrentPathname,
-  useCurrentUser, useIsGuestUser, useIsReadOnlyUser, useIsSharedUser, useShareLinkId, useIsContainerFluid,
+  useCurrentUser, useIsGuestUser, useIsReadOnlyUser, useIsSharedUser, useShareLinkId,
 } from '~/stores/context';
 import {
   usePageAccessoriesModal, PageAccessoriesModalContents, type IPageForPageDuplicateModal,
@@ -28,7 +29,6 @@ import { mutatePageTree } from '~/stores/page-listing';
 import {
   useEditorMode, useIsAbleToShowPageManagement,
   useIsAbleToChangeEditorMode,
-  useSelectedGrant,
 } from '~/stores/ui';
 
 import { CreateTemplateModal } from '../CreateTemplateModal';
@@ -196,8 +196,8 @@ const GrowiContextualSubNavigation = (props: GrowiContextualSubNavigationProps):
   const { data: isGuestUser } = useIsGuestUser();
   const { data: isReadOnlyUser } = useIsReadOnlyUser();
   const { data: isSharedUser } = useIsSharedUser();
-  const { data: isContainerFluid } = useIsContainerFluid();
-  const { data: grantData } = useSelectedGrant();
+
+  const shouldExpandContent = useShouldExpandContent(currentPage);
 
   const { data: isAbleToShowPageManagement } = useIsAbleToShowPageManagement();
   const { data: isAbleToChangeEditorMode } = useIsAbleToChangeEditorMode();
@@ -309,7 +309,7 @@ const GrowiContextualSubNavigation = (props: GrowiContextualSubNavigationProps):
             revisionId={revisionId}
             shareLinkId={shareLinkId}
             path={path ?? currentPathname} // If the page is empty, "path" is undefined
-            expandContentWidth={currentPage?.expandContentWidth ?? isContainerFluid}
+            expandContentWidth={shouldExpandContent}
             disableSeenUserInfoPopover={isSharedUser}
             showPageControlDropdown={isAbleToShowPageManagement}
             additionalMenuItemRenderer={additionalMenuItemsRenderer}

+ 3 - 3
apps/app/src/components/Page/PageView.tsx

@@ -6,7 +6,7 @@ import type { IPagePopulatedToShowRevision } from '@growi/core';
 import { isUsersHomepage } from '@growi/core/dist/utils/page-path-utils';
 import dynamic from 'next/dynamic';
 
-import { useLayoutFluid } from '~/client/services/layout';
+import { useShouldExpandContent } from '~/client/services/layout';
 import type { RendererConfig } from '~/interfaces/services/renderer';
 import { generateSSRViewOptions } from '~/services/renderer/renderer';
 import {
@@ -71,7 +71,7 @@ export const PageView = (props: Props): JSX.Element => {
   const isNotFound = isNotFoundMeta || page?.revision == null;
   const isUsersHomepagePath = isUsersHomepage(pagePath);
 
-  const isLayoutFluid = useLayoutFluid(page);
+  const shouldExpandContent = useShouldExpandContent(page);
 
 
   // ***************************  Auto Scroll  ***************************
@@ -160,7 +160,7 @@ export const PageView = (props: Props): JSX.Element => {
       headerContents={headerContents}
       sideContents={sideContents}
       footerContents={footerContents}
-      isLayoutFluid={isLayoutFluid}
+      expandContentWidth={shouldExpandContent}
     >
       <PageAlerts />