-
Notifications
You must be signed in to change notification settings - Fork 22
terminal-tui: library w/ tui-realm #171
base: master
Are you sure you want to change the base?
Conversation
91e415a
to
d158b0c
Compare
Nice, makes sense! |
f41b1e1
to
d843f4a
Compare
terminal-tui/src/lib.rs
Outdated
{ | ||
/// Returns the tui-realm application held by this tui-application. | ||
/// Used to poll new events in main loop. | ||
fn app(&mut self) -> &mut Application<Id, Message, NoUserEvent>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaks the abstraction?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've now added wrapper functions to the base App
such that client applications do not need to know about the tuirealm::Applicaiton
anymore.
terminal-tui/src/components.rs
Outdated
/// aligned and separated by a divider. | ||
pub struct Tabs { | ||
props: Props, | ||
pub states: TabsState, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
selected: usize
len: usize
self.tabs = Tabs::default().spans(&titles); | ||
self | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tabbed_ui
.child("comments", CommentComponent::new())
.child("issues", IssueComponent::new())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took this into account in the rework.
terminal-tui/examples/demo/app.rs
Outdated
pub enum TabId { | ||
Welcome, | ||
List, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TabContainer::child(title: impl ToString, ...)
impl Display for TabId
container.child(TabId::Welcome, WelcomeScreen::new())
terminal-tui/examples/demo/app.rs
Outdated
.borders(Borders::default().sides(BorderSides::NONE)) | ||
.text_rows(&welcome), | ||
), | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
child(child: impl MockComponent) { Box::new(child) }
}) => return Some(Message::Quit), | ||
_ => CmdResult::None, | ||
}; | ||
Some(Message::None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
terminal-tui/src/state.rs
Outdated
/// List of items that keeps track of the selection. | ||
pub struct Items<T> { | ||
values: Vec<T>, | ||
index: usize, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
selected: usize
3e056dc
to
076d15c
Compare
Signed-off-by: Erik Kundt <[email protected]>
Signed-off-by: Erik Kundt <[email protected]>
Signed-off-by: Erik Kundt <[email protected]>
Signed-off-by: Erik Kundt <[email protected]>
Signed-off-by: Erik Kundt <[email protected]>
Signed-off-by: Erik Kundt <[email protected]>
Signed-off-by: Erik Kundt <[email protected]>
Signed-off-by: Erik Kundt <[email protected]>
076d15c
to
e98c353
Compare
Description
This PR introduces a thin layer on top of tui-realm and provides some common components that can be re-used across multiple TUI applications in the Radicle project.
It's meant to be an alternative implementation of #151, providing the same functionality, but being based on an exising library instead of an own solution / library.
Motivation
After building a few smaller prototypes (e.g. #147) based on #151, it turned out to have some shortcomings:
Some research on how to solve these shortcomings led to the discovery of
tui-realm
. Sincetui-realm
makes use of some concepts that were also considered (or even partially used) while developing the initial TUI library (input subscriptions), it seemed to make sense to usetui-realm
instead in order to save the effort of implementing and maintaining our own library.tui-realm
The library follows an Elm / React inspired design approach that solves the shortcomings mentioned above:
What should be added next?