feat: enhance room navigation with sub-room indicators and styling adjustments

This commit is contained in:
2026-03-15 19:23:22 +11:00
parent c980439bc9
commit 12286f57f7
5 changed files with 117 additions and 49 deletions

View File

@@ -23,6 +23,7 @@ import {
import { useFocusWithin, useHover } from 'react-aria';
import FocusTrap from 'focus-trap-react';
import { NavItem, NavItemContent, NavItemOptions, NavLink } from '../../components/nav';
import * as css from '../../components/nav/styles.css';
import { UnreadBadge, UnreadBadgeCenter } from '../../components/unread-badge';
import { RoomAvatar, RoomIcon } from '../../components/room-avatar';
import { getDirectRoomAvatarUrl, getRoomAvatarUrl, guessPerfectParent, getOrphanParents } from '../../utils/room';
@@ -279,6 +280,7 @@ type RoomNavItemProps = {
notificationMode?: RoomNotificationMode;
showAvatar?: boolean;
direct?: boolean;
hideIcon?: boolean;
};
export function RoomNavItem({
room,
@@ -287,6 +289,7 @@ export function RoomNavItem({
direct,
notificationMode,
linkPath,
hideIcon,
}: RoomNavItemProps) {
const mx = useMatrixClient();
const useAuthentication = useMediaAuthentication();
@@ -360,6 +363,7 @@ export function RoomNavItem({
return (
<Box direction="Column" style={{ width: '100%' }}>
<NavItem
className={hideIcon ? css.ThreadItem : undefined}
variant="Background"
radii="400"
highlight={unread !== undefined}
@@ -371,9 +375,10 @@ export function RoomNavItem({
>
<NavLink to={linkPath}>
<NavItemContent>
<Box as="span" grow="Yes" alignItems="Center" gap="200">
<Avatar size="200" radii="400">
{showAvatar ? (
<Box as="span" grow="Yes" alignItems="Center" gap={hideIcon ? "100" : "200"}>
{!hideIcon && (
<Avatar size="200" radii="400">
{showAvatar ? (
<RoomAvatar
roomId={room.roomId}
src={
@@ -396,7 +401,8 @@ export function RoomNavItem({
joinRule={room.getJoinRule()}
/>
)}
</Avatar>
</Avatar>
)}
<Box as="span" grow="Yes" direction="Column" style={{ overflow: 'hidden', minWidth: 0 }}>
<Text priority={unread ? '500' : '300'} as="span" size="Inherit" truncate>
{room.name}