2021-05-24 14:54:46 +02:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { GlobalState, Notification as _Notification } from '../../interfaces';
|
|
|
|
|
|
|
|
import classes from './NotificationCenter.module.css';
|
|
|
|
|
|
|
|
import Notification from '../UI/Notification/Notification';
|
|
|
|
|
|
|
|
interface ComponentProps {
|
|
|
|
notifications: _Notification[];
|
|
|
|
}
|
|
|
|
|
|
|
|
const NotificationCenter = (props: ComponentProps): JSX.Element => {
|
|
|
|
return (
|
|
|
|
<div
|
|
|
|
className={classes.NotificationCenter}
|
|
|
|
style={{ height: `${props.notifications.length * 75}px` }}
|
|
|
|
>
|
|
|
|
{props.notifications.map((notification: _Notification) => {
|
|
|
|
return (
|
|
|
|
<Notification
|
|
|
|
title={notification.title}
|
|
|
|
message={notification.message}
|
2021-10-05 16:31:56 +02:00
|
|
|
url={notification.url || null}
|
2021-05-24 14:54:46 +02:00
|
|
|
id={notification.id}
|
|
|
|
key={notification.id}
|
|
|
|
/>
|
2021-10-05 16:31:56 +02:00
|
|
|
);
|
2021-05-24 14:54:46 +02:00
|
|
|
})}
|
|
|
|
</div>
|
2021-10-05 16:31:56 +02:00
|
|
|
);
|
|
|
|
};
|
2021-05-24 14:54:46 +02:00
|
|
|
|
|
|
|
const mapStateToProps = (state: GlobalState) => {
|
|
|
|
return {
|
2021-10-05 16:31:56 +02:00
|
|
|
notifications: state.notification.notifications,
|
|
|
|
};
|
|
|
|
};
|
2021-05-24 14:54:46 +02:00
|
|
|
|
2021-10-05 16:31:56 +02:00
|
|
|
export default connect(mapStateToProps)(NotificationCenter);
|