mirror of
https://github.com/youwen5/iamb.git
synced 2025-06-20 13:49:52 -07:00
Add more documentation (#166)
This commit is contained in:
parent
2673cfaeb9
commit
9197864c5c
16 changed files with 267 additions and 2 deletions
|
@ -1,3 +1,11 @@
|
|||
//! # Windows for the User Interface
|
||||
//!
|
||||
//! This module contains the logic for rendering windows, and handling UI actions that get
|
||||
//! delegated to individual windows/UI elements (e.g., typing text or selecting a list item).
|
||||
//!
|
||||
//! Additionally, some of the iamb commands delegate behaviour to the current UI element. For
|
||||
//! example, [sending messages][crate::base::SendAction] delegate to the [room window][RoomState],
|
||||
//! where we have the message bar and room ID easily accesible and resetable.
|
||||
use std::cmp::{Ord, Ordering, PartialOrd};
|
||||
use std::ops::Deref;
|
||||
use std::sync::Arc;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//! Window for Matrix rooms
|
||||
use std::borrow::Cow;
|
||||
use std::ffi::{OsStr, OsString};
|
||||
use std::fs;
|
||||
|
@ -85,6 +86,7 @@ use crate::worker::Requester;
|
|||
|
||||
use super::scrollback::{Scrollback, ScrollbackState};
|
||||
|
||||
/// State needed for rendering [Chat].
|
||||
pub struct ChatState {
|
||||
room_id: OwnedRoomId,
|
||||
room: MatrixRoom,
|
||||
|
@ -786,6 +788,7 @@ impl Promptable<ProgramContext, ProgramStore, IambInfo> for ChatState {
|
|||
}
|
||||
}
|
||||
|
||||
/// [StatefulWidget] for Matrix rooms.
|
||||
pub struct Chat<'a> {
|
||||
store: &'a mut ProgramStore,
|
||||
focused: bool,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//! # Windows for Matrix rooms and spaces
|
||||
use matrix_sdk::{
|
||||
room::{Invited, Room as MatrixRoom},
|
||||
ruma::{
|
||||
|
@ -79,6 +80,11 @@ macro_rules! delegate {
|
|||
};
|
||||
}
|
||||
|
||||
/// State for a Matrix room or space.
|
||||
///
|
||||
/// Since spaces function as special rooms within Matrix, we wrap their window state together, so
|
||||
/// that operations like sending and accepting invites, opening the members window, etc., all work
|
||||
/// similarly.
|
||||
pub enum RoomState {
|
||||
Chat(ChatState),
|
||||
Space(SpaceState),
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//! Message scrollback
|
||||
use std::collections::HashSet;
|
||||
|
||||
use regex::Regex;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//! Window for Matrix spaces
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
|
@ -25,6 +26,7 @@ use crate::windows::RoomItem;
|
|||
|
||||
const SPACE_HIERARCHY_DEBOUNCE: Duration = Duration::from_secs(5);
|
||||
|
||||
/// State needed for rendering [Space].
|
||||
pub struct SpaceState {
|
||||
room_id: OwnedRoomId,
|
||||
room: MatrixRoom,
|
||||
|
@ -86,6 +88,7 @@ impl DerefMut for SpaceState {
|
|||
}
|
||||
}
|
||||
|
||||
/// [StatefulWidget] for Matrix spaces.
|
||||
pub struct Space<'a> {
|
||||
focused: bool,
|
||||
store: &'a mut ProgramStore,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//! Welcome Window
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
use modalkit::tui::{buffer::Buffer, layout::Rect};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue