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!

redesigned notifications & added mobile phones support

Blue Mouse111a7b7b3c95
diff --git a/app/ui/Alert.tsx b/app/ui/Alert.tsx
index 2149ca73e..af4780e5a 100644
--- a/app/ui/Alert.tsx
+++ b/app/ui/Alert.tsx
@@ -1,12 +1,11 @@
// Custom Alert template for react-alert
import React, { memo } from 'react'
-import cx from 'clsx'
+import { useTranslation } from 'react-i18next'
import PropTypes from 'prop-types'
import {
CheckCircleIcon, InformationCircleIcon, XCircleIcon, XMarkIcon,
} from '@heroicons/react/24/solid'
-// Define the prop types for the component
interface IAlert {
/* (string): The message to be displayed in the alert. */
message: string,
@@ -14,56 +13,53 @@ interface IAlert {
options: {
type: 'info' | 'success' | 'error',
},
- // (string): Additional CSS classes to be applied to the alert container.
- className: string,
// (function): A callback function to be called when the alert is closed.
close: () => void,
}
// AlertTemplate component
const AlertTemplate = ({
- message, options, className, close,
+ message, options, close,
}: IAlert): JSX.Element => {
- // Determine the type of the alert
+ const { t } = useTranslation('common')
const { type } = options
const isInfo = type === 'info'
const isSuccess = type === 'success'
const isError = type === 'error'
return (
- <div
- className={cx('flex justify-between items-center mb-5 mr-2 rounded-md p-4 z-50 shadow-sm w-96 pointer-events-auto', {
- 'bg-green-50': isSuccess,
- 'bg-blue-50': isInfo,
- 'bg-red-50': isError,
- }, className)}
- >
- <div className='flex-shrink-0'>
- {isInfo && <InformationCircleIcon className='h-5 w-5 mr-2 text-blue-400' />}
- {isSuccess && <CheckCircleIcon className='h-5 w-5 mr-2 text-green-400' />}
- {isError && <XCircleIcon className='h-6 w-6 mr-2 text-red-400' />}
+ <div className='pointer-events-auto w-72 min-[425px]:w-96 mb-5 mr-2 min-[425px]:mr-5 z-50 overflow-hidden rounded-lg bg-white dark:bg-slate-900 shadow-lg ring-1 ring-black dark:ring-slate-800 ring-opacity-5'>
+ <div className='p-4'>
+ <div className='flex items-start'>
+ <div className='flex-shrink-0'>
+ {isInfo && <InformationCircleIcon className='h-6 w-6 text-blue-400' aria-hidden='true' />}
+ {isSuccess && <CheckCircleIcon className='h-6 w-6 text-green-400' aria-hidden='true' />}
+ {isError && <XCircleIcon className='h-6 w-6 text-red-400' aria-hidden='true' />}
+ </div>
+ <div className='ml-3 w-0 flex-1 pt-0.5'>
+ <p className='text-sm font-medium text-gray-900 dark:text-gray-50'>
+ {isInfo && t('common.info')}
+ {isSuccess && t('common.success')}
+ {isError && t('common.error')}
+ </p>
+ <p className='mt-1 text-sm text-gray-500 dark:text-gray-300'>
+ {message}
+ </p>
+ </div>
+ <div className='ml-4 flex flex-shrink-0'>
+ <button
+ type='button'
+ className='inline-flex rounded-md bg-white dark:bg-slate-900 text-gray-400 hover:text-gray-500 dark:text-gray-200 dark:hover:text-gray-400 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2'
+ onClick={close}
+ >
+ <span className='sr-only'>
+ {t('common.close')}
+ </span>
+ <XMarkIcon className='h-5 w-5' aria-hidden='true' />
+ </button>
+ </div>
+ </div>
</div>
- <span
- className={cx('text-sm font-medium uppercase', {
- 'text-green-800': isSuccess,
- 'text-blue-700': isInfo,
- 'text-red-800': isError,
- })}
- >
- {message}
- </span>
- <button
- onClick={close}
- type='button'
- className={cx('inline-flex cursor-pointer rounded-md p-1.5 focus:outline-none focus:ring-2 focus:ring-offset-2', {
- 'bg-green-50 text-green-500 hover:bg-green-100 focus:ring-offset-green-50 focus:ring-green-600': isSuccess,
- 'bg-blue-50 text-blue-500 hover:bg-blue-100 focus:ring-offset-blue-50 focus:ring-blue-600': isInfo,
- 'bg-red-50 text-red-500 hover:bg-red-100 focus:ring-offset-red-50 focus:ring-red-600': isError,
- })}
- >
- <span className='sr-only'>Dismiss</span>
- <XMarkIcon className='h-5 w-5' />
- </button>
</div>
)
}
diff --git a/public/locales/en.json b/public/locales/en.json
index d511aeea0..9881f980a 100644
--- a/public/locales/en.json
+++ b/public/locales/en.json
@@ -57,6 +57,8 @@
"confirm": "Confirm",
"amount": "Amount",
"date": "Date",
+ "success": "Success",
+ "info": "Info",
"error": "Error",
"close": "Close",
"cancel": "Cancel",