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!

some more improvements

Blue Mouse9d16b86267e8
diff --git a/src/pages/Project/Alerts/View/ProjectAlertsView.jsx b/src/pages/Project/Alerts/View/ProjectAlertsView.jsx
index 2152c33e8..335a85289 100644
--- a/src/pages/Project/Alerts/View/ProjectAlertsView.jsx
+++ b/src/pages/Project/Alerts/View/ProjectAlertsView.jsx
@@ -9,6 +9,7 @@ import _reduce from 'lodash/reduce'
import { useHistory } from 'react-router-dom'
import { useTranslation } from 'react-i18next'
import PropTypes from 'prop-types'
+import { BellIcon } from '@heroicons/react/24/outline'
import routes from 'routes'
import Button from 'ui/Button'
@@ -38,18 +39,22 @@ const ProjectAlerts = ({
return (
<div>
<div className='flex justify-between items-center'>
- <h2 className='text-2xl font-bold dark:text-white text-gray-800'>Alerts</h2>
- <Button
- className='mt-4'
- type='button'
- primary
- large
- onClick={() => {
- history.push(_replace(routes.create_alert, ':pid', projectId))
- }}
- >
- {t('alert.add')}
- </Button>
+ {!loading && !_isEmpty(alerts) && (
+ <>
+ <h2 className='text-2xl font-bold dark:text-white text-gray-800'>Alerts</h2>
+ <Button
+ className='mt-4'
+ type='button'
+ primary
+ large
+ onClick={() => {
+ history.push(_replace(routes.create_alert, ':pid', projectId))
+ }}
+ >
+ {t('alert.add')}
+ </Button>
+ </>
+ )}
</div>
<div className='mt-4'>
{loading && (
@@ -57,6 +62,32 @@ const ProjectAlerts = ({
{t('common.loading')}
</div>
)}
+ {(!loading && _isEmpty(alerts)) && (
+ <div className='p-5 mt-5 bg-gray-700 rounded-xl'>
+ <div className='flex items-center text-gray-50'>
+ <BellIcon className='w-8 h-8 mr-2' />
+ <p className='font-bold text-3xl'>
+ {t('dashboard.alerts')}
+ </p>
+ </div>
+ <p className='text-lg whitespace-pre-wrap mt-2 text-gray-100'>
+ {t('dashboard.alertsDesc')}
+ </p>
+ {/* <Link to={routes.signup} className='inline-block select-none mt-6 bg-white py-2 px-3 md:px-4 border border-transparent rounded-md text-base font-medium text-gray-700 hover:bg-indigo-50'>
+ {t('common.getStarted')}
+ </Link> */}
+ <Button
+ onClick={() => {
+ history.push(_replace(routes.create_alert, ':pid', projectId))
+ }}
+ className='mt-6 bg-white py-2 px-3 md:px-4 border border-transparent rounded-md text-base font-medium text-gray-700 hover:bg-indigo-50'
+ secondary
+ large
+ >
+ {t('alert.add')}
+ </Button>
+ </div>
+ )}
{(!loading && !_isEmpty(alerts)) && (
<div className='flex flex-col'>
{_map(alerts, ({
diff --git a/src/pages/Project/View/ViewProject.jsx b/src/pages/Project/View/ViewProject.jsx
index 1bf28d238..73fa18d75 100644
--- a/src/pages/Project/View/ViewProject.jsx
+++ b/src/pages/Project/View/ViewProject.jsx
@@ -1391,7 +1391,7 @@ const ViewProject = ({
{(isPanelsDataEmpty && activeTab !== PROJECT_TABS.alerts) && (
<NoEvents filters={filters} resetFilters={resetFilters} pid={id} />
)}
- {activeTab === 'traffic' && (
+ {activeTab === PROJECT_TABS.traffic && (
<div className={cx('pt-4 md:pt-0', { hidden: isPanelsDataEmpty || analyticsLoading })}>
<div
className={cx('h-80', {