this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Show annual report notification sticky to top

Might as well go all in

+128 -78
+1
src/components/ICONS.jsx
··· 174 174 'heart-break': () => import('@iconify-icons/mingcute/heart-crack-line'), 175 175 'user-x': () => import('@iconify-icons/mingcute/user-x-line'), 176 176 minimize: () => import('@iconify-icons/mingcute/arrows-down-line'), 177 + celebrate: () => import('@iconify-icons/mingcute/celebrate-line'), 177 178 };
+1
src/components/notification.jsx
··· 33 33 moderation_warning: 'alert', 34 34 emoji_reaction: 'emoji2', 35 35 'pleroma:emoji_reaction': 'emoji2', 36 + annual_report: 'celebrate', 36 37 }; 37 38 38 39 /*
+2 -1
src/data/features.json
··· 5 5 "@mastodon/filtered-notifications": "~4.3 || >=4.3", 6 6 "@mastodon/fetch-multiple-statuses": "~4.3 || >=4.3", 7 7 "@mastodon/trending-link-posts": "~4.3 || >=4.3", 8 - "@mastodon/grouped-notifications": "~4.3 || >=4.3" 8 + "@mastodon/grouped-notifications": "~4.3 || >=4.3", 9 + "@mastodon/annual-report": "~4.4 || >=4.4" 9 10 }
+77 -77
src/locales/en.po
··· 423 423 #: src/pages/catchup.jsx:1581 424 424 #: src/pages/filters.jsx:224 425 425 #: src/pages/list.jsx:274 426 - #: src/pages/notifications.jsx:868 427 - #: src/pages/notifications.jsx:1082 426 + #: src/pages/notifications.jsx:915 427 + #: src/pages/notifications.jsx:1129 428 428 #: src/pages/settings.jsx:77 429 429 #: src/pages/status.jsx:1299 430 430 msgid "Close" ··· 503 503 #: src/components/list-add-edit.jsx:149 504 504 #: src/components/shortcuts-settings.jsx:715 505 505 #: src/pages/filters.jsx:554 506 - #: src/pages/notifications.jsx:934 506 + #: src/pages/notifications.jsx:981 507 507 msgid "Save" 508 508 msgstr "" 509 509 ··· 531 531 #: src/pages/filters.jsx:89 532 532 #: src/pages/followed-hashtags.jsx:40 533 533 #: src/pages/home.jsx:53 534 - #: src/pages/notifications.jsx:520 534 + #: src/pages/notifications.jsx:560 535 535 msgid "Home" 536 536 msgstr "" 537 537 ··· 941 941 msgstr "" 942 942 943 943 #: src/components/follow-request-buttons.jsx:42 944 - #: src/pages/notifications.jsx:918 944 + #: src/pages/notifications.jsx:965 945 945 msgid "Accept" 946 946 msgstr "" 947 947 ··· 950 950 msgstr "" 951 951 952 952 #: src/components/follow-request-buttons.jsx:75 953 - #: src/pages/notifications.jsx:1201 953 + #: src/pages/notifications.jsx:1248 954 954 msgid "Accepted" 955 955 msgstr "" 956 956 ··· 963 963 msgstr "" 964 964 965 965 #: src/components/generic-accounts.jsx:145 966 - #: src/components/notification.jsx:444 966 + #: src/components/notification.jsx:445 967 967 #: src/pages/accounts.jsx:41 968 968 #: src/pages/search.jsx:317 969 969 #: src/pages/search.jsx:350 ··· 973 973 #: src/components/generic-accounts.jsx:205 974 974 #: src/components/timeline.jsx:519 975 975 #: src/pages/list.jsx:293 976 - #: src/pages/notifications.jsx:848 976 + #: src/pages/notifications.jsx:895 977 977 #: src/pages/search.jsx:544 978 978 #: src/pages/status.jsx:1332 979 979 msgid "Show more…" ··· 1290 1290 #: src/pages/filters.jsx:24 1291 1291 #: src/pages/home.jsx:84 1292 1292 #: src/pages/home.jsx:184 1293 - #: src/pages/notifications.jsx:112 1294 - #: src/pages/notifications.jsx:524 1293 + #: src/pages/notifications.jsx:113 1294 + #: src/pages/notifications.jsx:564 1295 1295 msgid "Notifications" 1296 1296 msgstr "" 1297 1297 ··· 1412 1412 msgid "View all notifications" 1413 1413 msgstr "" 1414 1414 1415 - #: src/components/notification.jsx:70 1415 + #: src/components/notification.jsx:71 1416 1416 msgid "{account} reacted to your post with {emojiObject}" 1417 1417 msgstr "" 1418 1418 1419 - #: src/components/notification.jsx:77 1419 + #: src/components/notification.jsx:78 1420 1420 msgid "{account} published a post." 1421 1421 msgstr "" 1422 1422 1423 - #: src/components/notification.jsx:85 1423 + #: src/components/notification.jsx:86 1424 1424 msgid "{count, plural, =1 {{postsCount, plural, =1 {{postType, select, reply {{account} boosted your reply.} other {{account} boosted your post.}}} other {{account} boosted {postsCount} of your posts.}}} other {{postType, select, reply {<0><1>{0}</1> people</0> boosted your reply.} other {<2><3>{1}</3> people</2> boosted your post.}}}}" 1425 1425 msgstr "" 1426 1426 1427 - #: src/components/notification.jsx:128 1427 + #: src/components/notification.jsx:129 1428 1428 msgid "{count, plural, =1 {{account} followed you.} other {<0><1>{0}</1> people</0> followed you.}}" 1429 1429 msgstr "" 1430 1430 1431 - #: src/components/notification.jsx:142 1431 + #: src/components/notification.jsx:143 1432 1432 msgid "{account} requested to follow you." 1433 1433 msgstr "" 1434 1434 1435 - #: src/components/notification.jsx:151 1435 + #: src/components/notification.jsx:152 1436 1436 msgid "{count, plural, =1 {{postsCount, plural, =1 {{postType, select, reply {{account} liked your reply.} other {{account} liked your post.}}} other {{account} liked {postsCount} of your posts.}}} other {{postType, select, reply {<0><1>{0}</1> people</0> liked your reply.} other {<2><3>{1}</3> people</2> liked your post.}}}}" 1437 1437 msgstr "" 1438 1438 1439 - #: src/components/notification.jsx:193 1439 + #: src/components/notification.jsx:194 1440 1440 msgid "A poll you have voted in or created has ended." 1441 1441 msgstr "" 1442 1442 1443 - #: src/components/notification.jsx:194 1443 + #: src/components/notification.jsx:195 1444 1444 msgid "A poll you have created has ended." 1445 1445 msgstr "" 1446 1446 1447 - #: src/components/notification.jsx:195 1447 + #: src/components/notification.jsx:196 1448 1448 msgid "A poll you have voted in has ended." 1449 1449 msgstr "" 1450 1450 1451 - #: src/components/notification.jsx:196 1451 + #: src/components/notification.jsx:197 1452 1452 msgid "A post you interacted with has been edited." 1453 1453 msgstr "" 1454 1454 1455 - #: src/components/notification.jsx:204 1455 + #: src/components/notification.jsx:205 1456 1456 msgid "{count, plural, =1 {{postsCount, plural, =1 {{postType, select, reply {{account} boosted & liked your reply.} other {{account} boosted & liked your post.}}} other {{account} boosted & liked {postsCount} of your posts.}}} other {{postType, select, reply {<0><1>{0}</1> people</0> boosted & liked your reply.} other {<2><3>{1}</3> people</2> boosted & liked your post.}}}}" 1457 1457 msgstr "" 1458 1458 1459 - #: src/components/notification.jsx:246 1459 + #: src/components/notification.jsx:247 1460 1460 msgid "{account} signed up." 1461 1461 msgstr "" 1462 1462 1463 - #: src/components/notification.jsx:248 1463 + #: src/components/notification.jsx:249 1464 1464 msgid "{account} reported {targetAccount}" 1465 1465 msgstr "" 1466 1466 1467 - #: src/components/notification.jsx:253 1467 + #: src/components/notification.jsx:254 1468 1468 msgid "Lost connections with <0>{name}</0>." 1469 1469 msgstr "" 1470 1470 1471 - #: src/components/notification.jsx:259 1471 + #: src/components/notification.jsx:260 1472 1472 msgid "Moderation warning" 1473 1473 msgstr "" 1474 1474 1475 - #: src/components/notification.jsx:264 1475 + #: src/components/notification.jsx:265 1476 1476 msgid "Your {year} #Wrapstodon is here!" 1477 1477 msgstr "Your {year} #Wrapstodon is here!" 1478 1478 1479 - #: src/components/notification.jsx:270 1479 + #: src/components/notification.jsx:271 1480 1480 msgid "An admin from <0>{from}</0> has suspended <1>{targetName}</1>, which means you can no longer receive updates from them or interact with them." 1481 1481 msgstr "" 1482 1482 1483 - #: src/components/notification.jsx:276 1483 + #: src/components/notification.jsx:277 1484 1484 msgid "An admin from <0>{from}</0> has blocked <1>{targetName}</1>. Affected followers: {followersCount}, followings: {followingCount}." 1485 1485 msgstr "" 1486 1486 1487 - #: src/components/notification.jsx:282 1487 + #: src/components/notification.jsx:283 1488 1488 msgid "You have blocked <0>{targetName}</0>. Removed followers: {followersCount}, followings: {followingCount}." 1489 1489 msgstr "" 1490 1490 1491 - #: src/components/notification.jsx:290 1491 + #: src/components/notification.jsx:291 1492 1492 msgid "Your account has received a moderation warning." 1493 1493 msgstr "" 1494 1494 1495 - #: src/components/notification.jsx:291 1495 + #: src/components/notification.jsx:292 1496 1496 msgid "Your account has been disabled." 1497 1497 msgstr "" 1498 1498 1499 - #: src/components/notification.jsx:292 1499 + #: src/components/notification.jsx:293 1500 1500 msgid "Some of your posts have been marked as sensitive." 1501 1501 msgstr "" 1502 1502 1503 - #: src/components/notification.jsx:293 1503 + #: src/components/notification.jsx:294 1504 1504 msgid "Some of your posts have been deleted." 1505 1505 msgstr "" 1506 1506 1507 - #: src/components/notification.jsx:294 1507 + #: src/components/notification.jsx:295 1508 1508 msgid "Your posts will be marked as sensitive from now on." 1509 1509 msgstr "" 1510 1510 1511 - #: src/components/notification.jsx:295 1511 + #: src/components/notification.jsx:296 1512 1512 msgid "Your account has been limited." 1513 1513 msgstr "" 1514 1514 1515 - #: src/components/notification.jsx:296 1515 + #: src/components/notification.jsx:297 1516 1516 msgid "Your account has been suspended." 1517 1517 msgstr "" 1518 1518 1519 - #: src/components/notification.jsx:371 1519 + #: src/components/notification.jsx:372 1520 1520 msgid "[Unknown notification type: {type}]" 1521 1521 msgstr "" 1522 1522 1523 - #: src/components/notification.jsx:440 1523 + #: src/components/notification.jsx:441 1524 1524 #: src/components/status.jsx:1036 1525 1525 #: src/components/status.jsx:1046 1526 1526 msgid "Boosted/Liked by…" 1527 1527 msgstr "" 1528 1528 1529 - #: src/components/notification.jsx:441 1529 + #: src/components/notification.jsx:442 1530 1530 msgid "Liked by…" 1531 1531 msgstr "" 1532 1532 1533 - #: src/components/notification.jsx:442 1533 + #: src/components/notification.jsx:443 1534 1534 msgid "Boosted by…" 1535 1535 msgstr "" 1536 1536 1537 - #: src/components/notification.jsx:443 1537 + #: src/components/notification.jsx:444 1538 1538 msgid "Followed by…" 1539 1539 msgstr "" 1540 1540 1541 - #: src/components/notification.jsx:514 1542 - #: src/components/notification.jsx:530 1541 + #: src/components/notification.jsx:515 1542 + #: src/components/notification.jsx:531 1543 1543 msgid "Learn more <0/>" 1544 1544 msgstr "" 1545 1545 1546 - #: src/components/notification.jsx:539 1546 + #: src/components/notification.jsx:540 1547 1547 msgid "View #Wrapstodon" 1548 1548 msgstr "View #Wrapstodon" 1549 1549 1550 - #: src/components/notification.jsx:769 1550 + #: src/components/notification.jsx:770 1551 1551 #: src/components/status.jsx:267 1552 1552 msgid "Read more →" 1553 1553 msgstr "" ··· 2341 2341 2342 2342 #: src/components/timeline.jsx:554 2343 2343 #: src/pages/home.jsx:213 2344 - #: src/pages/notifications.jsx:824 2344 + #: src/pages/notifications.jsx:871 2345 2345 #: src/pages/status.jsx:988 2346 2346 #: src/pages/status.jsx:1361 2347 2347 msgid "Try again" ··· 3154 3154 msgid "Unable to load mentions." 3155 3155 msgstr "" 3156 3156 3157 - #: src/pages/notifications.jsx:103 3157 + #: src/pages/notifications.jsx:104 3158 3158 msgid "You don't follow" 3159 3159 msgstr "" 3160 3160 3161 - #: src/pages/notifications.jsx:104 3161 + #: src/pages/notifications.jsx:105 3162 3162 msgid "Who don't follow you" 3163 3163 msgstr "" 3164 3164 3165 - #: src/pages/notifications.jsx:105 3165 + #: src/pages/notifications.jsx:106 3166 3166 msgid "With a new account" 3167 3167 msgstr "" 3168 3168 3169 - #: src/pages/notifications.jsx:106 3169 + #: src/pages/notifications.jsx:107 3170 3170 msgid "Who unsolicitedly private mention you" 3171 3171 msgstr "" 3172 3172 3173 - #: src/pages/notifications.jsx:107 3173 + #: src/pages/notifications.jsx:108 3174 3174 msgid "Who are limited by server moderators" 3175 3175 msgstr "" 3176 3176 3177 - #: src/pages/notifications.jsx:538 3178 - #: src/pages/notifications.jsx:872 3177 + #: src/pages/notifications.jsx:578 3178 + #: src/pages/notifications.jsx:919 3179 3179 msgid "Notifications settings" 3180 3180 msgstr "" 3181 3181 3182 - #: src/pages/notifications.jsx:556 3182 + #: src/pages/notifications.jsx:596 3183 3183 msgid "New notifications" 3184 3184 msgstr "" 3185 3185 3186 - #: src/pages/notifications.jsx:567 3186 + #: src/pages/notifications.jsx:607 3187 3187 msgid "{0, plural, one {Announcement} other {Announcements}}" 3188 3188 msgstr "" 3189 3189 3190 - #: src/pages/notifications.jsx:614 3190 + #: src/pages/notifications.jsx:654 3191 3191 #: src/pages/settings.jsx:1161 3192 3192 msgid "Follow requests" 3193 3193 msgstr "" 3194 3194 3195 - #: src/pages/notifications.jsx:619 3195 + #: src/pages/notifications.jsx:659 3196 3196 msgid "{0, plural, one {# follow request} other {# follow requests}}" 3197 3197 msgstr "" 3198 3198 3199 - #: src/pages/notifications.jsx:674 3199 + #: src/pages/notifications.jsx:714 3200 3200 msgid "{0, plural, one {Filtered notifications from # person} other {Filtered notifications from # people}}" 3201 3201 msgstr "" 3202 3202 3203 - #: src/pages/notifications.jsx:740 3203 + #: src/pages/notifications.jsx:787 3204 3204 msgid "Only mentions" 3205 3205 msgstr "" 3206 3206 3207 - #: src/pages/notifications.jsx:744 3207 + #: src/pages/notifications.jsx:791 3208 3208 msgid "Today" 3209 3209 msgstr "" 3210 3210 3211 - #: src/pages/notifications.jsx:749 3211 + #: src/pages/notifications.jsx:796 3212 3212 msgid "You're all caught up." 3213 3213 msgstr "" 3214 3214 3215 - #: src/pages/notifications.jsx:772 3215 + #: src/pages/notifications.jsx:819 3216 3216 msgid "Yesterday" 3217 3217 msgstr "" 3218 3218 3219 - #: src/pages/notifications.jsx:820 3219 + #: src/pages/notifications.jsx:867 3220 3220 msgid "Unable to load notifications" 3221 3221 msgstr "" 3222 3222 3223 - #: src/pages/notifications.jsx:899 3223 + #: src/pages/notifications.jsx:946 3224 3224 msgid "Notifications settings updated" 3225 3225 msgstr "" 3226 3226 3227 - #: src/pages/notifications.jsx:907 3227 + #: src/pages/notifications.jsx:954 3228 3228 msgid "Filter out notifications from people:" 3229 3229 msgstr "" 3230 3230 3231 - #: src/pages/notifications.jsx:921 3231 + #: src/pages/notifications.jsx:968 3232 3232 msgid "Filter" 3233 3233 msgstr "" 3234 3234 3235 - #: src/pages/notifications.jsx:924 3235 + #: src/pages/notifications.jsx:971 3236 3236 msgid "Ignore" 3237 3237 msgstr "" 3238 3238 3239 - #: src/pages/notifications.jsx:997 3239 + #: src/pages/notifications.jsx:1044 3240 3240 msgid "Updated <0>{0}</0>" 3241 3241 msgstr "" 3242 3242 3243 - #: src/pages/notifications.jsx:1065 3243 + #: src/pages/notifications.jsx:1112 3244 3244 msgid "View notifications from <0>@{0}</0>" 3245 3245 msgstr "" 3246 3246 3247 - #: src/pages/notifications.jsx:1086 3247 + #: src/pages/notifications.jsx:1133 3248 3248 msgid "Notifications from <0>@{0}</0>" 3249 3249 msgstr "" 3250 3250 3251 - #: src/pages/notifications.jsx:1153 3251 + #: src/pages/notifications.jsx:1200 3252 3252 msgid "Notifications from @{0} will not be filtered from now on." 3253 3253 msgstr "" 3254 3254 3255 - #: src/pages/notifications.jsx:1158 3255 + #: src/pages/notifications.jsx:1205 3256 3256 msgid "Unable to accept notification request" 3257 3257 msgstr "" 3258 3258 3259 - #: src/pages/notifications.jsx:1163 3259 + #: src/pages/notifications.jsx:1210 3260 3260 msgid "Allow" 3261 3261 msgstr "" 3262 3262 3263 - #: src/pages/notifications.jsx:1183 3263 + #: src/pages/notifications.jsx:1230 3264 3264 msgid "Notifications from @{0} will not show up in Filtered notifications from now on." 3265 3265 msgstr "" 3266 3266 3267 - #: src/pages/notifications.jsx:1188 3267 + #: src/pages/notifications.jsx:1235 3268 3268 msgid "Unable to dismiss notification request" 3269 3269 msgstr "" 3270 3270 3271 - #: src/pages/notifications.jsx:1193 3271 + #: src/pages/notifications.jsx:1240 3272 3272 msgid "Dismiss" 3273 3273 msgstr "" 3274 3274 3275 - #: src/pages/notifications.jsx:1208 3275 + #: src/pages/notifications.jsx:1255 3276 3276 msgid "Dismissed" 3277 3277 msgstr "" 3278 3278
+47
src/pages/notifications.jsx
··· 39 39 import shortenNumber from '../utils/shorten-number'; 40 40 import showToast from '../utils/show-toast'; 41 41 import states, { saveStatus } from '../utils/states'; 42 + import store from '../utils/store'; 42 43 import { getCurrentInstance } from '../utils/store-utils'; 43 44 import supports from '../utils/supports'; 44 45 import usePageVisibility from '../utils/usePageVisibility'; ··· 409 410 // } 410 411 // }, [uiState]); 411 412 413 + const [annualReportNotification, setAnnualReportNotification] = 414 + useState(null); 415 + useEffect(async () => { 416 + // Skip this if not in December 417 + const date = new Date(); 418 + if (date.getMonth() !== 11) return; 419 + 420 + // Skip if doesn't support annual report 421 + if (!supports('@mastodon/annual-report')) return; 422 + 423 + let annualReportNotification = store.account.get( 424 + 'annualReportNotification', 425 + ); 426 + if (annualReportNotification) { 427 + setAnnualReportNotification(annualReportNotification); 428 + return; 429 + } 430 + const notificationIterator = mastoFetchNotifications({ 431 + types: ['annual_report'], 432 + }); 433 + try { 434 + const notification = await notificationIterator.next(); 435 + annualReportNotification = notification?.value?.notificationGroups?.[0]; 436 + const annualReportYear = annualReportNotification?.annualReport?.year; 437 + // If same year, show the annual report 438 + if (annualReportYear == date.getFullYear()) { 439 + console.log( 440 + 'ANNUAL REPORT', 441 + annualReportYear, 442 + annualReportNotification, 443 + ); 444 + setAnnualReportNotification(annualReportNotification); 445 + store.account.set('annualReportNotification', annualReportNotification); 446 + } 447 + } catch (e) { 448 + console.warn(e); 449 + } 450 + }, []); 451 + 412 452 const itemsSelector = '.notification'; 413 453 const jRef = useHotkeys('j', () => { 414 454 const activeItem = document.activeElement.closest(itemsSelector); ··· 728 768 </div> 729 769 </div> 730 770 )} 771 + {annualReportNotification && ( 772 + <div class="shazam-container"> 773 + <div class="shazam-container-inner"> 774 + <Notification notification={annualReportNotification} /> 775 + </div> 776 + </div> 777 + )} 731 778 <div id="mentions-option"> 732 779 <label> 733 780 <input