Browse Source

fix lint errors

jam411 3 years ago
parent
commit
02b99f5c44

+ 1 - 1
packages/app/src/components/PageComment.tsx

@@ -17,7 +17,7 @@ import { useSWRxPageComment } from '../stores/comment';
 import Comment from './PageComment/Comment';
 import Comment from './PageComment/Comment';
 import CommentEditor from './PageComment/CommentEditor';
 import CommentEditor from './PageComment/CommentEditor';
 import DeleteCommentModal from './PageComment/DeleteCommentModal';
 import DeleteCommentModal from './PageComment/DeleteCommentModal';
-import ReplayComments from './PageComment/ReplayComments';
+import { ReplayComments } from './PageComment/ReplayComments';
 
 
 type Props = {
 type Props = {
   appContainer: AppContainer,
   appContainer: AppContainer,

+ 3 - 8
packages/app/src/components/PageComment/ReplayComments.tsx

@@ -6,9 +6,9 @@ import { Collapse } from 'reactstrap';
 import { RendererOptions } from '~/services/renderer/renderer';
 import { RendererOptions } from '~/services/renderer/renderer';
 
 
 import { ICommentHasId, ICommentHasIdList } from '../../interfaces/comment';
 import { ICommentHasId, ICommentHasIdList } from '../../interfaces/comment';
-import { useRendererConfig } from '../../stores/context';
+import { useRendererConfig, useIsAllReplyShown } from '../../stores/context';
 
 
-import { Comment } from './Comment';
+import Comment from './Comment';
 
 
 type ReplaycommentsProps = {
 type ReplaycommentsProps = {
   deleteBtnClicked: (comment: ICommentHasId) => void,
   deleteBtnClicked: (comment: ICommentHasId) => void,
@@ -23,6 +23,7 @@ export const ReplayComments = (props: ReplaycommentsProps): JSX.Element => {
     deleteBtnClicked, rendererOptions, isReadOnly, replyList, onComment,
     deleteBtnClicked, rendererOptions, isReadOnly, replyList, onComment,
   } = props;
   } = props;
   const { data: rendererConfig } = useRendererConfig();
   const { data: rendererConfig } = useRendererConfig();
+  const { data: isAllReplyShown } = useIsAllReplyShown();
 
 
   const [isOlderRepliesShown, setIsOlderRepliesShown] = useState(false);
   const [isOlderRepliesShown, setIsOlderRepliesShown] = useState(false);
 
 
@@ -41,12 +42,6 @@ export const ReplayComments = (props: ReplaycommentsProps): JSX.Element => {
     );
     );
   };
   };
 
 
