diff --git a/src/widgets/room_join_widget.rs b/src/widgets/room_join_widget.rs index 669aaec..230d072 100644 --- a/src/widgets/room_join_widget.rs +++ b/src/widgets/room_join_widget.rs @@ -19,11 +19,15 @@ use dioxus::core_macro::Props; use dioxus::hooks::use_state; use dioxus::prelude::*; +/// The props for the room join widget, including: +/// * The event handler for when the user clicks the join button, passing in a room name. This name is not validated in any way. #[derive(Props)] pub struct RoomJoinProps<'a> { on_join_room: EventHandler<'a, String>, } +/// A simple widget that allows the user to join a room by typing +/// its name into a text field and clicking a button. pub fn RoomJoinWidget<'a>(cx: Scope<'a, RoomJoinProps>) -> Element<'a> { let room = use_state(cx, || "".to_owned()); diff --git a/src/widgets/room_list.rs b/src/widgets/room_list.rs index 7efe56b..d42e5a0 100644 --- a/src/widgets/room_list.rs +++ b/src/widgets/room_list.rs @@ -19,33 +19,47 @@ use dioxus::core_macro::Props; use dioxus::prelude::*; use jid::BareJid; +/// The props for the room list widget, including: +/// * The list of rooms to show. +/// * The event handler for when the user clicks a room. +/// * The event handler for when the user clicks the "leave" button for a room. #[derive(Props)] pub struct RoomListProps<'a> { - rooms: Vec, + rooms: Vec, // TODO: Should this be a reference of some kind? on_room_picked: EventHandler<'a, BareJid>, on_room_left: EventHandler<'a, BareJid>, } -/// A Dioxus component that renders a list of rooms +/// A widget that shows a list of rooms known to the client. +/// +/// It provides an overview of the rooms, and allows the user to +/// select a room or to leave it. +/// +/// How "selecting" and "leaving" a room is handled is up to the context. pub fn RoomList<'a>(cx: Scope<'a, RoomListProps>) -> Element<'a> { render! { + // An