feat: add @ mention indicator on unread badge and bump version to v0.9.76

This commit is contained in:
haorwen
2026-04-09 00:07:29 +08:00
parent dd531f6be5
commit 0a6aae8ef7
2 changed files with 22 additions and 9 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "vocechat-web", "name": "vocechat-web",
"version": "0.9.75", "version": "0.9.76",
"homepage": "https://voce.chat", "homepage": "https://voce.chat",
"dependencies": { "dependencies": {
"@metamask/onboarding": "^1.0.1", "@metamask/onboarding": "^1.0.1",
+21 -8
View File
@@ -105,12 +105,13 @@ const Session: FC<IProps> = ({
if (!data) return null; if (!data) return null;
const previewMsg = messageData[mid] || {}; const previewMsg = messageData[mid] || {};
const { name, icon, is_public } = data; const { name, icon, is_public } = data;
const { unreads = 0 } = getUnreadCount({ const { unreads = 0, mentions = [] } = getUnreadCount({
mids, mids,
readIndex, readIndex,
messageData, messageData,
loginUid, loginUid,
}); });
const hasMention = mentions.length > 0;
const isVoicing = const isVoicing =
type == "channel" type == "channel"
? voiceList.some((item) => { ? voiceList.some((item) => {
@@ -181,14 +182,26 @@ const Session: FC<IProps> = ({
{renderPreviewMessage(previewMsg)} {renderPreviewMessage(previewMsg)}
</span> </span>
{unreads > 0 && !isCurrentPath ? ( {unreads > 0 && !isCurrentPath ? (
<strong <span className="flex items-center gap-0.5">
className={clsx( {hasMention && (
`text-white px-1.5 py-[3px] font-bold text-[10px] leading-[10px] rounded-[10px]`, <strong
muted ? "bg-black/10 dark:bg-gray-500" : "bg-primary-400" className={clsx(
`text-white px-1 py-[3px] font-bold text-[10px] leading-[10px] rounded-[10px]`,
muted ? "bg-black/10 dark:bg-gray-500" : "bg-primary-400"
)}
>
@
</strong>
)} )}
> <strong
{unreads > 99 ? "99+" : unreads} className={clsx(
</strong> `text-white px-1.5 py-[3px] font-bold text-[10px] leading-[10px] rounded-[10px]`,
muted ? "bg-black/10 dark:bg-gray-500" : "bg-primary-400"
)}
>
{unreads > 99 ? "99+" : unreads}
</strong>
</span>
) : ( ) : (
muted && <IconMute className="w-3 h-3 fill-black/10 dark:fill-gray-500" /> muted && <IconMute className="w-3 h-3 fill-black/10 dark:fill-gray-500" />
)} )}