remove RunningState from frontend app
This commit is contained in:
parent
3c5f58266c
commit
1995aaa858
2 changed files with 7 additions and 11 deletions
18
src/main.rs
18
src/main.rs
|
@ -40,7 +40,6 @@ async fn main() -> error::Result<()> {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbg!(network_ip);
|
|
||||||
|
|
||||||
let state = JoecalState::new(device)
|
let state = JoecalState::new(device)
|
||||||
.await
|
.await
|
||||||
|
@ -59,11 +58,10 @@ async fn main() -> error::Result<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct App {
|
pub struct App {
|
||||||
pub state: JoecalState,
|
state: JoecalState,
|
||||||
rstate: RunningState,
|
screen: CurrentScreen,
|
||||||
pub screen: CurrentScreen,
|
// addr -> (alias, fingerprint)
|
||||||
// addr to (alias, fingerprint)
|
peers: BTreeMap<SocketAddr, (String, String)>,
|
||||||
pub peers: BTreeMap<SocketAddr, (String, String)>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
@ -77,7 +75,6 @@ impl App {
|
||||||
pub async fn new(state: JoecalState) -> Self {
|
pub async fn new(state: JoecalState) -> Self {
|
||||||
App {
|
App {
|
||||||
state: state.clone(),
|
state: state.clone(),
|
||||||
rstate: *state.running_state.lock().await,
|
|
||||||
screen: CurrentScreen::Main,
|
screen: CurrentScreen::Main,
|
||||||
peers: Default::default(),
|
peers: Default::default(),
|
||||||
}
|
}
|
||||||
|
@ -88,7 +85,6 @@ impl App {
|
||||||
terminal.draw(|frame| self.draw(frame))?;
|
terminal.draw(|frame| self.draw(frame))?;
|
||||||
self.handle_events().await?;
|
self.handle_events().await?;
|
||||||
let rstate = self.state.running_state.lock().await;
|
let rstate = self.state.running_state.lock().await;
|
||||||
self.rstate = *rstate;
|
|
||||||
if *rstate == RunningState::Stopping {
|
if *rstate == RunningState::Stopping {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -161,10 +157,10 @@ impl Widget for &App {
|
||||||
.title_bottom(instructions.centered())
|
.title_bottom(instructions.centered())
|
||||||
.border_set(border::THICK);
|
.border_set(border::THICK);
|
||||||
|
|
||||||
let rs = format!("{:?}", self.screen);
|
let current_screen = format!("{:?}", self.screen);
|
||||||
let state_text = Text::from(vec![Line::from(vec!["runstate: ".into(), rs.yellow()])]);
|
let text = Text::from(Line::from(current_screen.yellow()));
|
||||||
|
|
||||||
Paragraph::new(state_text)
|
Paragraph::new(text)
|
||||||
.centered()
|
.centered()
|
||||||
.block(block)
|
.block(block)
|
||||||
.render(area, buf);
|
.render(area, buf);
|
||||||
|
|
Loading…
Reference in a new issue