mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
wip: add overlay for help/menu modals
This commit is contained in:
parent
fa2e08e81c
commit
38fb348d19
10 changed files with 323 additions and 234 deletions
|
|
@ -2,9 +2,17 @@ use crate::*;
|
|||
pub(crate) use std::fmt::Write;
|
||||
pub(crate) use ::tengri::tui::ratatui::prelude::Position;
|
||||
|
||||
view!(TuiOut: |self: Tek| self.size.of(View(self, self.view)); {
|
||||
view!(TuiOut: |self: Tek| {
|
||||
self.size.of(View(self, self.view))
|
||||
}; {
|
||||
":nil" =>
|
||||
Box::new("nil"),
|
||||
":modal" =>
|
||||
When::new(self.modal.is_some(), Bsp::b(
|
||||
Fill::xy(Tui::fg_bg(Color::Rgb(64,64,64), Color::Rgb(32,32,32), "")),
|
||||
Fixed::xy(20, 10, Tui::fg_bg(Color::Rgb(255,255,255), Color::Rgb(16,16,16),
|
||||
Outer(true, Style::default().fg(Tui::g(96))).enclose(self.modal)))
|
||||
)).boxed(),
|
||||
":transport" =>
|
||||
self.view_transport().boxed(),
|
||||
":arranger" =>
|
||||
|
|
@ -859,3 +867,23 @@ impl ViewCache {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Content<TuiOut> for Modal {
|
||||
fn content (&self) -> impl Render<TuiOut> {
|
||||
match self {
|
||||
Self::Menu => self.view_menu().boxed(),
|
||||
Self::Help => self.view_help().boxed(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Modal {
|
||||
fn view_menu (&self) -> impl Content<TuiOut> {
|
||||
"menu"
|
||||
}
|
||||
fn view_help (&self) -> impl Content<TuiOut> {
|
||||
Bsp::s(Tui::bold(true, "Help"), Bsp::s("", Map::south(1,
|
||||
||0..5,
|
||||
|binding, _|Bsp::e(" key ", " command "))))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue