Help panels as ScrollTable to allow displaying entire content on small screens

This commit is contained in:
veeso
2021-06-12 09:05:02 +02:00
parent f078232499
commit 26f7c1f9d1
6 changed files with 23 additions and 12 deletions

View File

@@ -24,9 +24,10 @@ Released on FIXME: ??
- Bugfix: - Bugfix:
- Fixed broken input cursor when typing UTF8 characters (tui-realm 0.3.2) - Fixed broken input cursor when typing UTF8 characters (tui-realm 0.3.2)
- Help panels as `ScrollTable` to allow displaying entire content on small screens
- Dependencies: - Dependencies:
- Updated `textwrap` to `0.14.0` - Updated `textwrap` to `0.14.0`
- Updated `tui-realm` to `0.4.1` - Updated `tui-realm` to `0.4.2`
## 0.5.0 ## 0.5.0

4
Cargo.lock generated
View File

@@ -1440,9 +1440,9 @@ dependencies = [
[[package]] [[package]]
name = "tuirealm" name = "tuirealm"
version = "0.4.1" version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bee2a1c050878fac02ba3a6c2e93aa92a1de56849d5deec00d4ab4bc7928c0a" checksum = "9897335542e4a4a87ad391419c35e54b4088661e671ba53e578fbbb1154740c2"
dependencies = [ dependencies = [
"crossterm", "crossterm",
"textwrap", "textwrap",

View File

@@ -50,7 +50,7 @@ tempfile = "3.1.0"
textwrap = "0.14.0" textwrap = "0.14.0"
thiserror = "^1.0.0" thiserror = "^1.0.0"
toml = "0.5.8" toml = "0.5.8"
tuirealm = { version = "0.4.1", features = [ "with-components" ] } tuirealm = { version = "0.4.2", features = [ "with-components" ] }
ureq = { version = "2.1.0", features = [ "json" ] } ureq = { version = "2.1.0", features = [ "json" ] }
whoami = "1.1.1" whoami = "1.1.1"
wildmatch = "2.0.0" wildmatch = "2.0.0"

View File

@@ -37,8 +37,8 @@ use tuirealm::components::{
input::{Input, InputPropsBuilder}, input::{Input, InputPropsBuilder},
label::{Label, LabelPropsBuilder}, label::{Label, LabelPropsBuilder},
radio::{Radio, RadioPropsBuilder}, radio::{Radio, RadioPropsBuilder},
scrolltable::{ScrollTablePropsBuilder, Scrolltable},
span::{Span, SpanPropsBuilder}, span::{Span, SpanPropsBuilder},
table::{Table, TablePropsBuilder},
}; };
use tuirealm::tui::{ use tuirealm::tui::{
layout::{Constraint, Direction, Layout}, layout::{Constraint, Direction, Layout},
@@ -622,9 +622,12 @@ impl AuthActivity {
pub(super) fn mount_help(&mut self) { pub(super) fn mount_help(&mut self) {
self.view.mount( self.view.mount(
super::COMPONENT_TEXT_HELP, super::COMPONENT_TEXT_HELP,
Box::new(Table::new( Box::new(Scrolltable::new(
TablePropsBuilder::default() ScrollTablePropsBuilder::default()
.with_borders(Borders::ALL, BorderType::Rounded, Color::White) .with_borders(Borders::ALL, BorderType::Rounded, Color::White)
.with_highlighted_str(Some("?"))
.with_max_scroll_step(8)
.bold()
.with_table( .with_table(
Some(String::from("Help")), Some(String::from("Help")),
TableBuilder::default() TableBuilder::default()

View File

@@ -49,6 +49,7 @@ use tuirealm::components::{
input::{Input, InputPropsBuilder}, input::{Input, InputPropsBuilder},
progress_bar::{ProgressBar, ProgressBarPropsBuilder}, progress_bar::{ProgressBar, ProgressBarPropsBuilder},
radio::{Radio, RadioPropsBuilder}, radio::{Radio, RadioPropsBuilder},
scrolltable::{ScrollTablePropsBuilder, Scrolltable},
span::{Span, SpanPropsBuilder}, span::{Span, SpanPropsBuilder},
table::{Table, TablePropsBuilder}, table::{Table, TablePropsBuilder},
}; };
@@ -880,9 +881,12 @@ impl FileTransferActivity {
pub(super) fn mount_help(&mut self) { pub(super) fn mount_help(&mut self) {
self.view.mount( self.view.mount(
super::COMPONENT_TEXT_HELP, super::COMPONENT_TEXT_HELP,
Box::new(Table::new( Box::new(Scrolltable::new(
TablePropsBuilder::default() ScrollTablePropsBuilder::default()
.with_borders(Borders::ALL, BorderType::Rounded, Color::White) .with_borders(Borders::ALL, BorderType::Rounded, Color::White)
.with_highlighted_str(Some("?"))
.with_max_scroll_step(8)
.bold()
.with_table( .with_table(
Some(String::from("Help")), Some(String::from("Help")),
TableBuilder::default() TableBuilder::default()

View File

@@ -40,8 +40,8 @@ use std::path::PathBuf;
use tuirealm::components::{ use tuirealm::components::{
input::{Input, InputPropsBuilder}, input::{Input, InputPropsBuilder},
radio::{Radio, RadioPropsBuilder}, radio::{Radio, RadioPropsBuilder},
scrolltable::{ScrollTablePropsBuilder, Scrolltable},
span::{Span, SpanPropsBuilder}, span::{Span, SpanPropsBuilder},
table::{Table, TablePropsBuilder},
}; };
use tuirealm::tui::{ use tuirealm::tui::{
layout::{Constraint, Direction, Layout}, layout::{Constraint, Direction, Layout},
@@ -557,9 +557,12 @@ impl SetupActivity {
pub(super) fn mount_help(&mut self) { pub(super) fn mount_help(&mut self) {
self.view.mount( self.view.mount(
super::COMPONENT_TEXT_HELP, super::COMPONENT_TEXT_HELP,
Box::new(Table::new( Box::new(Scrolltable::new(
TablePropsBuilder::default() ScrollTablePropsBuilder::default()
.with_borders(Borders::ALL, BorderType::Rounded, Color::White) .with_borders(Borders::ALL, BorderType::Rounded, Color::White)
.with_highlighted_str(Some("?"))
.with_max_scroll_step(8)
.bold()
.with_table( .with_table(
Some(String::from("Help")), Some(String::from("Help")),
TableBuilder::default() TableBuilder::default()