From 72b0931554d539410100ddd7377f732f93ce3991 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Sun, 18 Dec 2022 01:04:26 +0800 Subject: [PATCH] Super lazy way to implement "only mentions" in Notifications #OnlyMentions Could have make another tab that makes another request to /notifications but I feel lazy --- src/index.css | 4 ++++ src/pages/notifications.css | 32 ++++++++++++++++++++++++++++++-- src/pages/notifications.jsx | 27 ++++++++++++++++++++++++++- 3 files changed, 60 insertions(+), 3 deletions(-) diff --git a/src/index.css b/src/index.css index 061c9f6..5fec383 100644 --- a/src/index.css +++ b/src/index.css @@ -218,6 +218,10 @@ code { flex-grow: 1; } +.insignificant { + color: var(--text-insignificant-color); +} + /* KEYFRAMES */ @keyframes fade-in { diff --git a/src/pages/notifications.css b/src/pages/notifications.css index e91adcd..9b2c417 100644 --- a/src/pages/notifications.css +++ b/src/pages/notifications.css @@ -3,6 +3,10 @@ padding: 16px !important; gap: 16px; } +.only-mentions .notification:not(.mention), +.only-mentions .timeline-empty { + display: none; +} .notification.skeleton { color: var(--outline-color); } @@ -30,7 +34,11 @@ max-height: 160px; overflow: hidden; /* fade out mask gradient bottom */ - mask-image: linear-gradient(rgba(0, 0, 0, 1), rgba(0, 0, 0, 1) 50%, transparent); + mask-image: linear-gradient( + rgba(0, 0, 0, 1), + rgba(0, 0, 0, 1) 50%, + transparent + ); filter: saturate(0.25); } .notification .status-link:hover { @@ -46,4 +54,24 @@ } .notification-content p:first-child { margin-top: 0; -} \ No newline at end of file +} + +#mentions-option { + float: right; + margin-top: 0.5em; +} +#mentions-option label { + color: var(--text-insignificant-color); + display: inline-block; + padding: 1em 16px; + position: relative; + cursor: pointer; + z-index: 1; + font-size: 90%; + background-color: var(--bg-blur-color); + border-radius: 2em; +} +#mentions-option label:has(:checked) { + color: var(--text-color); + background-color: var(--bg-color); +} diff --git a/src/pages/notifications.jsx b/src/pages/notifications.jsx index b82cf2c..6796aab 100644 --- a/src/pages/notifications.jsx +++ b/src/pages/notifications.jsx @@ -97,6 +97,18 @@ function Notification({ notification }) { )} {text} + {type === 'mention' && ( + + {' '} + •{' '} + + + )}

{_accounts?.length > 1 && (

@@ -192,6 +204,7 @@ function Notifications() { const snapStates = useSnapshot(states); const [uiState, setUIState] = useState('default'); const [showMore, setShowMore] = useState(false); + const [onlyMentions, setOnlyMentions] = useState(false); const notificationsIterator = useRef( masto.notifications.getIterator({ @@ -273,7 +286,7 @@ function Notifications() { // console.log(groupedNotifications); return (

-