New room list: add context menu to room list item (#29952)
* chore: update compound-web * chore: remove unused export * feat: export content of more option menu * feat: add context menu * feat: add `showContextMenu` to vm * feat: use context menu in new room list * test: add tests for room list item * test: fix room list test * test: add `showContextMenu` test for `useRoomListItemViewModel` * test: add e2e test for context menu * chore: update compound * test: update snapshots and e2e test * fix: avoid icon blinking when we reopen the context menu * test: add test for menu closing * doc: remove useless tsdoc param * chore: update `@vector-im/compound-web` * refactor: remove manual focus * test(e2e): fix focus after closing notification menu * doc: remove useless jobs
This commit is contained in:
@@ -30,6 +30,10 @@ export interface RoomListItemViewState {
|
||||
* The name of the room.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Whether the context menu should be shown.
|
||||
*/
|
||||
showContextMenu: boolean;
|
||||
/**
|
||||
* Whether the hover menu should be shown.
|
||||
*/
|
||||
@@ -105,12 +109,12 @@ export function useRoomListItemViewModel(room: Room): RoomListItemViewState {
|
||||
setNotificationValues(getNotificationValues(notificationState));
|
||||
}, [notificationState]);
|
||||
|
||||
// We don't want to show the hover menu if
|
||||
// We don't want to show the menus if
|
||||
// - there is an invitation for this room
|
||||
// - the user doesn't have access to both notification and more options menus
|
||||
// - the user doesn't have access to notification and more options menus
|
||||
const showContextMenu = !invited && hasAccessToOptionsMenu(room);
|
||||
const showHoverMenu =
|
||||
!invited &&
|
||||
(hasAccessToOptionsMenu(room) || hasAccessToNotificationMenu(room, matrixClient.isGuest(), isArchived));
|
||||
!invited && (showContextMenu || hasAccessToNotificationMenu(room, matrixClient.isGuest(), isArchived));
|
||||
|
||||
const messagePreview = useRoomMessagePreview(room);
|
||||
|
||||
@@ -137,6 +141,7 @@ export function useRoomListItemViewModel(room: Room): RoomListItemViewState {
|
||||
return {
|
||||
name,
|
||||
notificationState,
|
||||
showContextMenu,
|
||||
showHoverMenu,
|
||||
openRoom,
|
||||
a11yLabel,
|
||||
|
||||
Reference in New Issue
Block a user