ソースを参照

Modified the code based off the secnd FB

Shunm634-source 3 年 前
コミット
9e47d4985c

+ 4 - 4
packages/app/src/components/Admin/Notification/GlobalNotification.jsx

@@ -8,6 +8,8 @@ import AdminNotificationContainer from '~/client/services/AdminNotificationConta
 import { toastSuccess, toastError } from '~/client/util/apiNotification';
 import { toastSuccess, toastError } from '~/client/util/apiNotification';
 import loggerFactory from '~/utils/logger';
 import loggerFactory from '~/utils/logger';
 
 
+import { withUnstatedContainers } from '../../UnstatedUtils';
+
 import GlobalNotificationList from './GlobalNotificationList';
 import GlobalNotificationList from './GlobalNotificationList';
 
 
 const logger = loggerFactory('growi:GlobalNotification');
 const logger = loggerFactory('growi:GlobalNotification');
@@ -114,14 +116,12 @@ GlobalNotification.propTypes = {
   adminNotificationContainer: PropTypes.instanceOf(AdminNotificationContainer).isRequired,
   adminNotificationContainer: PropTypes.instanceOf(AdminNotificationContainer).isRequired,
 };
 };
 
 
-export default GlobalNotification;
-
 // const GlobalNotificationWrapperFC = (props) => {
 // const GlobalNotificationWrapperFC = (props) => {
 //   const { t } = useTranslation('admin');
 //   const { t } = useTranslation('admin');
 
 
 //   return <GlobalNotification t={t} {...props} />;
 //   return <GlobalNotification t={t} {...props} />;
 // };
 // };
 
 
-// const GlobalNotificationWrapper = withUnstatedContainers(GlobalNotificationWrapperFC, [AdminNotificationContainer]);
+const GlobalNotificationWrapper = withUnstatedContainers(GlobalNotification, [AdminNotificationContainer]);
 
 
-// export default GlobalNotificationWrapper;
+export default GlobalNotificationWrapper;

+ 2 - 1
packages/app/src/components/Admin/Notification/ManageGlobalNotification.jsx

@@ -7,6 +7,7 @@ import urljoin from 'url-join';
 // import AppContainer from '~/client/services/AppContainer';
 // import AppContainer from '~/client/services/AppContainer';
 // import { toastError } from '~/client/util/apiNotification';
 // import { toastError } from '~/client/util/apiNotification';
 import { apiv3Post, apiv3Put } from '~/client/util/apiv3-client';
 import { apiv3Post, apiv3Put } from '~/client/util/apiv3-client';
+import { useIsMailerSetup } from '~/stores/context';
 import loggerFactory from '~/utils/logger';
 import loggerFactory from '~/utils/logger';
 
 
 
 
@@ -112,7 +113,7 @@ const ManageGlobalNotification = (props) => {
     }
     }
   }, []);
   }, []);
 
 
-  const { isMailerSetup } = props;
+  const { data: isMailerSetup } = useIsMailerSetup();
   const { t } = useTranslation('admin');
   const { t } = useTranslation('admin');
 
 
   return (
   return (

+ 1 - 1
packages/app/src/components/Admin/Notification/NotificationSetting.jsx

@@ -164,7 +164,7 @@ function NotificationSetting(props) {
           {activeComponents.has('user_trigger_notification') && <UserTriggerNotification />}
           {activeComponents.has('user_trigger_notification') && <UserTriggerNotification />}
         </TabPane>
         </TabPane>
         <TabPane tabId="global_notification">
         <TabPane tabId="global_notification">
-          {activeComponents.has('global_notification') && <GlobalNotification adminNotificationContainer={props.adminNotificationContainer} />}
+          {activeComponents.has('global_notification') && <GlobalNotification />}
         </TabPane>
         </TabPane>
       </TabContent>
       </TabContent>
     </div>
     </div>