import { React, useCallback } from 'react'; import { useTranslation } from 'next-i18next'; import { useRouter } from 'next/router'; import PropTypes from 'prop-types'; import AdminNotificationContainer from '~/client/services/AdminNotificationContainer'; import { toastSuccess, toastError } from '~/client/util/toastr'; import loggerFactory from '~/utils/logger'; import { withUnstatedContainers } from '../../UnstatedUtils'; import GlobalNotificationList from './GlobalNotificationList'; const logger = loggerFactory('growi:GlobalNotification'); const GlobalNotification = (props) => { const { adminNotificationContainer } = props; const { t } = useTranslation('admin'); const onClickSubmit = useCallback(async() => { try { await adminNotificationContainer.updateGlobalNotificationForPages(); toastSuccess(t('toaster.update_successed', { target: t('external_notification.external_notification'), ns: 'commons' })); } catch (err) { toastError(err); logger.error(err); } }, [adminNotificationContainer, t]); const router = useRouter(); const { globalNotifications } = adminNotificationContainer.state; return ( <>
{/* eslint-disable-next-line react/no-danger */}
{t('notification_setting.add_notification')}
*/}| ON/OFF | {/* eslint-disable-next-line react/no-danger */}{t('notification_settings.trigger_path')} | {t('notification_settings.trigger_events')} | {t('notification_settings.notify_to')} |
|---|