@@ -11,8 +11,15 @@ import { type RoomViewProps, type BuiltinsApi } from "@element-hq/element-web-mo
1111import RoomAvatar from "../components/views/avatars/RoomAvatar" ;
1212import { getSafeCli } from "./common" ;
1313
14+ interface RoomViewPropsWithRoomId extends RoomViewProps {
15+ /**
16+ * The ID of the room to display
17+ */
18+ roomId : string ;
19+ }
20+
1421export class ElementWebBuiltinsApi implements BuiltinsApi {
15- private _roomView ?: React . ComponentType < RoomViewProps > ;
22+ private _roomView ?: React . ComponentType < RoomViewPropsWithRoomId > ;
1623
1724 /**
1825 * Sets the components used to render a RoomView
@@ -23,21 +30,21 @@ export class ElementWebBuiltinsApi implements BuiltinsApi {
2330 *
2431 * @param component The RoomView component
2532 */
26- public setRoomViewComponent ( component : React . ComponentType < RoomViewProps > ) : void {
33+ public setRoomViewComponent ( component : React . ComponentType < RoomViewPropsWithRoomId > ) : void {
2734 this . _roomView = component ;
2835 }
2936
30- public getRoomViewComponent ( ) : React . ComponentType < RoomViewProps > {
37+ public getRoomViewComponent ( ) : React . ComponentType < RoomViewPropsWithRoomId > {
3138 if ( ! this . _roomView ) {
3239 throw new Error ( "No RoomView component has been set" ) ;
3340 }
3441
3542 return this . _roomView ;
3643 }
3744
38- public renderRoomView ( roomId : string ) : React . ReactNode {
45+ public renderRoomView ( roomId : string , props ?: RoomViewProps ) : React . ReactNode {
3946 const Component = this . getRoomViewComponent ( ) ;
40- return < Component roomId = { roomId } /> ;
47+ return < Component roomId = { roomId } { ... props } /> ;
4148 }
4249
4350 public renderRoomAvatar ( roomId : string , size ?: string ) : React . ReactNode {
0 commit comments