mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
add Modal::Message to handle errors
This commit is contained in:
parent
a77536c234
commit
0a090765d3
4 changed files with 43 additions and 16 deletions
|
|
@ -67,10 +67,11 @@ impl Tek {
|
|||
Fixed::xy(30, 15, Tui::fg_bg(Rgb(255,255,255), Rgb(16,16,16), Bsp::b(
|
||||
Repeat(" "),
|
||||
Outer(true, Style::default().fg(Tui::g(96)))
|
||||
.enclose(self.modal.map(|modal|match modal {
|
||||
.enclose(self.modal.as_ref().map(|modal|match modal {
|
||||
Modal::Menu => self.view_modal_menu().boxed(),
|
||||
Modal::Help => self.view_modal_help().boxed(),
|
||||
Modal::Device(index) => self.view_modal_device(index).boxed(),
|
||||
Modal::Device(index) => self.view_modal_device(*index).boxed(),
|
||||
Modal::Message(message) => self.view_modal_message(message).boxed(),
|
||||
}))
|
||||
)))
|
||||
))
|
||||
|
|
@ -120,6 +121,10 @@ impl Tek {
|
|||
Bsp::s(Tui::bold(true, "Add device"), Map::south(1, choices, choice))
|
||||
}
|
||||
|
||||
fn view_modal_message <'a> (&'a self, message: &'a Message) -> impl Content<TuiOut> + use<'a> {
|
||||
Bsp::s(message, "[ OK ]")
|
||||
}
|
||||
|
||||
/// Spacing between tracks.
|
||||
pub(crate) const TRACK_SPACING: usize = 0;
|
||||
|
||||
|
|
@ -361,14 +366,13 @@ impl<'a> ArrangerView<'a> {
|
|||
.right(*width_side, button_2("Z", "add device", *is_editing))
|
||||
.middle(*width_mid, per_track_top(*width_mid, ||self.tracks_with_sizes_scrolled(),
|
||||
move|index, track|{
|
||||
wrap(if *track_selected == Some(index) {
|
||||
let bg = if *track_selected == Some(index) {
|
||||
track.color.light
|
||||
} else {
|
||||
track.color.base
|
||||
}.rgb, Tui::g(224), Tui::bold(true, Fill::x(Bsp::e(
|
||||
Tui::fg_bg(Reset, Reset, "[ "),
|
||||
Tui::fg_bg(Reset, Reset, " ]"),
|
||||
))))
|
||||
};
|
||||
let fg = Tui::g(224);
|
||||
track.devices.get(0).map(|device|wrap(bg.rgb, fg, device.name()))
|
||||
}))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue