Skip to content

Commit 2d75e4f

Browse files
committed
Group mention+quote notification
1 parent 08f87ce commit 2d75e4f

File tree

4 files changed

+54
-9
lines changed

4 files changed

+54
-9
lines changed

src/components/notification.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,11 @@ function Notification({
502502
<Icon icon="rocket" size="xl" alt={type} class="reblog-icon" />
503503
<Icon icon="heart" size="xl" alt={type} class="favourite-icon" />
504504
</>
505+
) : type === 'mention+quote' ? (
506+
<>
507+
<Icon icon="comment" size="xl" alt={type} class="mention-icon" />
508+
<Icon icon="quote" size="xl" alt={type} class="quote-icon" />
509+
</>
505510
) : (
506511
<Icon
507512
icon={NOTIFICATION_ICONS[type] || 'notification'}
@@ -526,7 +531,7 @@ function Notification({
526531
</mark>
527532
</>
528533
)} */}
529-
{type !== 'mention' && type !== 'quote' && (
534+
{type !== 'mention' && type !== 'quote' && type !== 'mention+quote' && (
530535
<>
531536
<p>{text}</p>
532537
{type === 'follow_request' && (

src/locales/en.po

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/pages/notifications.css

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@
5151
cursor: pointer;
5252
}
5353
}
54-
.notification-type:is(.notification-mention, .notification-quote) {
54+
.notification-type:is(
55+
.notification-mention,
56+
.notification-quote,
57+
.notification-mention\+quote
58+
) {
5559
padding-top: 16px;
5660
}
5761
.only-mentions .notification:not(.notification-mention),
@@ -91,6 +95,12 @@
9195
.notification .favourite-icon {
9296
color: var(--favourite-color);
9397
}
98+
.notification .mention-icon {
99+
color: var(--reply-to-color);
100+
}
101+
.notification .quote-icon {
102+
color: var(--quote-color);
103+
}
94104

95105
.notification .account-avatar-stack {
96106
position: relative;
@@ -142,12 +152,20 @@
142152
filter: saturate(0.25);
143153
}
144154
.notification
145-
.status-link:not(.status-type-mention, .status-type-quote)
155+
.status-link:not(
156+
.status-type-mention,
157+
.status-type-quote,
158+
.status-type-mention\+quote
159+
)
146160
> .status {
147161
font-size: calc(var(--text-size) * 0.9);
148162
}
149163
.notification
150-
.status-link.truncated:not(.status-type-mention, .status-type-quote)
164+
.status-link.truncated:not(
165+
.status-type-mention,
166+
.status-type-quote,
167+
.status-type-mention\+quote
168+
)
151169
> .status {
152170
/* fade out mask gradient bottom */
153171
mask-image: linear-gradient(
@@ -200,6 +218,20 @@
200218
border-color: var(--quote-color);
201219
box-shadow: 0 0 0 3px var(--quote-faded-color);
202220
}
221+
.notification .status-link.status-type-mention\+quote {
222+
max-height: 320px;
223+
filter: none;
224+
background-color: var(--bg-color);
225+
border-color: transparent;
226+
background-image:
227+
linear-gradient(var(--bg-color), var(--bg-color)),
228+
linear-gradient(135deg, var(--reply-to-color), var(--quote-color));
229+
background-origin: border-box;
230+
background-clip: padding-box, border-box;
231+
box-shadow:
232+
1.5px 1.5px 0 1.5px var(--quote-faded-color),
233+
-1.5px -1.5px 0 1.5px var(--reply-to-faded-color);
234+
}
203235
.notification:focus-visible .status-link,
204236
.notification .status-link:is(:hover, :focus) {
205237
background-color: var(--bg-blur-color);
@@ -214,6 +246,11 @@
214246
border-color: var(--quote-color);
215247
box-shadow: 0 0 5px var(--quote-color);
216248
}
249+
.notification .status-link.status-type-mention\+quote:is(:hover, :focus) {
250+
box-shadow:
251+
2.5px 2.5px 5px -2.5px var(--quote-color),
252+
-2.5px -2.5px 5px -2.5px var(--reply-to-color);
253+
}
217254
.notification .status-link:active {
218255
filter: brightness(0.95);
219256
}

src/utils/group-notifications.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const notificationTypeKeys = {
1111
update: ['status'],
1212
};
1313

14-
const GROUP_TYPES = ['favourite', 'reblog', 'follow'];
14+
const GROUP_TYPES = ['favourite', 'reblog', 'follow', 'mention', 'quote'];
1515
const groupable = (type) => GROUP_TYPES.includes(type);
1616

1717
export function fixNotifications(notifications) {
@@ -102,6 +102,9 @@ export function groupNotifications2(groupNotifications) {
102102
) {
103103
virtualType = 'favourite+reblog';
104104
}
105+
if (type === 'mention' || type === 'quote') {
106+
virtualType = 'mention+quote';
107+
}
105108
// const key = `${status?.id}-${virtualType}-${date}-${sameCount ? 1 : 0}`;
106109
const key = `${status?.id}-${virtualType}-${date}`;
107110
const mappedNotification = notificationsMap[key];

0 commit comments

Comments
 (0)