import { msg, Plural, Select, t, Trans } from '@lingui/macro'; import { useLingui } from '@lingui/react'; import { Fragment } from 'preact'; import { memo } from 'preact/compat'; import shortenNumber from '../utils/shorten-number'; import states, { statusKey } from '../utils/states'; import { getCurrentAccountID } from '../utils/store-utils'; import useTruncated from '../utils/useTruncated'; import Avatar from './avatar'; import CustomEmoji from './custom-emoji'; import FollowRequestButtons from './follow-request-buttons'; import Icon from './icon'; import Link from './link'; import NameText from './name-text'; import Status from './status'; const NOTIFICATION_ICONS = { mention: 'comment', status: 'notification', reblog: 'rocket', follow: 'follow', follow_request: 'follow-add', favourite: 'heart', poll: 'poll', update: 'pencil', 'admin.signup': 'account-edit', 'admin.report': 'account-warning', severed_relationships: 'heart-break', moderation_warning: 'alert', emoji_reaction: 'emoji2', 'pleroma:emoji_reaction': 'emoji2', }; /* Notification types ================== mention = Someone mentioned you in their status status = Someone you enabled notifications for has posted a status reblog = Someone boosted one of your statuses follow = Someone followed you follow_request = Someone requested to follow you favourite = Someone favourited one of your statuses poll = A poll you have voted in or created has ended update = A status you interacted with has been edited admin.sign_up = Someone signed up (optionally sent to admins) admin.report = A new report has been filed severed_relationships = Severed relationships moderation_warning = Moderation warning */ function emojiText({ account, emoji, emoji_url }) { let url; let staticUrl; if (typeof emoji_url === 'string') { url = emoji_url; } else { url = emoji_url?.url; staticUrl = emoji_url?.staticUrl; } const emojiObject = url ? ( ) : ( emoji ); return ( {account} reacted to your post with {emojiObject} ); } const contentText = { status: ({ account }) => {account} published a post., reblog: ({ count, account, postsCount, postType, components: { Subject }, }) => ( {account} boosted your reply.} other={{account} boosted your post.} /> } other={ {account} boosted {postsCount} of your posts. } /> } other={ 1}> {shortenNumber(count)} people {' '} liked your reply. } other={ 1}> {shortenNumber(count)} people {' '} liked your post. } /> } /> ), poll: () => t`A poll you have voted in or created has ended.`, 'poll-self': () => t`A poll you have created has ended.`, 'poll-voted': () => t`A poll you have voted in has ended.`, update: () => t`A post you interacted with has been edited.`, 'favourite+reblog': ({ count, account, postsCount, postType, components: { Subject }, }) => ( {account} boosted & liked your reply.} other={{account} boosted & liked your post.} /> } other={ {account} boosted & liked {postsCount} of your posts. } /> } other={