From ae3258d7cbedb3a79a596c18c4510318bb6f2915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C5=ABdolfs=20O=C5=A1i=C5=86=C5=A1?= Date: Tue, 8 Apr 2025 16:10:41 +0200 Subject: [PATCH] Add confirmations to Clear all notifications buttons --- src/components/ConfirmClear.svelte | 43 ++++++++++++++++++++++++ src/components/NotificationTeaser.svelte | 39 ++++++++++----------- src/components/RepoNotifications.svelte | 11 ++++-- src/views/home/Inbox.svelte | 11 +++--- 4 files changed, 77 insertions(+), 27 deletions(-) create mode 100644 src/components/ConfirmClear.svelte diff --git a/src/components/ConfirmClear.svelte b/src/components/ConfirmClear.svelte new file mode 100644 index 000000000..a5ca25045 --- /dev/null +++ b/src/components/ConfirmClear.svelte @@ -0,0 +1,43 @@ + + + + {#snippet toggle(onclick)} + + + + {/snippet} + + {#snippet popover()} + +
+
+ Clear all {subject} notifications? +
+
+ + Cancel + + +
+
+
+ {/snippet} +
diff --git a/src/components/NotificationTeaser.svelte b/src/components/NotificationTeaser.svelte index effb1974b..ca3df7026 100644 --- a/src/components/NotificationTeaser.svelte +++ b/src/components/NotificationTeaser.svelte @@ -20,6 +20,7 @@ import Icon from "./Icon.svelte"; import InlineTitle from "./InlineTitle.svelte"; + import NakedButton from "./NakedButton.svelte"; import NodeId from "./NodeId.svelte"; interface Props { @@ -142,6 +143,12 @@ font-size: var(--font-size-regular); word-break: break-word; } + .clear-icon { + display: none; + } + .notification-teaser:hover .clear-icon { + display: flex; + } .selected { background-color: var(--color-fill-float-hover); } @@ -152,13 +159,6 @@ padding: 0; margin-right: 1rem; } - .icon { - width: 2rem; - height: 2rem; - display: flex; - justify-content: center; - align-items: center; - } .notification-teaser:first-of-type { clip-path: var(--3px-top-corner-fill); } @@ -210,18 +210,19 @@ -
-
- { - e.stopPropagation(); - void clearByIds( - rid, - notificationItems.map(n => n.rowId), - ); - }} - name={clearIcon} /> -
+
+ { + e.stopPropagation(); + void clearByIds( + rid, + notificationItems.map(n => n.rowId), + ); + }}> + +
diff --git a/src/components/RepoNotifications.svelte b/src/components/RepoNotifications.svelte index 18e20b058..905c80976 100644 --- a/src/components/RepoNotifications.svelte +++ b/src/components/RepoNotifications.svelte @@ -3,9 +3,10 @@ import type { NotificationItem } from "@bindings/cob/inbox/NotificationItem"; import * as router from "@app/lib/router"; + import Button from "./Button.svelte"; + import ConfirmClear from "./ConfirmClear.svelte"; import NotificationTeaser from "./NotificationTeaser.svelte"; - import Icon from "./Icon.svelte"; interface Props { all?: boolean; @@ -31,7 +32,7 @@ display: flex; justify-content: space-between; align-items: center; - padding-right: 1.5rem; + padding-right: 1rem; } .container { display: flex; @@ -48,7 +49,11 @@ {repo.count} - clearByRepo(repo.rid)} name="broom-double" /> + { + void clearByRepo(repo.rid); + }} /> {/if} diff --git a/src/views/home/Inbox.svelte b/src/views/home/Inbox.svelte index f3d8a896d..1af0d32cb 100644 --- a/src/views/home/Inbox.svelte +++ b/src/views/home/Inbox.svelte @@ -1,21 +1,22 @@