فهرست منبع

implement useIsEnabledStaleNotification

yohei0125 3 سال پیش
والد
کامیت
3beb933c61

+ 2 - 0
packages/app/src/components/PageAlert/PageAlerts.tsx

@@ -1,4 +1,5 @@
 import {FixPageGrantAlert} from "./FixPageGrantAlert";
+import {PageStaleAlert} from "./PageStaleAlert";
 
 
 export const PageAlerts = (): JSX.Element => {
@@ -9,6 +10,7 @@ export const PageAlerts = (): JSX.Element => {
       <div className="col-sm-12">
         {/* alerts */}
         <FixPageGrantAlert/>
+        <PageStaleAlert/>
       </div>
     </div>
   );

+ 9 - 0
packages/app/src/components/PageAlert/PageStaleAlert.tsx

@@ -0,0 +1,9 @@
+
+import { useIsEnabledStaleNotification } from '../../stores/context'
+
+export const PageStaleAlert = (props):JSX.Element => {
+const { data: isEnabledStaleNotification } = useIsEnabledStaleNotification()
+  return (
+    <>PageStaleAlert</>
+  )
+}

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

@@ -76,7 +76,7 @@ type Props = CommonProps & {
   // isAllReplyShown: boolean,
   // isContainerFluid: boolean,
   // editorConfig: any,
-  // isEnabledStaleNotification: boolean,
+  isEnabledStaleNotification: boolean,
   // isEnabledLinebreaks: boolean,
   // isEnabledLinebreaksInComments: boolean,
   // adminPreferredIndentSize: number,
@@ -106,7 +106,7 @@ const GrowiPage: NextPage<Props> = (props: Props) => {
   // useShareLinkId(props.shareLinkId);
   // useIsAbleToDeleteCompletely(props.isAbleToDeleteCompletely);
   // useIsSharedUser(props.currentUser == null && isSharedPage(props.currentPagePath));
-  // useIsEnabledStaleNotification(props.isEnabledStaleNotification);
+  useIsEnabledStaleNotification(props.isEnabledStaleNotification);
 
   useIsSearchServiceConfigured(props.isSearchServiceConfigured);
   useIsSearchServiceReachable(props.isSearchServiceReachable);
@@ -297,7 +297,7 @@ export const getServerSideProps: GetServerSideProps = async(context: GetServerSi
   // props.highlightJsStyle = configManager.getConfig('crowi', 'customize:highlightJsStyle');
   // props.isAllReplyShown = configManager.getConfig('crowi', 'customize:isAllReplyShown');
   // 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.isEnabledLinebreaksInComments = configManager.getConfig('markdown', 'markdown:isEnabledLinebreaksInComments');
   // props.editorConfig = {

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

@@ -187,6 +187,11 @@ export const useGrowiVersion = (initialData?: string): SWRResponse<string, any>
   return useStaticSWR('growiVersion', initialData);
 };
 
+export const useIsEnabledStaleNotification = (initialData?: boolean): SWRResponse<boolean, any> => {
+  return useStaticSWR('isEnabledStaleNotification', initialData);
+};
+
+
 
 /** **********************************************************
  *                     Computed contexts