From b064a90753a0af805d8922ef7a868c6aa3d87ccb Mon Sep 17 00:00:00 2001 From: ari melody Date: Fri, 5 Jul 2024 15:10:25 +0100 Subject: [PATCH] prefer content warnings in notifications --- src/lib/ui/Notification.svelte | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/src/lib/ui/Notification.svelte b/src/lib/ui/Notification.svelte index ecf5b26..12fb622 100644 --- a/src/lib/ui/Notification.svelte +++ b/src/lib/ui/Notification.svelte @@ -57,12 +57,12 @@ goto(`/post/${data.status.id}`); } - let aria_label = function () { - if (accounts.length == 1) + let aria_label = function (data) { + if (data.accounts.length == 1) return activity_text.replace("%1", account.username) + ' ' + new Date(data.created_at); else - return activity_text.replace("%1", `${account.username} and ${accounts.length - 1} others`) + ' ' + new Date(data.created_at); - } + return activity_text.replace("%1", `${account.username} and ${data.accounts.length - 1} others`) + ' ' + new Date(data.created_at); + }(data);
{#if data.status}
- {@html data.status.html} + {#if data.status.warning} +
+ {data.status.warning} +
+ {:else} + {@html data.status.html} + {/if}
{#if data.type === "mention"} {#if data.status.reactions} @@ -247,4 +253,21 @@ margin-right: 4px; border-radius: 4px; } + + .notif-content .warning { + width: 100%; + margin-bottom: 10px; + padding: 4px 8px; + --warn-bg: color-mix(in srgb, var(--bg-700), var(--accent) 1%); + background: repeating-linear-gradient(-45deg, transparent, transparent 10px, var(--warn-bg) 10px, var(--warn-bg) 20px); + font-family: inherit; + font-size: inherit; + color: inherit; + text-align: left; + border: none; + border-radius: 8px; + cursor: pointer; + outline-color: var(--warn-bg); + transition: outline .05s, box-shadow .05s; + }