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!

added 'no integrations' banner & other improvements

Blue Mouse13557cbeeac5
diff --git a/public/locales/en.json b/public/locales/en.json
index 4727c4512..a1985c06c 100644
--- a/public/locales/en.json
+++ b/public/locales/en.json
@@ -416,6 +416,7 @@
"create": "Create an alert",
"add": "Add Alert",
"delete": "Delete alert",
+ "noIntegration": "You have not configured an integration yet. Create one in your <url>account settings</url>.",
"lastTriggered": "Last Triggered",
"never": "Never",
"qDelete": "Delete the alert?",
diff --git a/src/pages/Project/Alerts/Settings/ProjectAlertsSettings.container.jsx b/src/pages/Project/Alerts/Settings/ProjectAlertsSettings.container.jsx
index 533bfdece..67530f7a8 100644
--- a/src/pages/Project/Alerts/Settings/ProjectAlertsSettings.container.jsx
+++ b/src/pages/Project/Alerts/Settings/ProjectAlertsSettings.container.jsx
@@ -6,6 +6,7 @@ import ProjectAlerts from './ProjectAlertsSettings'
const mapStateToProps = (state) => ({
alerts: state.ui.alerts.alerts,
+ user: state.auth.user,
})
const mapDispatchToProps = (dispatch) => ({
diff --git a/src/pages/Project/Alerts/Settings/ProjectAlertsSettings.jsx b/src/pages/Project/Alerts/Settings/ProjectAlertsSettings.jsx
index 7e3a3bdb5..5b99b78b2 100644
--- a/src/pages/Project/Alerts/Settings/ProjectAlertsSettings.jsx
+++ b/src/pages/Project/Alerts/Settings/ProjectAlertsSettings.jsx
@@ -1,7 +1,10 @@
+/* eslint-disable react/forbid-prop-types */
import React, { useEffect, useMemo, useState } from 'react'
import { useHistory, useParams, useLocation } from 'react-router-dom'
-import { useTranslation } from 'react-i18next'
+import { useTranslation, Trans } from 'react-i18next'
import { ExclamationTriangleIcon } from '@heroicons/react/24/outline'
+import { HashLink } from 'react-router-hash-link'
+import PropTypes from 'prop-types'
import _isEmpty from 'lodash/isEmpty'
import _size from 'lodash/size'
@@ -28,7 +31,11 @@ import { withAuthentication, auth } from 'hoc/protected'
import routes from 'routes'
import Select from 'ui/Select'
-const ProjectAlertsSettings = ({ alerts, setProjectAlerts, showError }) => {
+const INTEGRATIONS_LINK = `${routes.user_settings}#integrations`
+
+const ProjectAlertsSettings = ({
+ alerts, setProjectAlerts, showError, user,
+}) => {
const history = useHistory()
const { id, pid } = useParams()
const { pathname } = useLocation()
@@ -48,6 +55,10 @@ const ProjectAlertsSettings = ({ alerts, setProjectAlerts, showError }) => {
const [beenSubmitted, setBeenSubmitted] = useState(false)
const [showModal, setShowModal] = useState(false)
+ const isIntegrationLinked = useMemo(() => {
+ return !_isEmpty(user) && user.telegramChatId && user.isTelegramChatIdConfirmed
+ }, [user])
+
const queryTimeTMapping = useMemo(() => {
const values = _values(QUERY_TIME)
@@ -192,6 +203,18 @@ const ProjectAlertsSettings = ({ alerts, setProjectAlerts, showError }) => {
<h2 className='mt-2 text-3xl font-bold text-gray-900 dark:text-gray-50'>
{title}
</h2>
+ {!isIntegrationLinked && (
+ <div className='flex items-center bg-blue-50 dark:text-gray-50 dark:bg-gray-700 rounded px-5 py-3 mt-2 whitespace-pre-wrap text-base'>
+ <ExclamationTriangleIcon className='w-5 h-5 mr-1' />
+ <Trans
+ t={t}
+ i18nKey='alert.noIntegration'
+ components={{
+ url: <HashLink to={INTEGRATIONS_LINK} className='hover:underline text-blue-600 dark:text-blue-500' />,
+ }}
+ />
+ </div>
+ )}
<Input
name='name'
id='name'
@@ -316,4 +339,11 @@ const ProjectAlertsSettings = ({ alerts, setProjectAlerts, showError }) => {
)
}
+ProjectAlertsSettings.propTypes = {
+ alerts: PropTypes.array.isRequired,
+ setProjectAlerts: PropTypes.func.isRequired,
+ showError: PropTypes.func.isRequired,
+ user: PropTypes.object.isRequired,
+}
+
export default withAuthentication(ProjectAlertsSettings, auth.authenticated)
diff --git a/src/pages/UserSettings/UserSettings.jsx b/src/pages/UserSettings/UserSettings.jsx
index 4dc565062..fc78749fd 100644
--- a/src/pages/UserSettings/UserSettings.jsx
+++ b/src/pages/UserSettings/UserSettings.jsx
@@ -381,7 +381,7 @@ const UserSettings = ({
</Button>
<hr className='mt-5 border-gray-200 dark:border-gray-600' />
- <h3 className='flex items-center mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>
+ <h3 id='integrations' className='flex items-center mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>
{t('profileSettings.integrations')}
<div className='ml-5'>
<Beta />