* refactor: extract room creation and right verification * refactor: update `RoomListHeaderViewModel` to use utils * feat(room list filter): add filter key to `PrimaryFilter` model * feat(room list filter): return active primary filter * feat(room list): add create room action and rights verification * test: update room list tests * feat(empty room list): add empty room list * test(empty room list): add empty room list tests * feat(room list): use empty room list in `RoomListView` * test(room list panel): update tests * test(e2e): add e2e tests for empty room list * test(e2e): update room list header snapshot
29 lines
860 B
TypeScript
29 lines
860 B
TypeScript
/*
|
|
* Copyright 2025 New Vector Ltd.
|
|
*
|
|
* SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
|
* Please see LICENSE files in the repository root for full details.
|
|
*/
|
|
|
|
import React, { type JSX } from "react";
|
|
|
|
import { useRoomListViewModel } from "../../../viewmodels/roomlist/RoomListViewModel";
|
|
import { RoomList } from "./RoomList";
|
|
import { EmptyRoomList } from "./EmptyRoomList";
|
|
import { RoomListPrimaryFilters } from "./RoomListPrimaryFilters";
|
|
|
|
/**
|
|
* Host the room list and the (future) room filters
|
|
*/
|
|
export function RoomListView(): JSX.Element {
|
|
const vm = useRoomListViewModel();
|
|
const isRoomListEmpty = vm.rooms.length === 0;
|
|
|
|
return (
|
|
<>
|
|
<RoomListPrimaryFilters vm={vm} />
|
|
{isRoomListEmpty ? <EmptyRoomList vm={vm} /> : <RoomList vm={vm} />}
|
|
</>
|
|
);
|
|
}
|