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