Skip to content

Commit a3124c0

Browse files
committed
feat(room list item): use notification decoration in RoomListItemView
1 parent d5b738a commit a3124c0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/components/views/rooms/RoomListPanel/RoomListItemView.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import classNames from "classnames";
1212
import { useRoomListItemViewModel } from "../../../viewmodels/roomlist/RoomListItemViewModel";
1313
import DecoratedRoomAvatar from "../../avatars/DecoratedRoomAvatar";
1414
import { Flex } from "../../../utils/Flex";
15-
import { _t } from "../../../../languageHandler";
1615
import { RoomListItemMenuView } from "./RoomListItemMenuView";
16+
import { NotificationDecoration } from "../NotificationDecoration";
1717

1818
interface RoomListItemViewPropsProps extends React.HTMLAttributes<HTMLButtonElement> {
1919
/**
@@ -37,6 +37,7 @@ export function RoomListItemView({ room, isSelected, ...props }: RoomListItemVie
3737
// The compound menu in RoomListItemMenuView needs to be rendered when the hover menu is shown
3838
// Using display: none; and then display:flex when hovered in CSS causes the menu to be misaligned
3939
const showHoverDecoration = (isMenuOpen || isHover) && vm.showHoverMenu;
40+
// const hasNotification = vm.notificationState.isUnread;
4041

4142
return (
4243
<button
@@ -46,7 +47,7 @@ export function RoomListItemView({ room, isSelected, ...props }: RoomListItemVie
4647
})}
4748
type="button"
4849
aria-selected={isSelected}
49-
aria-label={_t("room_list|room|open_room", { roomName: room.name })}
50+
aria-label={vm.a11yLabel}
5051
onClick={() => vm.openRoom()}
5152
onMouseOver={() => setIsHover(true)}
5253
onMouseOut={() => setIsHover(false)}
@@ -65,7 +66,7 @@ export function RoomListItemView({ room, isSelected, ...props }: RoomListItemVie
6566
>
6667
{/* We truncate the room name when too long. Title here is to show the full name on hover */}
6768
<span title={room.name}>{room.name}</span>
68-
{showHoverDecoration && (
69+
{showHoverDecoration ? (
6970
<RoomListItemMenuView
7071
room={room}
7172
setMenuOpen={(isOpen) => {
@@ -74,6 +75,8 @@ export function RoomListItemView({ room, isSelected, ...props }: RoomListItemVie
7475
else setTimeout(() => setIsMenuOpen(isOpen), 0);
7576
}}
7677
/>
78+
) : (
79+
<NotificationDecoration vm={vm.notificationDecorationViewState} />
7780
)}
7881
</Flex>
7982
</Flex>

0 commit comments

Comments
 (0)