mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-11-21 02:20:48 +08:00
patch: Remove legacy tui-realm commands
This commit is contained in:
+4
-38
@@ -1,11 +1,7 @@
|
||||
#[path = "patch/common.rs"]
|
||||
mod common;
|
||||
#[cfg(feature = "flux")]
|
||||
#[path = "patch/flux.rs"]
|
||||
mod flux;
|
||||
#[cfg(feature = "realm")]
|
||||
#[path = "patch/realm.rs"]
|
||||
mod realm;
|
||||
#[path = "patch/select.rs"]
|
||||
mod select;
|
||||
|
||||
use std::ffi::OsString;
|
||||
|
||||
@@ -148,36 +144,6 @@ impl Args for Options {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "realm")]
|
||||
pub fn run(options: Options, _ctx: impl terminal::Context) -> anyhow::Result<()> {
|
||||
use tui::common::context;
|
||||
use tui::realm::Window;
|
||||
|
||||
pub const FPS: u64 = 60;
|
||||
let (_, id) = radicle::rad::cwd()
|
||||
.map_err(|_| anyhow!("this command must be run in the context of a project"))?;
|
||||
|
||||
match options.op {
|
||||
Operation::Select { ref opts } => {
|
||||
let profile = terminal::profile()?;
|
||||
let context = context::Context::new(profile, id)?.with_patches();
|
||||
|
||||
log::enable(context.profile(), "patch", "select")?;
|
||||
|
||||
let mut app = realm::select::App::new(context, opts.mode.clone(), opts.filter.clone());
|
||||
let output = Window::default().run(&mut app, 1000 / FPS)?;
|
||||
|
||||
let output = output
|
||||
.map(|o| serde_json::to_string(&o).unwrap_or_default())
|
||||
.unwrap_or_default();
|
||||
|
||||
eprint!("{output}");
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(feature = "flux")]
|
||||
#[tokio::main]
|
||||
pub async fn run(options: Options, _ctx: impl terminal::Context) -> anyhow::Result<()> {
|
||||
@@ -194,13 +160,13 @@ pub async fn run(options: Options, _ctx: impl terminal::Context) -> anyhow::Resu
|
||||
|
||||
log::enable(&profile, "patch", "select")?;
|
||||
|
||||
let context = flux::select::Context {
|
||||
let context = select::Context {
|
||||
profile,
|
||||
repository,
|
||||
mode: opts.mode,
|
||||
filter: opts.filter.clone(),
|
||||
};
|
||||
let output = flux::select::App::new(context).run().await?;
|
||||
let output = select::App::new(context).run().await?;
|
||||
|
||||
let output = output
|
||||
.map(|o| serde_json::to_string(&o).unwrap_or_default())
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
#[path = "flux/select.rs"]
|
||||
pub mod select;
|
||||
@@ -1,6 +0,0 @@
|
||||
#[path = "realm/common.rs"]
|
||||
pub mod common;
|
||||
#[path = "realm/select.rs"]
|
||||
pub mod select;
|
||||
#[path = "realm/suite.rs"]
|
||||
pub mod suite;
|
||||
@@ -1,2 +0,0 @@
|
||||
#[path = "common/ui.rs"]
|
||||
pub mod ui;
|
||||
@@ -1,179 +0,0 @@
|
||||
use radicle::cob::patch::{Patch, PatchId};
|
||||
|
||||
use tuirealm::command::{Cmd, CmdResult};
|
||||
use tuirealm::tui::layout::Rect;
|
||||
use tuirealm::{AttrValue, Attribute, Frame, MockComponent, Props, State};
|
||||
|
||||
use radicle_tui as tui;
|
||||
|
||||
use tui::common::cob::patch::Filter;
|
||||
use tui::common::context::Context;
|
||||
use tui::realm::ui::cob::PatchItem;
|
||||
use tui::realm::ui::theme::{style, Theme};
|
||||
use tui::realm::ui::widget::context::{ContextBar, Progress};
|
||||
use tui::realm::ui::widget::label::{self};
|
||||
use tui::realm::ui::widget::list::{ColumnWidth, Table};
|
||||
use tui::realm::ui::widget::{Widget, WidgetComponent};
|
||||
|
||||
pub struct PatchBrowser {
|
||||
items: Vec<PatchItem>,
|
||||
table: Widget<Table<PatchItem, 8>>,
|
||||
}
|
||||
|
||||
impl PatchBrowser {
|
||||
pub fn new(
|
||||
theme: &Theme,
|
||||
context: &Context,
|
||||
filter: Filter,
|
||||
selected: Option<(PatchId, Patch)>,
|
||||
) -> Self {
|
||||
let header = [
|
||||
label::header(" ● "),
|
||||
label::header("ID"),
|
||||
label::header("Title"),
|
||||
label::header("Author"),
|
||||
label::header("Head"),
|
||||
label::header("+"),
|
||||
label::header("-"),
|
||||
label::header("Updated"),
|
||||
];
|
||||
|
||||
let widths = [
|
||||
ColumnWidth::Fixed(3),
|
||||
ColumnWidth::Fixed(7),
|
||||
ColumnWidth::Grow,
|
||||
ColumnWidth::Fixed(21),
|
||||
ColumnWidth::Fixed(7),
|
||||
ColumnWidth::Fixed(4),
|
||||
ColumnWidth::Fixed(4),
|
||||
ColumnWidth::Fixed(18),
|
||||
];
|
||||
|
||||
let repo = context.repository();
|
||||
let patches = context
|
||||
.patches()
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.iter()
|
||||
.filter(|(_, patch)| filter.matches(context.profile(), patch));
|
||||
|
||||
let mut items = vec![];
|
||||
for (id, patch) in patches {
|
||||
if let Ok(item) = PatchItem::try_from((context.profile(), repo, *id, patch.clone())) {
|
||||
items.push(item);
|
||||
}
|
||||
}
|
||||
|
||||
items.sort_by(|a, b| b.timestamp().cmp(a.timestamp()));
|
||||
items.sort_by(|a, b| a.state().cmp(b.state()));
|
||||
|
||||
let selected = match selected {
|
||||
Some((id, patch)) => {
|
||||
Some(PatchItem::try_from((context.profile(), repo, id, patch)).unwrap())
|
||||
}
|
||||
_ => items.first().cloned(),
|
||||
};
|
||||
|
||||
let table = Widget::new(Table::new(&items, selected, header, widths, theme.clone()));
|
||||
|
||||
Self { items, table }
|
||||
}
|
||||
|
||||
pub fn items(&self) -> &Vec<PatchItem> {
|
||||
&self.items
|
||||
}
|
||||
}
|
||||
|
||||
impl WidgetComponent for PatchBrowser {
|
||||
fn view(&mut self, properties: &Props, frame: &mut Frame, area: Rect) {
|
||||
let focus = properties
|
||||
.get_or(Attribute::Focus, AttrValue::Flag(false))
|
||||
.unwrap_flag();
|
||||
|
||||
self.table.attr(Attribute::Focus, AttrValue::Flag(focus));
|
||||
self.table.view(frame, area);
|
||||
}
|
||||
|
||||
fn state(&self) -> State {
|
||||
self.table.state()
|
||||
}
|
||||
|
||||
fn perform(&mut self, _properties: &Props, cmd: Cmd) -> CmdResult {
|
||||
self.table.perform(cmd)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn browse_context(
|
||||
context: &Context,
|
||||
_theme: &Theme,
|
||||
filter: Filter,
|
||||
progress: Progress,
|
||||
) -> Widget<ContextBar> {
|
||||
use radicle::cob::patch::State;
|
||||
|
||||
let mut draft = 0;
|
||||
let mut open = 0;
|
||||
let mut archived = 0;
|
||||
let mut merged = 0;
|
||||
|
||||
let patches = context
|
||||
.patches()
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.iter()
|
||||
.filter(|(_, patch)| filter.matches(context.profile(), patch));
|
||||
|
||||
for (_, patch) in patches {
|
||||
match patch.state() {
|
||||
State::Draft => draft += 1,
|
||||
State::Open { conflicts: _ } => open += 1,
|
||||
State::Archived => archived += 1,
|
||||
State::Merged {
|
||||
commit: _,
|
||||
revision: _,
|
||||
} => merged += 1,
|
||||
}
|
||||
}
|
||||
|
||||
let context = label::reversable("/").style(style::magenta_reversed());
|
||||
let filter = label::default(&filter.to_string()).style(style::magenta_dim());
|
||||
|
||||
let draft_n = label::default(&format!("{draft}")).style(style::gray_dim());
|
||||
let draft = label::default(" Draft");
|
||||
|
||||
let open_n = label::default(&format!("{open}")).style(style::green());
|
||||
let open = label::default(" Open");
|
||||
|
||||
let archived_n = label::default(&format!("{archived}")).style(style::yellow());
|
||||
let archived = label::default(" Archived");
|
||||
|
||||
let merged_n = label::default(&format!("{merged}")).style(style::cyan());
|
||||
let merged = label::default(" Merged ");
|
||||
|
||||
let progress = label::reversable(&progress.to_string()).style(style::magenta_reversed());
|
||||
|
||||
let spacer = label::default("");
|
||||
let divider = label::default(" | ");
|
||||
|
||||
let context_bar = ContextBar::new(
|
||||
label::group(&[context]),
|
||||
label::group(&[filter]),
|
||||
label::group(&[spacer]),
|
||||
label::group(&[
|
||||
draft_n,
|
||||
draft,
|
||||
divider.clone(),
|
||||
open_n,
|
||||
open,
|
||||
divider.clone(),
|
||||
archived_n,
|
||||
archived,
|
||||
divider,
|
||||
merged_n,
|
||||
merged,
|
||||
]),
|
||||
label::group(&[progress]),
|
||||
);
|
||||
|
||||
Widget::new(context_bar).height(1)
|
||||
}
|
||||
@@ -1,173 +0,0 @@
|
||||
#[path = "select/event.rs"]
|
||||
mod event;
|
||||
#[path = "select/page.rs"]
|
||||
mod page;
|
||||
#[path = "select/ui.rs"]
|
||||
mod ui;
|
||||
|
||||
use std::hash::Hash;
|
||||
|
||||
use anyhow::Result;
|
||||
use radicle::patch::PatchId;
|
||||
|
||||
use tuirealm::application::PollStrategy;
|
||||
use tuirealm::event::Key;
|
||||
use tuirealm::{Application, Frame, NoUserEvent, Sub, SubClause};
|
||||
|
||||
use radicle_tui as tui;
|
||||
|
||||
use tui::common::cob::patch::Filter;
|
||||
use tui::common::context::Context;
|
||||
|
||||
use tui::realm::ui::subscription;
|
||||
use tui::realm::ui::theme::Theme;
|
||||
use tui::realm::{PageStack, Tui};
|
||||
use tui::Exit;
|
||||
|
||||
use page::ListView;
|
||||
|
||||
use super::super::common::Mode;
|
||||
|
||||
type Selection = tui::Selection<PatchId>;
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Clone, Hash)]
|
||||
pub enum ListCid {
|
||||
Header,
|
||||
PatchBrowser,
|
||||
Context,
|
||||
Shortcuts,
|
||||
}
|
||||
|
||||
/// All component ids known to this application.
|
||||
#[derive(Debug, Default, Eq, PartialEq, Clone, Hash)]
|
||||
pub enum Cid {
|
||||
List(ListCid),
|
||||
#[default]
|
||||
GlobalListener,
|
||||
}
|
||||
|
||||
#[derive(Clone, Default, Debug, Eq, PartialEq)]
|
||||
pub enum Message {
|
||||
#[default]
|
||||
Tick,
|
||||
Quit(Option<Selection>),
|
||||
Batch(Vec<Message>),
|
||||
}
|
||||
|
||||
pub struct App {
|
||||
context: Context,
|
||||
pages: PageStack<Cid, Message>,
|
||||
theme: Theme,
|
||||
quit: bool,
|
||||
mode: Mode,
|
||||
filter: Filter,
|
||||
output: Option<Selection>,
|
||||
}
|
||||
|
||||
/// Creates a new application using a tui-realm-application, mounts all
|
||||
/// components and sets focus to a default one.
|
||||
impl App {
|
||||
pub fn new(context: Context, mode: Mode, filter: Filter) -> Self {
|
||||
Self {
|
||||
context,
|
||||
pages: PageStack::default(),
|
||||
theme: Theme::default(),
|
||||
quit: false,
|
||||
mode,
|
||||
filter,
|
||||
output: None,
|
||||
}
|
||||
}
|
||||
|
||||
fn view_list(
|
||||
&mut self,
|
||||
app: &mut Application<Cid, Message, NoUserEvent>,
|
||||
theme: &Theme,
|
||||
) -> Result<()> {
|
||||
let home = Box::new(ListView::new(self.mode.clone(), self.filter.clone()));
|
||||
self.pages.push(home, app, &self.context, theme)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn process(
|
||||
&mut self,
|
||||
app: &mut Application<Cid, Message, NoUserEvent>,
|
||||
message: Message,
|
||||
) -> Result<Option<Message>> {
|
||||
let theme = Theme::default();
|
||||
match message {
|
||||
Message::Batch(messages) => {
|
||||
let mut results = vec![];
|
||||
for message in messages {
|
||||
if let Some(result) = self.process(app, message)? {
|
||||
results.push(result);
|
||||
}
|
||||
}
|
||||
match results.len() {
|
||||
0 => Ok(None),
|
||||
1 => Ok(Some(results[0].to_owned())),
|
||||
_ => Ok(Some(Message::Batch(results))),
|
||||
}
|
||||
}
|
||||
Message::Quit(output) => {
|
||||
self.quit = true;
|
||||
self.output = output;
|
||||
Ok(None)
|
||||
}
|
||||
_ => self
|
||||
.pages
|
||||
.peek_mut()?
|
||||
.update(app, &self.context, &theme, message),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Tui<Cid, Message, Selection> for App {
|
||||
fn init(&mut self, app: &mut Application<Cid, Message, NoUserEvent>) -> Result<()> {
|
||||
self.view_list(app, &self.theme.clone())?;
|
||||
|
||||
// Add global key listener and subscribe to key events
|
||||
let global = tui::realm::ui::global_listener().to_boxed();
|
||||
app.mount(
|
||||
Cid::GlobalListener,
|
||||
global,
|
||||
vec![Sub::new(
|
||||
subscription::quit_clause(Key::Char('q')),
|
||||
SubClause::Always,
|
||||
)],
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn view(&mut self, app: &mut Application<Cid, Message, NoUserEvent>, frame: &mut Frame) {
|
||||
if let Ok(page) = self.pages.peek_mut() {
|
||||
page.view(app, frame);
|
||||
}
|
||||
}
|
||||
|
||||
fn update(&mut self, app: &mut Application<Cid, Message, NoUserEvent>) -> Result<bool> {
|
||||
match app.tick(PollStrategy::Once) {
|
||||
Ok(messages) if !messages.is_empty() => {
|
||||
for message in messages {
|
||||
let mut msg = Some(message);
|
||||
while msg.is_some() {
|
||||
msg = self.process(app, msg.unwrap())?;
|
||||
}
|
||||
}
|
||||
Ok(true)
|
||||
}
|
||||
_ => Ok(false),
|
||||
}
|
||||
}
|
||||
|
||||
fn exit(&self) -> Option<Exit<Selection>> {
|
||||
if self.quit {
|
||||
return Some(Exit {
|
||||
value: self.output.clone(),
|
||||
});
|
||||
}
|
||||
None
|
||||
}
|
||||
}
|
||||
@@ -1,182 +0,0 @@
|
||||
use radicle::patch::PatchId;
|
||||
use tuirealm::command::{Cmd, CmdResult, Direction as MoveDirection};
|
||||
use tuirealm::event::{Event, Key, KeyEvent};
|
||||
use tuirealm::{MockComponent, NoUserEvent};
|
||||
|
||||
use radicle_tui as tui;
|
||||
|
||||
use tui::realm::ui::state::ItemState;
|
||||
use tui::realm::ui::widget::container::{AppHeader, GlobalListener, LabeledContainer};
|
||||
use tui::realm::ui::widget::context::{ContextBar, Shortcuts};
|
||||
use tui::realm::ui::widget::list::PropertyList;
|
||||
use tui::realm::ui::widget::Widget;
|
||||
|
||||
use crate::tui_patch::common::PatchOperation;
|
||||
|
||||
use super::ui::{IdSelect, OperationSelect};
|
||||
use super::Message;
|
||||
|
||||
type Selection = tui::Selection<PatchId>;
|
||||
|
||||
/// Since the framework does not know the type of messages that are being
|
||||
/// passed around in the app, the following handlers need to be implemented for
|
||||
/// each component used.
|
||||
///
|
||||
/// TODO: should handle `Event::WindowResize`, which is not emitted by `termion`.
|
||||
impl tuirealm::Component<Message, NoUserEvent> for Widget<GlobalListener> {
|
||||
fn on(&mut self, event: Event<NoUserEvent>) -> Option<Message> {
|
||||
match event {
|
||||
Event::Keyboard(KeyEvent {
|
||||
code: Key::Char('q'),
|
||||
..
|
||||
}) => Some(Message::Quit(None)),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl tuirealm::Component<Message, NoUserEvent> for Widget<IdSelect> {
|
||||
fn on(&mut self, event: Event<NoUserEvent>) -> Option<Message> {
|
||||
let mut submit = || -> Option<radicle::cob::patch::PatchId> {
|
||||
match self.perform(Cmd::Submit) {
|
||||
CmdResult::Submit(state) => {
|
||||
let selected = ItemState::try_from(state).ok()?.selected()?;
|
||||
let item = self.items().get(selected)?;
|
||||
Some(item.id().to_owned())
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
};
|
||||
|
||||
match event {
|
||||
Event::Keyboard(KeyEvent { code: Key::Up, .. })
|
||||
| Event::Keyboard(KeyEvent {
|
||||
code: Key::Char('k'),
|
||||
..
|
||||
}) => {
|
||||
self.perform(Cmd::Move(MoveDirection::Up));
|
||||
Some(Message::Tick)
|
||||
}
|
||||
Event::Keyboard(KeyEvent {
|
||||
code: Key::Down, ..
|
||||
})
|
||||
| Event::Keyboard(KeyEvent {
|
||||
code: Key::Char('j'),
|
||||
..
|
||||
}) => {
|
||||
self.perform(Cmd::Move(MoveDirection::Down));
|
||||
Some(Message::Tick)
|
||||
}
|
||||
Event::Keyboard(KeyEvent {
|
||||
code: Key::Enter, ..
|
||||
}) => submit().map(|id| {
|
||||
let selection = Selection {
|
||||
operation: None,
|
||||
ids: vec![id],
|
||||
args: vec![],
|
||||
};
|
||||
Message::Quit(Some(selection))
|
||||
}),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl tuirealm::Component<Message, NoUserEvent> for Widget<OperationSelect> {
|
||||
fn on(&mut self, event: Event<NoUserEvent>) -> Option<Message> {
|
||||
let mut submit = || -> Option<radicle::cob::patch::PatchId> {
|
||||
match self.perform(Cmd::Submit) {
|
||||
CmdResult::Submit(state) => {
|
||||
let selected = ItemState::try_from(state).ok()?.selected()?;
|
||||
let item = self.items().get(selected)?;
|
||||
Some(item.id().to_owned())
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
};
|
||||
|
||||
match event {
|
||||
Event::Keyboard(KeyEvent { code: Key::Up, .. })
|
||||
| Event::Keyboard(KeyEvent {
|
||||
code: Key::Char('k'),
|
||||
..
|
||||
}) => {
|
||||
self.perform(Cmd::Move(MoveDirection::Up));
|
||||
Some(Message::Tick)
|
||||
}
|
||||
Event::Keyboard(KeyEvent {
|
||||
code: Key::Down, ..
|
||||
})
|
||||
| Event::Keyboard(KeyEvent {
|
||||
code: Key::Char('j'),
|
||||
..
|
||||
}) => {
|
||||
self.perform(Cmd::Move(MoveDirection::Down));
|
||||
Some(Message::Tick)
|
||||
}
|
||||
Event::Keyboard(KeyEvent {
|
||||
code: Key::Enter, ..
|
||||
}) => submit().map(|id| {
|
||||
let selection = Selection {
|
||||
operation: Some(PatchOperation::Show.to_string()),
|
||||
ids: vec![id],
|
||||
args: vec![],
|
||||
};
|
||||
Message::Quit(Some(selection))
|
||||
}),
|
||||
Event::Keyboard(KeyEvent {
|
||||
code: Key::Char('c'),
|
||||
..
|
||||
}) => submit().map(|id| {
|
||||
let selection = Selection {
|
||||
operation: Some(PatchOperation::Checkout.to_string()),
|
||||
ids: vec![id],
|
||||
args: vec![],
|
||||
};
|
||||
Message::Quit(Some(selection))
|
||||
}),
|
||||
Event::Keyboard(KeyEvent {
|
||||
code: Key::Char('d'),
|
||||
..
|
||||
}) => submit().map(|id| {
|
||||
let selection = Selection {
|
||||
operation: Some(PatchOperation::Diff.to_string()),
|
||||
ids: vec![id],
|
||||
args: vec![],
|
||||
};
|
||||
Message::Quit(Some(selection))
|
||||
}),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl tuirealm::Component<Message, NoUserEvent> for Widget<AppHeader> {
|
||||
fn on(&mut self, _event: Event<NoUserEvent>) -> Option<Message> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
impl tuirealm::Component<Message, NoUserEvent> for Widget<LabeledContainer> {
|
||||
fn on(&mut self, _event: Event<NoUserEvent>) -> Option<Message> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
impl tuirealm::Component<Message, NoUserEvent> for Widget<PropertyList> {
|
||||
fn on(&mut self, _event: Event<NoUserEvent>) -> Option<Message> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
impl tuirealm::Component<Message, NoUserEvent> for Widget<ContextBar> {
|
||||
fn on(&mut self, _event: Event<NoUserEvent>) -> Option<Message> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
impl tuirealm::Component<Message, NoUserEvent> for Widget<Shortcuts> {
|
||||
fn on(&mut self, _event: Event<NoUserEvent>) -> Option<Message> {
|
||||
None
|
||||
}
|
||||
}
|
||||
@@ -1,177 +0,0 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
use tuirealm::{AttrValue, Attribute, Frame, NoUserEvent, Sub, SubClause};
|
||||
|
||||
use radicle_tui as tui;
|
||||
|
||||
use tui::common::cob::patch::Filter;
|
||||
use tui::common::context::Context;
|
||||
use tui::realm::ui::state::ItemState;
|
||||
use tui::realm::ui::theme::Theme;
|
||||
use tui::realm::ui::widget::context::{Progress, Shortcuts};
|
||||
use tui::realm::ui::widget::Widget;
|
||||
use tui::realm::ui::{layout, subscription};
|
||||
use tui::realm::ViewPage;
|
||||
|
||||
use super::super::common;
|
||||
use super::{ui, Application, Cid, ListCid, Message, Mode};
|
||||
|
||||
///
|
||||
/// Home
|
||||
///
|
||||
pub struct ListView {
|
||||
active_component: ListCid,
|
||||
subject: Mode,
|
||||
filter: Filter,
|
||||
shortcuts: HashMap<ListCid, Widget<Shortcuts>>,
|
||||
}
|
||||
|
||||
impl ListView {
|
||||
pub fn new(subject: Mode, filter: Filter) -> Self {
|
||||
Self {
|
||||
active_component: ListCid::PatchBrowser,
|
||||
subject,
|
||||
filter,
|
||||
shortcuts: HashMap::default(),
|
||||
}
|
||||
}
|
||||
|
||||
fn update_context(
|
||||
&self,
|
||||
app: &mut Application<Cid, Message, NoUserEvent>,
|
||||
context: &Context,
|
||||
theme: &Theme,
|
||||
) -> Result<()> {
|
||||
let state = app.state(&Cid::List(ListCid::PatchBrowser))?;
|
||||
let progress = match ItemState::try_from(state) {
|
||||
Ok(state) => Progress::Step(
|
||||
state
|
||||
.selected()
|
||||
.map(|s| s.saturating_add(1))
|
||||
.unwrap_or_default(),
|
||||
state.len(),
|
||||
),
|
||||
Err(_) => Progress::None,
|
||||
};
|
||||
|
||||
let context = common::ui::browse_context(context, theme, self.filter.clone(), progress);
|
||||
|
||||
app.remount(Cid::List(ListCid::Context), context.to_boxed(), vec![])?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn update_shortcuts(
|
||||
&self,
|
||||
app: &mut Application<Cid, Message, NoUserEvent>,
|
||||
cid: ListCid,
|
||||
) -> Result<()> {
|
||||
if let Some(shortcuts) = self.shortcuts.get(&cid) {
|
||||
app.remount(
|
||||
Cid::List(ListCid::Shortcuts),
|
||||
shortcuts.clone().to_boxed(),
|
||||
vec![],
|
||||
)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl ViewPage<Cid, Message> for ListView {
|
||||
fn mount(
|
||||
&mut self,
|
||||
app: &mut Application<Cid, Message, NoUserEvent>,
|
||||
context: &Context,
|
||||
theme: &Theme,
|
||||
) -> Result<()> {
|
||||
let navigation = ui::list_navigation(theme);
|
||||
let header = tui::realm::ui::app_header(context, theme, Some(navigation)).to_boxed();
|
||||
|
||||
app.remount(Cid::List(ListCid::Header), header, vec![])?;
|
||||
|
||||
match self.subject {
|
||||
Mode::Id => {
|
||||
let patch_browser =
|
||||
ui::id_select(theme, context, self.filter.clone(), None).to_boxed();
|
||||
self.shortcuts = patch_browser.as_ref().shortcuts();
|
||||
|
||||
app.remount(Cid::List(ListCid::PatchBrowser), patch_browser, vec![])?;
|
||||
}
|
||||
Mode::Operation => {
|
||||
let patch_browser =
|
||||
ui::operation_select(theme, context, self.filter.clone(), None).to_boxed();
|
||||
self.shortcuts = patch_browser.as_ref().shortcuts();
|
||||
|
||||
app.remount(Cid::List(ListCid::PatchBrowser), patch_browser, vec![])?;
|
||||
}
|
||||
};
|
||||
|
||||
app.active(&Cid::List(self.active_component.clone()))?;
|
||||
self.update_shortcuts(app, self.active_component.clone())?;
|
||||
self.update_context(app, context, theme)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn unmount(&self, app: &mut Application<Cid, Message, NoUserEvent>) -> Result<()> {
|
||||
app.umount(&Cid::List(ListCid::Header))?;
|
||||
app.umount(&Cid::List(ListCid::PatchBrowser))?;
|
||||
app.umount(&Cid::List(ListCid::Context))?;
|
||||
app.umount(&Cid::List(ListCid::Shortcuts))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn update(
|
||||
&mut self,
|
||||
app: &mut Application<Cid, Message, NoUserEvent>,
|
||||
context: &Context,
|
||||
theme: &Theme,
|
||||
_message: Message,
|
||||
) -> Result<Option<Message>> {
|
||||
self.update_context(app, context, theme)?;
|
||||
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
fn view(&mut self, app: &mut Application<Cid, Message, NoUserEvent>, frame: &mut Frame) {
|
||||
let area = frame.size();
|
||||
let context_h = app
|
||||
.query(&Cid::List(ListCid::Context), Attribute::Height)
|
||||
.unwrap_or_default()
|
||||
.unwrap_or(AttrValue::Size(0))
|
||||
.unwrap_size();
|
||||
let shortcuts_h = 1u16;
|
||||
|
||||
let layout = layout::default_page(area, context_h, shortcuts_h);
|
||||
|
||||
app.view(
|
||||
&Cid::List(self.active_component.clone()),
|
||||
frame,
|
||||
layout.component,
|
||||
);
|
||||
|
||||
app.view(&Cid::List(ListCid::Context), frame, layout.context);
|
||||
app.view(&Cid::List(ListCid::Shortcuts), frame, layout.shortcuts);
|
||||
}
|
||||
|
||||
fn subscribe(&self, app: &mut Application<Cid, Message, NoUserEvent>) -> Result<()> {
|
||||
app.subscribe(
|
||||
&Cid::List(ListCid::Header),
|
||||
Sub::new(subscription::navigation_clause(), SubClause::Always),
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn unsubscribe(&self, app: &mut Application<Cid, Message, NoUserEvent>) -> Result<()> {
|
||||
app.unsubscribe(
|
||||
&Cid::List(ListCid::Header),
|
||||
subscription::navigation_clause(),
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -1,156 +0,0 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use radicle::cob::patch::{Patch, PatchId};
|
||||
|
||||
use radicle_tui as tui;
|
||||
|
||||
use tui::common::cob::patch::Filter;
|
||||
use tui::common::context::Context;
|
||||
use tui::realm::ui::cob::PatchItem;
|
||||
use tui::realm::ui::theme::{style, Theme};
|
||||
use tui::realm::ui::widget::context::Shortcuts;
|
||||
use tui::realm::ui::widget::{Widget, WidgetComponent};
|
||||
|
||||
use tui::realm::ui::widget::container::Tabs;
|
||||
use tui::realm::ui::widget::label::{self};
|
||||
use tuirealm::command::{Cmd, CmdResult};
|
||||
use tuirealm::tui::layout::Rect;
|
||||
use tuirealm::{AttrValue, Attribute, Frame, MockComponent, Props, State};
|
||||
|
||||
use super::super::common;
|
||||
use super::ListCid;
|
||||
|
||||
pub struct IdSelect {
|
||||
theme: Theme,
|
||||
browser: Widget<common::ui::PatchBrowser>,
|
||||
}
|
||||
|
||||
impl IdSelect {
|
||||
pub fn new(theme: Theme, browser: Widget<common::ui::PatchBrowser>) -> Self {
|
||||
Self { theme, browser }
|
||||
}
|
||||
|
||||
pub fn items(&self) -> &Vec<PatchItem> {
|
||||
self.browser.items()
|
||||
}
|
||||
|
||||
pub fn shortcuts(&self) -> HashMap<ListCid, Widget<Shortcuts>> {
|
||||
[(
|
||||
ListCid::PatchBrowser,
|
||||
tui::realm::ui::shortcuts(
|
||||
&self.theme,
|
||||
vec![
|
||||
tui::realm::ui::shortcut(&self.theme, "enter", "select"),
|
||||
tui::realm::ui::shortcut(&self.theme, "q", "quit"),
|
||||
],
|
||||
),
|
||||
)]
|
||||
.iter()
|
||||
.cloned()
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
impl WidgetComponent for IdSelect {
|
||||
fn view(&mut self, properties: &Props, frame: &mut Frame, area: Rect) {
|
||||
let focus = properties
|
||||
.get_or(Attribute::Focus, AttrValue::Flag(false))
|
||||
.unwrap_flag();
|
||||
|
||||
self.browser.attr(Attribute::Focus, AttrValue::Flag(focus));
|
||||
self.browser.view(frame, area);
|
||||
}
|
||||
|
||||
fn state(&self) -> State {
|
||||
self.browser.state()
|
||||
}
|
||||
|
||||
fn perform(&mut self, _properties: &Props, cmd: Cmd) -> CmdResult {
|
||||
self.browser.perform(cmd)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct OperationSelect {
|
||||
theme: Theme,
|
||||
browser: Widget<common::ui::PatchBrowser>,
|
||||
}
|
||||
|
||||
impl OperationSelect {
|
||||
pub fn new(theme: Theme, browser: Widget<common::ui::PatchBrowser>) -> Self {
|
||||
Self { theme, browser }
|
||||
}
|
||||
|
||||
pub fn items(&self) -> &Vec<PatchItem> {
|
||||
self.browser.items()
|
||||
}
|
||||
|
||||
pub fn shortcuts(&self) -> HashMap<ListCid, Widget<Shortcuts>> {
|
||||
[(
|
||||
ListCid::PatchBrowser,
|
||||
tui::realm::ui::shortcuts(
|
||||
&self.theme,
|
||||
vec![
|
||||
tui::realm::ui::shortcut(&self.theme, "enter", "show"),
|
||||
tui::realm::ui::shortcut(&self.theme, "c", "checkout"),
|
||||
tui::realm::ui::shortcut(&self.theme, "d", "diff"),
|
||||
tui::realm::ui::shortcut(&self.theme, "q", "quit"),
|
||||
],
|
||||
),
|
||||
)]
|
||||
.iter()
|
||||
.cloned()
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
impl WidgetComponent for OperationSelect {
|
||||
fn view(&mut self, properties: &Props, frame: &mut Frame, area: Rect) {
|
||||
let focus = properties
|
||||
.get_or(Attribute::Focus, AttrValue::Flag(false))
|
||||
.unwrap_flag();
|
||||
|
||||
self.browser.attr(Attribute::Focus, AttrValue::Flag(focus));
|
||||
self.browser.view(frame, area);
|
||||
}
|
||||
|
||||
fn state(&self) -> State {
|
||||
self.browser.state()
|
||||
}
|
||||
|
||||
fn perform(&mut self, _properties: &Props, cmd: Cmd) -> CmdResult {
|
||||
self.browser.perform(cmd)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn list_navigation(theme: &Theme) -> Widget<Tabs> {
|
||||
tui::realm::ui::tabs(
|
||||
theme,
|
||||
vec![label::reversable("Patches").style(style::cyan())],
|
||||
)
|
||||
}
|
||||
|
||||
pub fn id_select(
|
||||
theme: &Theme,
|
||||
context: &Context,
|
||||
filter: Filter,
|
||||
selected: Option<(PatchId, Patch)>,
|
||||
) -> Widget<IdSelect> {
|
||||
let browser = Widget::new(common::ui::PatchBrowser::new(
|
||||
theme, context, filter, selected,
|
||||
));
|
||||
|
||||
Widget::new(IdSelect::new(theme.clone(), browser))
|
||||
}
|
||||
|
||||
pub fn operation_select(
|
||||
theme: &Theme,
|
||||
context: &Context,
|
||||
filter: Filter,
|
||||
selected: Option<(PatchId, Patch)>,
|
||||
) -> Widget<OperationSelect> {
|
||||
let browser = Widget::new(common::ui::PatchBrowser::new(
|
||||
theme, context, filter, selected,
|
||||
));
|
||||
|
||||
Widget::new(OperationSelect::new(theme.clone(), browser))
|
||||
}
|
||||
@@ -1,289 +0,0 @@
|
||||
#[path = "suite/event.rs"]
|
||||
mod event;
|
||||
#[path = "suite/page.rs"]
|
||||
mod page;
|
||||
#[path = "suite/ui.rs"]
|
||||
mod ui;
|
||||
|
||||
use std::hash::Hash;
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
use radicle::cob::patch::PatchId;
|
||||
|
||||
use tuirealm::application::PollStrategy;
|
||||
use tuirealm::event::Key;
|
||||
use tuirealm::{Application, Frame, NoUserEvent, Sub, SubClause};
|
||||
|
||||
use radicle_tui as tui;
|
||||
|
||||
use tui::common::cob;
|
||||
use tui::common::cob::patch::Filter;
|
||||
use tui::common::context::Context;
|
||||
use tui::realm::ui::subscription;
|
||||
use tui::realm::ui::theme::Theme;
|
||||
use tui::realm::{PageStack, Tui};
|
||||
use tui::Exit;
|
||||
|
||||
use page::{ListView, PatchView};
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Clone, Hash)]
|
||||
pub enum ListCid {
|
||||
Header,
|
||||
PatchBrowser,
|
||||
Context,
|
||||
Shortcuts,
|
||||
}
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Clone, Hash)]
|
||||
pub enum PatchCid {
|
||||
Header,
|
||||
Activity,
|
||||
Files,
|
||||
Context,
|
||||
Shortcuts,
|
||||
}
|
||||
|
||||
/// All component ids known to this application.
|
||||
#[derive(Debug, Default, Eq, PartialEq, Clone, Hash)]
|
||||
pub enum Cid {
|
||||
List(ListCid),
|
||||
Patch(PatchCid),
|
||||
#[default]
|
||||
GlobalListener,
|
||||
Popup,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub enum PatchMessage {
|
||||
Show(PatchId),
|
||||
Leave,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub enum PopupMessage {
|
||||
Info(String),
|
||||
Warning(String),
|
||||
Error(String),
|
||||
Hide,
|
||||
}
|
||||
|
||||
#[derive(Clone, Default, Debug, Eq, PartialEq)]
|
||||
pub enum Message {
|
||||
Patch(PatchMessage),
|
||||
NavigationChanged(u16),
|
||||
FormSubmitted(String),
|
||||
Popup(PopupMessage),
|
||||
#[default]
|
||||
Tick,
|
||||
Quit,
|
||||
Batch(Vec<Message>),
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub struct App {
|
||||
context: Context,
|
||||
pages: PageStack<Cid, Message>,
|
||||
theme: Theme,
|
||||
filter: Filter,
|
||||
quit: bool,
|
||||
}
|
||||
|
||||
/// Creates a new application using a tui-realm-application, mounts all
|
||||
/// components and sets focus to a default one.
|
||||
#[allow(dead_code)]
|
||||
impl App {
|
||||
pub fn new(context: Context, filter: Filter) -> Self {
|
||||
Self {
|
||||
context,
|
||||
pages: PageStack::default(),
|
||||
theme: Theme::default(),
|
||||
filter,
|
||||
quit: false,
|
||||
}
|
||||
}
|
||||
|
||||
fn view_list(
|
||||
&mut self,
|
||||
app: &mut Application<Cid, Message, NoUserEvent>,
|
||||
theme: &Theme,
|
||||
) -> Result<()> {
|
||||
let home = Box::new(ListView::new(theme.clone(), self.filter.clone()));
|
||||
self.pages.push(home, app, &self.context, theme)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn view_patch(
|
||||
&mut self,
|
||||
app: &mut Application<Cid, Message, NoUserEvent>,
|
||||
id: PatchId,
|
||||
theme: &Theme,
|
||||
) -> Result<()> {
|
||||
let profile = self.context.profile();
|
||||
let repo = self.context.repository();
|
||||
|
||||
if let Some(patch) = cob::patch::find(profile, repo, &id)? {
|
||||
let view = Box::new(PatchView::new(theme.clone(), (id, patch)));
|
||||
self.pages.push(view, app, &self.context, theme)?;
|
||||
|
||||
Ok(())
|
||||
} else {
|
||||
Err(anyhow::anyhow!(
|
||||
"Could not mount 'page::PatchView'. Patch not found."
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn process(
|
||||
&mut self,
|
||||
app: &mut Application<Cid, Message, NoUserEvent>,
|
||||
message: Message,
|
||||
) -> Result<Option<Message>> {
|
||||
let theme = Theme::default();
|
||||
match message {
|
||||
Message::Batch(messages) => {
|
||||
let mut results = vec![];
|
||||
for message in messages {
|
||||
if let Some(result) = self.process(app, message)? {
|
||||
results.push(result);
|
||||
}
|
||||
}
|
||||
match results.len() {
|
||||
0 => Ok(None),
|
||||
1 => Ok(Some(results[0].to_owned())),
|
||||
_ => Ok(Some(Message::Batch(results))),
|
||||
}
|
||||
}
|
||||
Message::Patch(PatchMessage::Show(id)) => {
|
||||
self.view_patch(app, id, &theme)?;
|
||||
Ok(None)
|
||||
}
|
||||
Message::Patch(PatchMessage::Leave) => {
|
||||
self.pages.pop(app)?;
|
||||
Ok(None)
|
||||
}
|
||||
Message::Popup(PopupMessage::Info(info)) => {
|
||||
self.show_info_popup(app, &theme, &info)?;
|
||||
Ok(None)
|
||||
}
|
||||
Message::Popup(PopupMessage::Warning(warning)) => {
|
||||
self.show_warning_popup(app, &theme, &warning)?;
|
||||
Ok(None)
|
||||
}
|
||||
Message::Popup(PopupMessage::Error(error)) => {
|
||||
self.show_error_popup(app, &theme, &error)?;
|
||||
Ok(None)
|
||||
}
|
||||
Message::Popup(PopupMessage::Hide) => {
|
||||
self.hide_popup(app)?;
|
||||
Ok(None)
|
||||
}
|
||||
Message::Quit => {
|
||||
self.quit = true;
|
||||
Ok(None)
|
||||
}
|
||||
_ => self
|
||||
.pages
|
||||
.peek_mut()?
|
||||
.update(app, &self.context, &theme, message),
|
||||
}
|
||||
}
|
||||
|
||||
fn show_info_popup(
|
||||
&mut self,
|
||||
app: &mut Application<Cid, Message, NoUserEvent>,
|
||||
theme: &Theme,
|
||||
message: &str,
|
||||
) -> Result<()> {
|
||||
let popup = tui::realm::ui::info(theme, message);
|
||||
app.remount(Cid::Popup, popup.to_boxed(), vec![])?;
|
||||
app.active(&Cid::Popup)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn show_warning_popup(
|
||||
&mut self,
|
||||
app: &mut Application<Cid, Message, NoUserEvent>,
|
||||
theme: &Theme,
|
||||
message: &str,
|
||||
) -> Result<()> {
|
||||
let popup = tui::realm::ui::warning(theme, message);
|
||||
app.remount(Cid::Popup, popup.to_boxed(), vec![])?;
|
||||
app.active(&Cid::Popup)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn show_error_popup(
|
||||
&mut self,
|
||||
app: &mut Application<Cid, Message, NoUserEvent>,
|
||||
theme: &Theme,
|
||||
message: &str,
|
||||
) -> Result<()> {
|
||||
let popup = tui::realm::ui::error(theme, message);
|
||||
app.remount(Cid::Popup, popup.to_boxed(), vec![])?;
|
||||
app.active(&Cid::Popup)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn hide_popup(&mut self, app: &mut Application<Cid, Message, NoUserEvent>) -> Result<()> {
|
||||
app.blur()?;
|
||||
app.umount(&Cid::Popup)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Tui<Cid, Message, ()> for App {
|
||||
fn init(&mut self, app: &mut Application<Cid, Message, NoUserEvent>) -> Result<()> {
|
||||
self.view_list(app, &self.theme.clone())?;
|
||||
|
||||
// Add global key listener and subscribe to key events
|
||||
let global = tui::realm::ui::global_listener().to_boxed();
|
||||
app.mount(
|
||||
Cid::GlobalListener,
|
||||
global,
|
||||
vec![Sub::new(
|
||||
subscription::quit_clause(Key::Char('q')),
|
||||
SubClause::Always,
|
||||
)],
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn view(&mut self, app: &mut Application<Cid, Message, NoUserEvent>, frame: &mut Frame) {
|
||||
if let Ok(page) = self.pages.peek_mut() {
|
||||
page.view(app, frame);
|
||||
}
|
||||
|
||||
if app.mounted(&Cid::Popup) {
|
||||
app.view(&Cid::Popup, frame, frame.size());
|
||||
}
|
||||
}
|
||||
|
||||
fn update(&mut self, app: &mut Application<Cid, Message, NoUserEvent>) -> Result<bool> {
|
||||
match app.tick(PollStrategy::Once) {
|
||||
Ok(messages) if !messages.is_empty() => {
|
||||
for message in messages {
|
||||
let mut msg = Some(message);
|
||||
while msg.is_some() {
|
||||
msg = self.process(app, msg.unwrap())?;
|
||||
}
|
||||
}
|
||||
Ok(true)
|
||||
}
|
||||
_ => Ok(false),
|
||||
}
|
||||
}
|
||||
|
||||
fn exit(&self) -> Option<Exit<()>> {
|
||||
if self.quit {
|
||||
return Some(Exit { value: None });
|
||||
}
|
||||
None
|
||||
}
|
||||
}
|
||||
@@ -1,140 +0,0 @@
|
||||
use tuirealm::command::{Cmd, CmdResult, Direction as MoveDirection};
|
||||
use tuirealm::event::{Event, Key, KeyEvent};
|
||||
use tuirealm::{MockComponent, NoUserEvent, State, StateValue};
|
||||
|
||||
use radicle_tui::realm::ui::state::ItemState;
|
||||
use radicle_tui::realm::ui::widget::container::{
|
||||
AppHeader, GlobalListener, LabeledContainer, Popup,
|
||||
};
|
||||
use radicle_tui::realm::ui::widget::context::{ContextBar, Shortcuts};
|
||||
use radicle_tui::realm::ui::widget::list::PropertyList;
|
||||
use radicle_tui::realm::ui::widget::Widget;
|
||||
|
||||
use super::super::common;
|
||||
use super::{ui, Message, PatchMessage, PopupMessage};
|
||||
|
||||
/// Since the framework does not know the type of messages that are being
|
||||
/// passed around in the app, the following handlers need to be implemented for
|
||||
/// each component used.
|
||||
///
|
||||
/// TODO: should handle `Event::WindowResize`, which is not emitted by `termion`.
|
||||
impl tuirealm::Component<Message, NoUserEvent> for Widget<GlobalListener> {
|
||||
fn on(&mut self, event: Event<NoUserEvent>) -> Option<Message> {
|
||||
match event {
|
||||
Event::Keyboard(KeyEvent {
|
||||
code: Key::Char('q'),
|
||||
..
|
||||
}) => Some(Message::Quit),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl tuirealm::Component<Message, NoUserEvent> for Widget<AppHeader> {
|
||||
fn on(&mut self, event: Event<NoUserEvent>) -> Option<Message> {
|
||||
match event {
|
||||
Event::Keyboard(KeyEvent { code: Key::Tab, .. }) => {
|
||||
match self.perform(Cmd::Move(MoveDirection::Right)) {
|
||||
CmdResult::Changed(State::One(StateValue::U16(index))) => {
|
||||
Some(Message::NavigationChanged(index))
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl tuirealm::Component<Message, NoUserEvent> for Widget<common::ui::PatchBrowser> {
|
||||
fn on(&mut self, event: Event<NoUserEvent>) -> Option<Message> {
|
||||
match event {
|
||||
Event::Keyboard(KeyEvent { code: Key::Up, .. })
|
||||
| Event::Keyboard(KeyEvent {
|
||||
code: Key::Char('k'),
|
||||
..
|
||||
}) => {
|
||||
self.perform(Cmd::Move(MoveDirection::Up));
|
||||
Some(Message::Tick)
|
||||
}
|
||||
Event::Keyboard(KeyEvent {
|
||||
code: Key::Down, ..
|
||||
})
|
||||
| Event::Keyboard(KeyEvent {
|
||||
code: Key::Char('j'),
|
||||
..
|
||||
}) => {
|
||||
self.perform(Cmd::Move(MoveDirection::Down));
|
||||
Some(Message::Tick)
|
||||
}
|
||||
Event::Keyboard(KeyEvent {
|
||||
code: Key::Enter, ..
|
||||
}) => match self.perform(Cmd::Submit) {
|
||||
CmdResult::Submit(state) => {
|
||||
let selected = ItemState::try_from(state).ok()?.selected()?;
|
||||
let item = self.items().get(selected)?;
|
||||
Some(Message::Patch(PatchMessage::Show(item.id().to_owned())))
|
||||
}
|
||||
_ => None,
|
||||
},
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl tuirealm::Component<Message, NoUserEvent> for Widget<ui::Activity> {
|
||||
fn on(&mut self, event: Event<NoUserEvent>) -> Option<Message> {
|
||||
match event {
|
||||
Event::Keyboard(KeyEvent { code: Key::Esc, .. }) => {
|
||||
Some(Message::Patch(PatchMessage::Leave))
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl tuirealm::Component<Message, NoUserEvent> for Widget<ui::Files> {
|
||||
fn on(&mut self, event: Event<NoUserEvent>) -> Option<Message> {
|
||||
match event {
|
||||
Event::Keyboard(KeyEvent { code: Key::Esc, .. }) => {
|
||||
Some(Message::Patch(PatchMessage::Leave))
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl tuirealm::Component<Message, NoUserEvent> for Widget<Popup> {
|
||||
fn on(&mut self, event: Event<NoUserEvent>) -> Option<Message> {
|
||||
match event {
|
||||
Event::Keyboard(KeyEvent { code: Key::Esc, .. }) => {
|
||||
Some(Message::Popup(PopupMessage::Hide))
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl tuirealm::Component<Message, NoUserEvent> for Widget<LabeledContainer> {
|
||||
fn on(&mut self, _event: Event<NoUserEvent>) -> Option<Message> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
impl tuirealm::Component<Message, NoUserEvent> for Widget<PropertyList> {
|
||||
fn on(&mut self, _event: Event<NoUserEvent>) -> Option<Message> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
impl tuirealm::Component<Message, NoUserEvent> for Widget<ContextBar> {
|
||||
fn on(&mut self, _event: Event<NoUserEvent>) -> Option<Message> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
impl tuirealm::Component<Message, NoUserEvent> for Widget<Shortcuts> {
|
||||
fn on(&mut self, _event: Event<NoUserEvent>) -> Option<Message> {
|
||||
None
|
||||
}
|
||||
}
|
||||
@@ -1,346 +0,0 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
use radicle::cob::patch::{Patch, PatchId};
|
||||
|
||||
use tuirealm::{AttrValue, Attribute, Frame, NoUserEvent, Sub, SubClause};
|
||||
|
||||
use radicle_tui as tui;
|
||||
|
||||
use tui::common::cob::patch::Filter;
|
||||
use tui::common::context::Context;
|
||||
use tui::realm::ui::state::ItemState;
|
||||
use tui::realm::ui::theme::Theme;
|
||||
use tui::realm::ui::widget::context::{Progress, Shortcuts};
|
||||
use tui::realm::ui::widget::Widget;
|
||||
use tui::realm::ui::{layout, subscription};
|
||||
use tui::realm::ViewPage;
|
||||
|
||||
use super::{ui, Application, Cid, ListCid, Message, PatchCid};
|
||||
|
||||
///
|
||||
/// Home
|
||||
///
|
||||
pub struct ListView {
|
||||
active_component: ListCid,
|
||||
shortcuts: HashMap<ListCid, Widget<Shortcuts>>,
|
||||
filter: Filter,
|
||||
}
|
||||
|
||||
impl ListView {
|
||||
pub fn new(theme: Theme, filter: Filter) -> Self {
|
||||
let shortcuts = Self::build_shortcuts(&theme);
|
||||
Self {
|
||||
active_component: ListCid::PatchBrowser,
|
||||
shortcuts,
|
||||
filter,
|
||||
}
|
||||
}
|
||||
|
||||
fn build_shortcuts(theme: &Theme) -> HashMap<ListCid, Widget<Shortcuts>> {
|
||||
[(
|
||||
ListCid::PatchBrowser,
|
||||
tui::realm::ui::shortcuts(
|
||||
theme,
|
||||
vec![
|
||||
tui::realm::ui::shortcut(theme, "tab", "section"),
|
||||
tui::realm::ui::shortcut(theme, "↑/↓", "navigate"),
|
||||
tui::realm::ui::shortcut(theme, "enter", "show"),
|
||||
tui::realm::ui::shortcut(theme, "q", "quit"),
|
||||
],
|
||||
),
|
||||
)]
|
||||
.iter()
|
||||
.cloned()
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn update_context(
|
||||
&self,
|
||||
app: &mut Application<Cid, Message, NoUserEvent>,
|
||||
context: &Context,
|
||||
theme: &Theme,
|
||||
) -> Result<()> {
|
||||
let state = app.state(&Cid::List(ListCid::PatchBrowser))?;
|
||||
let progress = match ItemState::try_from(state) {
|
||||
Ok(state) => Progress::Step(
|
||||
state
|
||||
.selected()
|
||||
.map(|s| s.saturating_add(1))
|
||||
.unwrap_or_default(),
|
||||
state.len(),
|
||||
),
|
||||
Err(_) => Progress::None,
|
||||
};
|
||||
let context = ui::browse_context(context, theme, progress);
|
||||
|
||||
app.remount(Cid::List(ListCid::Context), context.to_boxed(), vec![])?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn update_shortcuts(
|
||||
&self,
|
||||
app: &mut Application<Cid, Message, NoUserEvent>,
|
||||
cid: ListCid,
|
||||
) -> Result<()> {
|
||||
if let Some(shortcuts) = self.shortcuts.get(&cid) {
|
||||
app.remount(
|
||||
Cid::List(ListCid::Shortcuts),
|
||||
shortcuts.clone().to_boxed(),
|
||||
vec![],
|
||||
)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl ViewPage<Cid, Message> for ListView {
|
||||
fn mount(
|
||||
&mut self,
|
||||
app: &mut Application<Cid, Message, NoUserEvent>,
|
||||
context: &Context,
|
||||
theme: &Theme,
|
||||
) -> Result<()> {
|
||||
let navigation = ui::list_navigation(theme);
|
||||
let header = tui::realm::ui::app_header(context, theme, Some(navigation)).to_boxed();
|
||||
let patch_browser = ui::patches(theme, context, self.filter.clone(), None).to_boxed();
|
||||
|
||||
app.remount(Cid::List(ListCid::Header), header, vec![])?;
|
||||
app.remount(Cid::List(ListCid::PatchBrowser), patch_browser, vec![])?;
|
||||
|
||||
app.active(&Cid::List(self.active_component.clone()))?;
|
||||
self.update_shortcuts(app, self.active_component.clone())?;
|
||||
self.update_context(app, context, theme)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn unmount(&self, app: &mut Application<Cid, Message, NoUserEvent>) -> Result<()> {
|
||||
app.umount(&Cid::List(ListCid::Header))?;
|
||||
app.umount(&Cid::List(ListCid::PatchBrowser))?;
|
||||
app.umount(&Cid::List(ListCid::Context))?;
|
||||
app.umount(&Cid::List(ListCid::Shortcuts))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn update(
|
||||
&mut self,
|
||||
app: &mut Application<Cid, Message, NoUserEvent>,
|
||||
context: &Context,
|
||||
theme: &Theme,
|
||||
_message: Message,
|
||||
) -> Result<Option<Message>> {
|
||||
self.update_context(app, context, theme)?;
|
||||
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
fn view(&mut self, app: &mut Application<Cid, Message, NoUserEvent>, frame: &mut Frame) {
|
||||
let area = frame.size();
|
||||
let context_h = app
|
||||
.query(&Cid::List(ListCid::Context), Attribute::Height)
|
||||
.unwrap_or_default()
|
||||
.unwrap_or(AttrValue::Size(0))
|
||||
.unwrap_size();
|
||||
let shortcuts_h = 1u16;
|
||||
|
||||
let layout = layout::full_page(area, context_h, shortcuts_h);
|
||||
|
||||
app.view(&Cid::List(ListCid::Header), frame, layout.navigation);
|
||||
app.view(
|
||||
&Cid::List(self.active_component.clone()),
|
||||
frame,
|
||||
layout.component,
|
||||
);
|
||||
|
||||
app.view(&Cid::List(ListCid::Context), frame, layout.context);
|
||||
app.view(&Cid::List(ListCid::Shortcuts), frame, layout.shortcuts);
|
||||
}
|
||||
|
||||
fn subscribe(&self, app: &mut Application<Cid, Message, NoUserEvent>) -> Result<()> {
|
||||
app.subscribe(
|
||||
&Cid::List(ListCid::Header),
|
||||
Sub::new(subscription::navigation_clause(), SubClause::Always),
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn unsubscribe(&self, app: &mut Application<Cid, Message, NoUserEvent>) -> Result<()> {
|
||||
app.unsubscribe(
|
||||
&Cid::List(ListCid::Header),
|
||||
subscription::navigation_clause(),
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Patch detail page
|
||||
///
|
||||
pub struct PatchView {
|
||||
active_component: PatchCid,
|
||||
patch: (PatchId, Patch),
|
||||
shortcuts: HashMap<PatchCid, Widget<Shortcuts>>,
|
||||
}
|
||||
|
||||
impl PatchView {
|
||||
pub fn new(theme: Theme, patch: (PatchId, Patch)) -> Self {
|
||||
let shortcuts = Self::build_shortcuts(&theme);
|
||||
PatchView {
|
||||
active_component: PatchCid::Activity,
|
||||
patch,
|
||||
shortcuts,
|
||||
}
|
||||
}
|
||||
|
||||
fn build_shortcuts(theme: &Theme) -> HashMap<PatchCid, Widget<Shortcuts>> {
|
||||
[
|
||||
(
|
||||
PatchCid::Activity,
|
||||
tui::realm::ui::shortcuts(
|
||||
theme,
|
||||
vec![
|
||||
tui::realm::ui::shortcut(theme, "esc", "back"),
|
||||
tui::realm::ui::shortcut(theme, "tab", "section"),
|
||||
tui::realm::ui::shortcut(theme, "q", "quit"),
|
||||
],
|
||||
),
|
||||
),
|
||||
(
|
||||
PatchCid::Files,
|
||||
tui::realm::ui::shortcuts(
|
||||
theme,
|
||||
vec![
|
||||
tui::realm::ui::shortcut(theme, "esc", "back"),
|
||||
tui::realm::ui::shortcut(theme, "tab", "section"),
|
||||
tui::realm::ui::shortcut(theme, "q", "quit"),
|
||||
],
|
||||
),
|
||||
),
|
||||
]
|
||||
.iter()
|
||||
.cloned()
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn update_shortcuts(
|
||||
&self,
|
||||
app: &mut Application<Cid, Message, NoUserEvent>,
|
||||
cid: PatchCid,
|
||||
) -> Result<()> {
|
||||
if let Some(shortcuts) = self.shortcuts.get(&cid) {
|
||||
app.remount(
|
||||
Cid::Patch(PatchCid::Shortcuts),
|
||||
shortcuts.clone().to_boxed(),
|
||||
vec![],
|
||||
)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl ViewPage<Cid, Message> for PatchView {
|
||||
fn mount(
|
||||
&mut self,
|
||||
app: &mut Application<Cid, Message, NoUserEvent>,
|
||||
context: &Context,
|
||||
theme: &Theme,
|
||||
) -> Result<()> {
|
||||
let navigation = ui::navigation(theme);
|
||||
let header = tui::realm::ui::app_header(context, theme, Some(navigation)).to_boxed();
|
||||
let activity = ui::activity(theme).to_boxed();
|
||||
let files = ui::files(theme).to_boxed();
|
||||
let context = ui::context(context, theme, self.patch.clone()).to_boxed();
|
||||
|
||||
app.remount(Cid::Patch(PatchCid::Header), header, vec![])?;
|
||||
app.remount(Cid::Patch(PatchCid::Activity), activity, vec![])?;
|
||||
app.remount(Cid::Patch(PatchCid::Files), files, vec![])?;
|
||||
app.remount(Cid::Patch(PatchCid::Context), context, vec![])?;
|
||||
|
||||
let active_component = Cid::Patch(self.active_component.clone());
|
||||
app.active(&active_component)?;
|
||||
self.update_shortcuts(app, self.active_component.clone())?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn unmount(&self, app: &mut Application<Cid, Message, NoUserEvent>) -> Result<()> {
|
||||
app.umount(&Cid::Patch(PatchCid::Header))?;
|
||||
app.umount(&Cid::Patch(PatchCid::Activity))?;
|
||||
app.umount(&Cid::Patch(PatchCid::Files))?;
|
||||
app.umount(&Cid::Patch(PatchCid::Context))?;
|
||||
app.umount(&Cid::Patch(PatchCid::Shortcuts))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn update(
|
||||
&mut self,
|
||||
app: &mut Application<Cid, Message, NoUserEvent>,
|
||||
_context: &Context,
|
||||
_theme: &Theme,
|
||||
message: Message,
|
||||
) -> Result<Option<Message>> {
|
||||
if let Message::NavigationChanged(index) = message {
|
||||
self.active_component = PatchCid::from(index as usize);
|
||||
|
||||
let active_component = Cid::Patch(self.active_component.clone());
|
||||
app.active(&active_component)?;
|
||||
self.update_shortcuts(app, self.active_component.clone())?;
|
||||
}
|
||||
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
fn view(&mut self, app: &mut Application<Cid, Message, NoUserEvent>, frame: &mut Frame) {
|
||||
let area = frame.size();
|
||||
let context_h = app
|
||||
.query(&Cid::List(ListCid::Context), Attribute::Height)
|
||||
.unwrap_or_default()
|
||||
.unwrap_or(AttrValue::Size(0))
|
||||
.unwrap_size();
|
||||
let shortcuts_h = 1u16;
|
||||
|
||||
let layout = layout::full_page(area, context_h, shortcuts_h);
|
||||
|
||||
app.view(&Cid::Patch(PatchCid::Header), frame, layout.navigation);
|
||||
app.view(
|
||||
&Cid::Patch(self.active_component.clone()),
|
||||
frame,
|
||||
layout.component,
|
||||
);
|
||||
app.view(&Cid::Patch(PatchCid::Context), frame, layout.context);
|
||||
app.view(&Cid::Patch(PatchCid::Shortcuts), frame, layout.shortcuts);
|
||||
}
|
||||
|
||||
fn subscribe(&self, app: &mut Application<Cid, Message, NoUserEvent>) -> Result<()> {
|
||||
app.subscribe(
|
||||
&Cid::Patch(PatchCid::Header),
|
||||
Sub::new(subscription::navigation_clause(), SubClause::Always),
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn unsubscribe(&self, app: &mut Application<Cid, Message, NoUserEvent>) -> Result<()> {
|
||||
app.unsubscribe(
|
||||
&Cid::Patch(PatchCid::Header),
|
||||
subscription::navigation_clause(),
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<usize> for PatchCid {
|
||||
fn from(index: usize) -> Self {
|
||||
match index {
|
||||
0 => PatchCid::Activity,
|
||||
1 => PatchCid::Files,
|
||||
_ => PatchCid::Activity,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,171 +0,0 @@
|
||||
use radicle::cob::patch::{Patch, PatchId};
|
||||
use radicle::node::AliasStore;
|
||||
|
||||
use tuirealm::command::{Cmd, CmdResult};
|
||||
use tuirealm::tui::layout::Rect;
|
||||
use tuirealm::{AttrValue, Attribute, Frame, MockComponent, Props, State};
|
||||
|
||||
use radicle_tui as tui;
|
||||
|
||||
use tui::common::cob::patch::Filter;
|
||||
use tui::common::context::Context;
|
||||
use tui::realm::ui::cob;
|
||||
use tui::realm::ui::layout;
|
||||
use tui::realm::ui::theme::{style, Theme};
|
||||
use tui::realm::ui::widget::{Widget, WidgetComponent};
|
||||
|
||||
use tui::realm::ui::widget::container::Tabs;
|
||||
use tui::realm::ui::widget::context::{ContextBar, Progress};
|
||||
use tui::realm::ui::widget::label::{self, Label};
|
||||
|
||||
use super::super::common;
|
||||
|
||||
pub struct Activity {
|
||||
label: Widget<Label>,
|
||||
}
|
||||
|
||||
impl Activity {
|
||||
pub fn new(label: Widget<Label>) -> Self {
|
||||
Self { label }
|
||||
}
|
||||
}
|
||||
|
||||
impl WidgetComponent for Activity {
|
||||
fn view(&mut self, _properties: &Props, frame: &mut Frame, area: Rect) {
|
||||
let label_w = self
|
||||
.label
|
||||
.query(Attribute::Width)
|
||||
.unwrap_or(AttrValue::Size(1))
|
||||
.unwrap_size();
|
||||
|
||||
self.label
|
||||
.view(frame, layout::centered_label(label_w, area));
|
||||
}
|
||||
|
||||
fn state(&self) -> State {
|
||||
State::None
|
||||
}
|
||||
|
||||
fn perform(&mut self, _properties: &Props, _cmd: Cmd) -> CmdResult {
|
||||
CmdResult::None
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Files {
|
||||
label: Widget<Label>,
|
||||
}
|
||||
|
||||
impl Files {
|
||||
pub fn new(label: Widget<Label>) -> Self {
|
||||
Self { label }
|
||||
}
|
||||
}
|
||||
|
||||
impl WidgetComponent for Files {
|
||||
fn view(&mut self, _properties: &Props, frame: &mut Frame, area: Rect) {
|
||||
let label_w = self
|
||||
.label
|
||||
.query(Attribute::Width)
|
||||
.unwrap_or(AttrValue::Size(1))
|
||||
.unwrap_size();
|
||||
|
||||
self.label
|
||||
.view(frame, layout::centered_label(label_w, area));
|
||||
}
|
||||
|
||||
fn state(&self) -> State {
|
||||
State::None
|
||||
}
|
||||
|
||||
fn perform(&mut self, _properties: &Props, _cmd: Cmd) -> CmdResult {
|
||||
CmdResult::None
|
||||
}
|
||||
}
|
||||
|
||||
pub fn list_navigation(theme: &Theme) -> Widget<Tabs> {
|
||||
tui::realm::ui::tabs(
|
||||
theme,
|
||||
vec![label::reversable("Patches").style(style::magenta())],
|
||||
)
|
||||
}
|
||||
|
||||
pub fn navigation(theme: &Theme) -> Widget<Tabs> {
|
||||
tui::realm::ui::tabs(
|
||||
theme,
|
||||
vec![
|
||||
label::reversable("Activity").style(style::magenta()),
|
||||
label::reversable("Files").style(style::magenta()),
|
||||
],
|
||||
)
|
||||
}
|
||||
|
||||
pub fn patches(
|
||||
theme: &Theme,
|
||||
context: &Context,
|
||||
filter: Filter,
|
||||
selected: Option<(PatchId, Patch)>,
|
||||
) -> Widget<common::ui::PatchBrowser> {
|
||||
Widget::new(common::ui::PatchBrowser::new(
|
||||
theme, context, filter, selected,
|
||||
))
|
||||
}
|
||||
|
||||
pub fn activity(_theme: &Theme) -> Widget<Activity> {
|
||||
let not_implemented = label::default("not implemented").style(style::reset());
|
||||
let activity = Activity::new(not_implemented);
|
||||
|
||||
Widget::new(activity)
|
||||
}
|
||||
|
||||
pub fn files(_theme: &Theme) -> Widget<Files> {
|
||||
let not_implemented = label::default("not implemented").style(style::reset());
|
||||
let files = Files::new(not_implemented);
|
||||
|
||||
Widget::new(files)
|
||||
}
|
||||
|
||||
pub fn context(context: &Context, theme: &Theme, patch: (PatchId, Patch)) -> Widget<ContextBar> {
|
||||
let (id, patch) = patch;
|
||||
let (_, rev) = patch.latest();
|
||||
let is_you = *patch.author().id() == context.profile().did();
|
||||
|
||||
let id = cob::format::cob(&id);
|
||||
let title = patch.title();
|
||||
let author = patch.author().id();
|
||||
let alias = context.profile().aliases().alias(author);
|
||||
let author = cob::format_author(author, &alias, is_you);
|
||||
let comments = rev.discussion().len();
|
||||
|
||||
tui::realm::ui::widget::context::bar(theme, "Patch", &id, title, &author, &comments.to_string())
|
||||
}
|
||||
|
||||
pub fn browse_context(context: &Context, theme: &Theme, progress: Progress) -> Widget<ContextBar> {
|
||||
use radicle::cob::patch::State;
|
||||
|
||||
let mut draft = 0;
|
||||
let mut open = 0;
|
||||
let mut archived = 0;
|
||||
let mut merged = 0;
|
||||
|
||||
let patches = context.patches().as_ref().unwrap();
|
||||
for (_, patch) in patches {
|
||||
match patch.state() {
|
||||
State::Draft => draft += 1,
|
||||
State::Open { conflicts: _ } => open += 1,
|
||||
State::Archived => archived += 1,
|
||||
State::Merged {
|
||||
commit: _,
|
||||
revision: _,
|
||||
} => merged += 1,
|
||||
}
|
||||
}
|
||||
|
||||
tui::realm::ui::widget::context::bar(
|
||||
theme,
|
||||
"Browse",
|
||||
"",
|
||||
"",
|
||||
&format!("{draft} draft | {open} open | {archived} archived | {merged} merged"),
|
||||
&progress.to_string(),
|
||||
)
|
||||
}
|
||||
@@ -18,7 +18,7 @@ use tui::Exit;
|
||||
|
||||
use ui::ListPage;
|
||||
|
||||
use super::super::common::Mode;
|
||||
use super::common::Mode;
|
||||
|
||||
type Selection = tui::Selection<PatchId>;
|
||||
|
||||
Reference in New Issue
Block a user