openreplay/frontend/app/components/Alerts/Notifications/Notifications.tsx
Andrey Babushkin fd5c0c9747
Add lokalisation (#3092)
* applied eslint

* add locales and lint the project

* removed error boundary

* updated locales

* fix min files

* fix locales
2025-03-06 17:43:15 +01:00

43 lines
1.2 KiB
TypeScript

import React, { useEffect } from 'react';
import { Icon } from 'UI';
import { useModal } from 'App/components/Modal';
import AlertTriggersModal from 'Shared/AlertTriggersModal';
import { useStore } from 'App/mstore';
import { observer } from 'mobx-react-lite';
import { Badge, Button, Tooltip } from 'antd';
import { BellOutlined } from '@ant-design/icons';
const AUTOREFRESH_INTERVAL = 5 * 60 * 1000;
function Notifications() {
const { showModal } = useModal();
const { notificationStore } = useStore();
const count = notificationStore.notificationsCount;
useEffect(() => {
const interval = setInterval(() => {
try {
void notificationStore.fetchNotificationsCount();
} catch (e) {
console.error(e);
}
}, AUTOREFRESH_INTERVAL);
return () => clearInterval(interval);
}, []);
return (
<Badge dot={count > 0} size="small">
<Tooltip title="Alerts">
<Button
icon={<BellOutlined />}
onClick={() => showModal(<AlertTriggersModal />, { right: true })}
>
{/* <Icon name='bell' size='18' color='gray-dark' /> */}
</Button>
</Tooltip>
</Badge>
);
}
export default observer(Notifications);