mirror of
https://github.com/binwiederhier/ntfy.git
synced 2025-06-08 14:04:41 +02:00
Add "mark as read" button
This commit is contained in:
parent
344da326cd
commit
15ac5ed23b
5 changed files with 13 additions and 10 deletions
web/src
|
@ -117,7 +117,7 @@ class SubscriptionManager {
|
|||
|
||||
async markNotificationRead(notificationId) {
|
||||
await db.notifications
|
||||
.where({id: notificationId, new: 1})
|
||||
.where({id: notificationId})
|
||||
.modify({new: 0});
|
||||
}
|
||||
|
||||
|
|
|
@ -8,9 +8,9 @@ import Dexie from 'dexie';
|
|||
|
||||
const db = new Dexie('ntfy');
|
||||
|
||||
db.version(2).stores({
|
||||
db.version(1).stores({
|
||||
subscriptions: '&id,baseUrl',
|
||||
notifications: '&id,subscriptionId,time,new,[subscriptionId+new],[id+new]', // compound keys for query performance
|
||||
notifications: '&id,subscriptionId,time,new,[subscriptionId+new]', // compound key for query performance
|
||||
users: '&baseUrl,username',
|
||||
prefs: '&key'
|
||||
});
|
||||
|
|
|
@ -99,7 +99,7 @@ const NotificationList = (props) => {
|
|||
>
|
||||
<Container
|
||||
maxWidth="md"
|
||||
role="list"
|
||||
role="list"
|
||||
aria-label={t("notifications_list")}
|
||||
sx={{
|
||||
marginTop: 3,
|
||||
|
@ -152,12 +152,14 @@ const NotificationItem = (props) => {
|
|||
return (
|
||||
<Card sx={{ minWidth: 275, padding: 1 }} role="listitem" aria-label={t("notifications_list_item")}>
|
||||
<CardContent>
|
||||
<IconButton onClick={handleDelete} sx={{ float: 'right', marginRight: -1, marginTop: -1 }} aria-label={t("notifications_delete")}>
|
||||
<CloseIcon />
|
||||
</IconButton>
|
||||
<Tooltip title={t("notifications_delete")} enterDelay={500}>
|
||||
<IconButton onClick={handleDelete} sx={{ float: 'right', marginRight: -1, marginTop: -1 }} aria-label={t("notifications_delete")}>
|
||||
<CloseIcon />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
{notification.new === 1 &&
|
||||
<Tooltip title={t("notifications_mark_read")}>
|
||||
<IconButton onClick={handleMarkRead} sx={{ float: 'right', marginRight: -1, marginTop: -1 }} aria-label={t("notifications_mark_read")}>
|
||||
<Tooltip title={t("notifications_mark_read")} enterDelay={500}>
|
||||
<IconButton onClick={handleMarkRead} sx={{ float: 'right', marginRight: -0.5, marginTop: -1 }} aria-label={t("notifications_mark_read")}>
|
||||
<CheckIcon />
|
||||
</IconButton>
|
||||
</Tooltip>}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue