diff --git a/.changeset/feat-change-unverified-view.md b/.changeset/feat-change-unverified-view.md new file mode 100644 index 000000000..c089ceeaf --- /dev/null +++ b/.changeset/feat-change-unverified-view.md @@ -0,0 +1,5 @@ +--- +default: minor +--- + +Change unverified device flow. diff --git a/.changeset/feat_rework_mobile_view.md b/.changeset/feat_rework_mobile_view.md new file mode 100644 index 000000000..8ebeeb467 --- /dev/null +++ b/.changeset/feat_rework_mobile_view.md @@ -0,0 +1,5 @@ +--- +default: minor +--- + +Modify large parts of the mobile view of Sable! diff --git a/src/app/pages/client/sidebar/MessageTab.tsx b/src/app/pages/client/sidebar/MessageTab.tsx index 88743eae3..ac1f86b87 100644 --- a/src/app/pages/client/sidebar/MessageTab.tsx +++ b/src/app/pages/client/sidebar/MessageTab.tsx @@ -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 ( @@ -54,6 +81,20 @@ export function MessageTab({ isBottom, isMobile }: { isBottom?: boolean; isMobil color={opened && isMobile ? color.Primary.Main : color.Background.OnContainer} /> + {unread && ( + + 0} + count={unread.highlight > 0 ? unread.highlight : unread.total} + /> + + )} {isMobile && ( Messages diff --git a/src/app/pages/client/sidebar/UserMenuTab.tsx b/src/app/pages/client/sidebar/UserMenuTab.tsx index 9d16a3a91..415f8c8b9 100644 --- a/src/app/pages/client/sidebar/UserMenuTab.tsx +++ b/src/app/pages/client/sidebar/UserMenuTab.tsx @@ -599,7 +599,7 @@ export function UnverifiedMenuOption() { onClick={() => openSettings('devices')} > - {`Verify ${unverified ? 'this' : 'another'} device${!unverified && (unverifiedDeviceCount ?? 0) > 1 ? 's' : ''}`} + {`Verify ${unverified ? 'this' : 'your'} device${!unverified && (unverifiedDeviceCount ?? 0) > 1 ? 's' : ''}`} )}