-  // TODO: Remove isAllReplyShown from rendererconfig
-  if (rendererConfig === undefined) {
-    return <></>;
-  }
-  const isAllReplyShown = rendererConfig.isAllReplyShown || false;
-
   if (isAllReplyShown) {
   if (isAllReplyShown) {
     return (
     return (
       <>
       <>

+ 1 - 1
packages/app/src/components/SearchPage/SearchResultContent.tsx

@@ -25,7 +25,7 @@ import { GrowiSubNavigation } from '../Navbar/GrowiSubNavigation';
 import { SubNavButtons } from '../Navbar/SubNavButtons';
 import { SubNavButtons } from '../Navbar/SubNavButtons';
 import RevisionLoader from '../Page/RevisionLoader';
 import RevisionLoader from '../Page/RevisionLoader';
 import PageComment from '../PageComment';
 import PageComment from '../PageComment';
-import PageContentFooter from '../PageContentFooter';
+import { PageContentFooter } from '../PageContentFooter';
 
 
 
 
 type AdditionalMenuItemsProps = AdditionalMenuItemsRendererProps & {
 type AdditionalMenuItemsProps = AdditionalMenuItemsRendererProps & {

+ 0 - 1
packages/app/src/interfaces/services/renderer.ts

@@ -14,7 +14,6 @@ export type RendererConfig = {
   adminPreferredIndentSize: number,
   adminPreferredIndentSize: number,
   isIndentSizeForced: boolean,
   isIndentSizeForced: boolean,
   highlightJsStyleBorder: boolean,
   highlightJsStyleBorder: boolean,
-  isAllReplyShown: boolean,
 
 
   plantumlUri: string | null,
   plantumlUri: string | null,
   blockdiagUri: string | null,
   blockdiagUri: string | null,

+ 4 - 4
packages/app/src/pages/[[...path]].page.tsx

@@ -64,6 +64,7 @@ import {
   useIsAclEnabled, useIsUserPage, useIsNotCreatable,
   useIsAclEnabled, useIsUserPage, useIsNotCreatable,
   useCsrfToken, useIsSearchScopeChildrenAsDefault, useCurrentPageId, useCurrentPathname,
   useCsrfToken, useIsSearchScopeChildrenAsDefault, useCurrentPageId, useCurrentPathname,
   useIsSlackConfigured, useIsBlinkedHeaderAtBoot, useRendererConfig, useEditingMarkdown,
   useIsSlackConfigured, useIsBlinkedHeaderAtBoot, useRendererConfig, useEditingMarkdown,
+  useIsAllReplyShown,
 } from '../stores/context';
 } from '../stores/context';
 import { useXss } from '../stores/xss';
 import { useXss } from '../stores/xss';
 
 
@@ -148,7 +149,7 @@ type Props = CommonProps & {
   // mathJax: string,
   // mathJax: string,
   // noCdn: string,
   // noCdn: string,
   // highlightJsStyle: string,
   // highlightJsStyle: string,
-  // isAllReplyShown: boolean,
+  isAllReplyShown: boolean,
   // isContainerFluid: boolean,
   // isContainerFluid: boolean,
   // editorConfig: any,
   // editorConfig: any,
   isEnabledStaleNotification: boolean,
   isEnabledStaleNotification: boolean,
@@ -226,7 +227,7 @@ const GrowiPage: NextPage<Props> = (props: Props) => {
   useRendererConfig(props.rendererConfig);
   useRendererConfig(props.rendererConfig);
   // useRendererSettings(props.rendererSettingsStr != null ? JSON.parse(props.rendererSettingsStr) : undefined);
   // useRendererSettings(props.rendererSettingsStr != null ? JSON.parse(props.rendererSettingsStr) : undefined);
   // useGrowiRendererConfig(props.growiRendererConfigStr != null ? JSON.parse(props.growiRendererConfigStr) : undefined);
   // useGrowiRendererConfig(props.growiRendererConfigStr != null ? JSON.parse(props.growiRendererConfigStr) : undefined);
-
+  useIsAllReplyShown(props.isAllReplyShown);
 
 
   // const { data: editorMode } = useEditorMode();
   // const { data: editorMode } = useEditorMode();
 
 
@@ -480,7 +481,7 @@ function injectServerConfigurations(context: GetServerSidePropsContext, props: P
   // props.mathJax = configManager.getConfig('crowi', 'app:mathJax');
   // props.mathJax = configManager.getConfig('crowi', 'app:mathJax');
   // props.noCdn = configManager.getConfig('crowi', 'app:noCdn');
   // props.noCdn = configManager.getConfig('crowi', 'app:noCdn');
   // props.highlightJsStyle = configManager.getConfig('crowi', 'customize:highlightJsStyle');
   // props.highlightJsStyle = configManager.getConfig('crowi', 'customize:highlightJsStyle');
-  // props.isAllReplyShown = configManager.getConfig('crowi', 'customize:isAllReplyShown');
+  props.isAllReplyShown = configManager.getConfig('crowi', 'customize:isAllReplyShown');
   // props.isContainerFluid = configManager.getConfig('crowi', 'customize:isContainerFluid');
   // props.isContainerFluid = configManager.getConfig('crowi', 'customize:isContainerFluid');
   props.isEnabledStaleNotification = configManager.getConfig('crowi', 'customize:isEnabledStaleNotification');
   props.isEnabledStaleNotification = configManager.getConfig('crowi', 'customize:isEnabledStaleNotification');
   // props.isEnabledLinebreaks = configManager.getConfig('markdown', 'markdown:isEnabledLinebreaks');
   // props.isEnabledLinebreaks = configManager.getConfig('markdown', 'markdown:isEnabledLinebreaks');
@@ -500,7 +501,6 @@ function injectServerConfigurations(context: GetServerSidePropsContext, props: P
     isEnabledLinebreaksInComments: configManager.getConfig('markdown', 'markdown:isEnabledLinebreaksInComments'),
     isEnabledLinebreaksInComments: configManager.getConfig('markdown', 'markdown:isEnabledLinebreaksInComments'),
     adminPreferredIndentSize: configManager.getConfig('markdown', 'markdown:adminPreferredIndentSize'),
     adminPreferredIndentSize: configManager.getConfig('markdown', 'markdown:adminPreferredIndentSize'),
     isIndentSizeForced: configManager.getConfig('markdown', 'markdown:isIndentSizeForced'),
     isIndentSizeForced: configManager.getConfig('markdown', 'markdown:isIndentSizeForced'),
-    isAllReplyShown: configManager.getConfig('crowi', 'customize:isAllReplyShown'),
 
 
     plantumlUri: process.env.PLANTUML_URI ?? null,
     plantumlUri: process.env.PLANTUML_URI ?? null,
     blockdiagUri: process.env.BLOCKDIAG_URI ?? null,
     blockdiagUri: process.env.BLOCKDIAG_URI ?? null,

+ 4 - 0
packages/app/src/stores/context.tsx

@@ -228,6 +228,10 @@ export const useRendererConfig = (initialData?: RendererConfig): SWRResponse<Ren
   return useStaticSWR('growiRendererConfig', initialData);
   return useStaticSWR('growiRendererConfig', initialData);
 };
 };
 
 
+export const useIsAllReplyShown = (initialData?: boolean): SWRResponse<boolean, any> => {
+  return useStaticSWR('isAllReplyShown', initialData);
+};
+
 export const useCurrentPageTocNode = (): SWRResponse<HtmlElementNode, any> => {
 export const useCurrentPageTocNode = (): SWRResponse<HtmlElementNode, any> => {
   return useStaticSWR('currentPageTocNode');
   return useStaticSWR('currentPageTocNode');
 };
 };