add message unread bubble

Signed-off-by: Shea <[email protected]>
This commit is contained in:
Shea committed 2026-07-05 06:02:56 +03:00
1 parent 66519a8bf0
commit a1406ec069
4 files changed
+54 -3

No files matched your search

@@ -0,0 +1,5 @@
---
default: minor
---
Change unverified device flow.
+5
View File
@@ -0,0 +1,5 @@
---
default: minor
---
Modify large parts of the mobile view of Sable!
+43 -2
View File
@@ -1,4 +1,9 @@
import { SidebarAvatar, SidebarItem, SidebarItemTooltip } from '$components/sidebar';
import {
SidebarAvatar,
SidebarItem,
SidebarItemTooltip,
SidebarUnreadBadge,
} from '$components/sidebar';
import { getPhosphorIconSize } from '$components/icons/phosphor';
import { matchPath, useNavigate } from 'react-router-dom';
import { HOME_PATH, SETTINGS_PATH } from '$pages/paths';
@@ -6,13 +11,22 @@ import { ChatTextIcon } from '@phosphor-icons/react';
import { useAtom, useAtomValue } from 'jotai';
import { searchModalAtom } from '$state/searchModal';
import { useInboxSelected } from '$hooks/router/useInbox';
import { Box, color, Text } from 'folds';
import { Box, color, Text, toRem } from 'folds';
import { useNavigateSelected } from '$hooks/router/useNavigateSelected';
import { useProfileSelected } from '$hooks/router/useProfileSelected';
import { getSpacePath } from '$pages/pathUtils';
import { lastVisitedSpaceIdAtom } from '$state/room/lastSpace';
import { allRoomsAtom } from '$state/room-list/roomList';
import { useRoomsUnread } from '$state/hooks/unread';
import { roomToUnreadAtom } from '$state/room/roomToUnread';
import { useSetting } from '$state/hooks/settings';
import { settingsAtom } from '$state/settings';
import { resolveUnreadBadgeMode } from '$components/unread-badge';
export function MessageTab({ isBottom, isMobile }: { isBottom?: boolean; isMobile?: boolean }) {
const rooms = useAtomValue(allRoomsAtom);
const unread = useRoomsUnread(rooms, roomToUnreadAtom);
const navigate = useNavigate();
const lastSpaceId = useAtomValue(lastVisitedSpaceIdAtom);
const [searchSelected] = useAtom(searchModalAtom);
@@ -35,6 +49,19 @@ export function MessageTab({ isBottom, isMobile }: { isBottom?: boolean; isMobil
navigate(getSpacePath(lastSpaceId));
};
const [showUnreadCounts] = useSetting(settingsAtom, 'showUnreadCounts');
const [badgeCountDMsOnly] = useSetting(settingsAtom, 'badgeCountDMsOnly');
const [showPingCounts] = useSetting(settingsAtom, 'showPingCounts');
const resolvedMode = unread
? resolveUnreadBadgeMode({
highlight: !!unread.highlight,
count: unread.total,
showUnreadCounts,
badgeCountDMsOnly,
showPingCounts,
})
: undefined;
return (
<SidebarItem active={opened} isBottom={isBottom}>
<SidebarItemTooltip tooltip="Messages" position={isBottom ? 'Top' : 'Right'}>
@@ -54,6 +81,20 @@ export function MessageTab({ isBottom, isMobile }: { isBottom?: boolean; isMobil
color={opened && isMobile ? color.Primary.Main : color.Background.OnContainer}
/>
</SidebarAvatar>
{unread && (
<Box
style={
resolvedMode === 'dot'
? { position: 'relative', left: toRem(-10), top: toRem(-30) }
: { position: 'relative', left: toRem(-12), top: toRem(-34) }
}
>
<SidebarUnreadBadge
highlight={unread.highlight > 0}
count={unread.highlight > 0 ? unread.highlight : unread.total}
/>
</Box>
)}
{isMobile && (
<Text size="O400" priority="300">
Messages
+1 -1
View File
@@ -599,7 +599,7 @@ export function UnverifiedMenuOption() {
onClick={() => openSettings('devices')}
>
<Text style={{ flexGrow: 1 }} size="T300">
{`Verify ${unverified ? 'this' : 'another'} device${!unverified && (unverifiedDeviceCount ?? 0) > 1 ? 's' : ''}`}
{`Verify ${unverified ? 'this' : 'your'} device${!unverified && (unverifiedDeviceCount ?? 0) > 1 ? 's' : ''}`}
</Text>
</MenuItem>
)}