Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

add no notif message

Blue Mouse05bbf8253eb2
diff --git a/public/locales/en.json b/public/locales/en.json
index a1985c06c..473c844e6 100644
--- a/public/locales/en.json
+++ b/public/locales/en.json
@@ -417,6 +417,7 @@
"add": "Add Alert",
"delete": "Delete alert",
"noIntegration": "You have not configured an integration yet. Create one in your <url>account settings</url>.",
+ "noNotification": "No notification channels set",
"lastTriggered": "Last Triggered",
"never": "Never",
"qDelete": "Delete the alert?",
diff --git a/src/pages/Project/Alerts/View/ProjectAlertsView.container.jsx b/src/pages/Project/Alerts/View/ProjectAlertsView.container.jsx
index 10b7cc556..646913f49 100644
--- a/src/pages/Project/Alerts/View/ProjectAlertsView.container.jsx
+++ b/src/pages/Project/Alerts/View/ProjectAlertsView.container.jsx
@@ -1,19 +1,11 @@
import { connect } from 'react-redux'
-import { errorsActions } from 'redux/actions/errors'
import ProjectAlerts from './ProjectAlertsView'
const mapStateToProps = (state) => ({
alerts: state.ui.alerts.alerts,
- totalPage: state.ui.alerts.totalPage,
- total: state.ui.alerts.total,
loading: state.ui.alerts.loading,
+ user: state.auth.user,
})
-const mapDispatchToProps = (dispatch) => ({
- showError: (message) => {
- dispatch(errorsActions.genericError(message))
- },
-})
-
-export default connect(mapStateToProps, mapDispatchToProps)(ProjectAlerts)
+export default connect(mapStateToProps)(ProjectAlerts)
diff --git a/src/pages/Project/Alerts/View/ProjectAlertsView.jsx b/src/pages/Project/Alerts/View/ProjectAlertsView.jsx
index 7b389dde4..2152c33e8 100644
--- a/src/pages/Project/Alerts/View/ProjectAlertsView.jsx
+++ b/src/pages/Project/Alerts/View/ProjectAlertsView.jsx
@@ -1,19 +1,21 @@
-import React, { useMemo } from 'react'
+/* eslint-disable react/forbid-prop-types */
+import React, { useMemo, memo } from 'react'
import dayjs from 'dayjs'
import _map from 'lodash/map'
import _isEmpty from 'lodash/isEmpty'
import _replace from 'lodash/replace'
import _values from 'lodash/values'
import _reduce from 'lodash/reduce'
-import routes from 'routes'
import { useHistory } from 'react-router-dom'
import { useTranslation } from 'react-i18next'
+import PropTypes from 'prop-types'
+import routes from 'routes'
import Button from 'ui/Button'
import { QUERY_METRIC } from 'redux/constants'
const ProjectAlerts = ({
- projectId, alerts, loading,
+ projectId, alerts, loading, user,
}) => {
const { t, i18n: { language } } = useTranslation()
const history = useHistory()
@@ -27,6 +29,12 @@ const ProjectAlerts = ({
}), {})
}, [t])
+ const isIntegrationLinked = useMemo(() => {
+ return !_isEmpty(user) && user.telegramChatId && user.isTelegramChatIdConfirmed
+ }, [user])
+
+ console.log(isIntegrationLinked)
+
return (
<div>
<div className='flex justify-between items-center'>
@@ -72,16 +80,23 @@ const ProjectAlerts = ({
: t('alert.never')}
</div>
</div>
- <Button
- onClick={() => {
- history.push(_replace(_replace(routes.alert_settings, ':pid', projectId), ':id', id))
- }}
- className='dark:text-gray-50 dark:bg-gray-700 dark:hover:bg-gray-600'
- secondary
- large
- >
- {t('common.edit')}
- </Button>
+ <div className='flex items-center'>
+ {!isIntegrationLinked && (
+ <p className='text-gray-800 dark:text-gray-200 text-sm mr-3'>
+ {t('alert.noNotification')}
+ </p>
+ )}
+ <Button
+ onClick={() => {
+ history.push(_replace(_replace(routes.alert_settings, ':pid', projectId), ':id', id))
+ }}
+ className='dark:text-gray-50 dark:bg-gray-700 dark:hover:bg-gray-600'
+ secondary
+ large
+ >
+ {t('common.edit')}
+ </Button>
+ </div>
</div>
</div>
))}
@@ -92,4 +107,11 @@ const ProjectAlerts = ({
)
}
-export default ProjectAlerts
+ProjectAlerts.propTypes = {
+ projectId: PropTypes.string.isRequired,
+ alerts: PropTypes.array.isRequired,
+ loading: PropTypes.bool.isRequired,
+ user: PropTypes.object.isRequired,
+}
+
+export default memo(ProjectAlerts)