import Container from "@mui/material/Container";
import {CardContent, CardHeader, Stack} from "@mui/material";
import Card from "@mui/material/Card";
import Typography from "@mui/material/Typography";
import * as React from "react";
import {formatTitle, formatMessage, unmatchedTags} from "../app/utils";
import IconButton from "@mui/material/IconButton";
import CloseIcon from '@mui/icons-material/Close';
const NotificationList = (props) => {
const subscription = props.subscription;
const sortedNotifications = subscription.getNotifications()
.sort((a, b) => a.time < b.time);
return (
{sortedNotifications.map(notification =>
props.onDeleteNotification(subscription.id, notificationId)}
/>)}
);
}
const NotificationItem = (props) => {
const notification = props.notification;
const date = new Intl.DateTimeFormat('default', {dateStyle: 'short', timeStyle: 'short'})
.format(new Date(notification.time * 1000));
const otherTags = unmatchedTags(notification.tags);
const tags = (otherTags.length > 0) ? otherTags.join(', ') : null;
return (
props.onDelete(notification.id)} sx={{ float: 'right', marginRight: -1, marginTop: -1 }}>
{date}
{[1,2,4,5].includes(notification.priority) &&
}
{notification.title && {formatTitle(notification)}}
{formatMessage(notification)}
{tags && Tags: {tags}}
);
}
export default NotificationList;