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
This commit is contained in:
parent
4b49c6fb03
commit
72b0931554
3 changed files with 60 additions and 3 deletions
|
@ -218,6 +218,10 @@ code {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.insignificant {
|
||||||
|
color: var(--text-insignificant-color);
|
||||||
|
}
|
||||||
|
|
||||||
/* KEYFRAMES */
|
/* KEYFRAMES */
|
||||||
|
|
||||||
@keyframes fade-in {
|
@keyframes fade-in {
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
padding: 16px !important;
|
padding: 16px !important;
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
}
|
}
|
||||||
|
.only-mentions .notification:not(.mention),
|
||||||
|
.only-mentions .timeline-empty {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
.notification.skeleton {
|
.notification.skeleton {
|
||||||
color: var(--outline-color);
|
color: var(--outline-color);
|
||||||
}
|
}
|
||||||
|
@ -30,7 +34,11 @@
|
||||||
max-height: 160px;
|
max-height: 160px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
/* fade out mask gradient bottom */
|
/* 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);
|
filter: saturate(0.25);
|
||||||
}
|
}
|
||||||
.notification .status-link:hover {
|
.notification .status-link:hover {
|
||||||
|
@ -46,4 +54,24 @@
|
||||||
}
|
}
|
||||||
.notification-content p:first-child {
|
.notification-content p:first-child {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#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);
|
||||||
|
}
|
||||||
|
|
|
@ -97,6 +97,18 @@ function Notification({ notification }) {
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{text}
|
{text}
|
||||||
|
{type === 'mention' && (
|
||||||
|
<span class="insignificant">
|
||||||
|
{' '}
|
||||||
|
•{' '}
|
||||||
|
<relative-time
|
||||||
|
datetime={notification.createdAt}
|
||||||
|
format="micro"
|
||||||
|
threshold="P1D"
|
||||||
|
prefix=""
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</p>
|
</p>
|
||||||
{_accounts?.length > 1 && (
|
{_accounts?.length > 1 && (
|
||||||
<p>
|
<p>
|
||||||
|
@ -192,6 +204,7 @@ function Notifications() {
|
||||||
const snapStates = useSnapshot(states);
|
const snapStates = useSnapshot(states);
|
||||||
const [uiState, setUIState] = useState('default');
|
const [uiState, setUIState] = useState('default');
|
||||||
const [showMore, setShowMore] = useState(false);
|
const [showMore, setShowMore] = useState(false);
|
||||||
|
const [onlyMentions, setOnlyMentions] = useState(false);
|
||||||
|
|
||||||
const notificationsIterator = useRef(
|
const notificationsIterator = useRef(
|
||||||
masto.notifications.getIterator({
|
masto.notifications.getIterator({
|
||||||
|
@ -273,7 +286,7 @@ function Notifications() {
|
||||||
// console.log(groupedNotifications);
|
// console.log(groupedNotifications);
|
||||||
return (
|
return (
|
||||||
<div class="deck-container" ref={scrollableRef}>
|
<div class="deck-container" ref={scrollableRef}>
|
||||||
<div class="timeline-deck deck">
|
<div class={`timeline-deck deck ${onlyMentions ? 'only-mentions' : ''}`}>
|
||||||
<header>
|
<header>
|
||||||
<div class="header-side">
|
<div class="header-side">
|
||||||
<a href="#" class="button plain">
|
<a href="#" class="button plain">
|
||||||
|
@ -310,6 +323,18 @@ function Notifications() {
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</header>
|
</header>
|
||||||
|
<div id="mentions-option">
|
||||||
|
<label>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
checked={onlyMentions}
|
||||||
|
onChange={(e) => {
|
||||||
|
setOnlyMentions(e.target.checked);
|
||||||
|
}}
|
||||||
|
/>{' '}
|
||||||
|
Only mentions
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
{snapStates.notifications.length ? (
|
{snapStates.notifications.length ? (
|
||||||
<>
|
<>
|
||||||
<h2 class="timeline-header">Today</h2>
|
<h2 class="timeline-header">Today</h2>
|
||||||
|
|
Loading…
Add table
Reference in a new issue