stop passing Config to ui::ui

NodeId is read from config and is initalized into Model.
The values from Model are then copied into View.

We therefore do not need to read this data in the UI, as it already exists in View.
This commit is contained in:
lunar-mining
2022-03-10 08:54:09 +01:00
parent 4dd9bc00d7
commit 69161945d9
2 changed files with 5 additions and 9 deletions

View File

@@ -127,7 +127,7 @@ async fn main() -> Result<()> {
.finish(|| {
smol::future::block_on(async move {
run_rpc(&config, ex2.clone(), model.clone()).await?;
render(&mut terminal, model.clone(), config).await?;
render(&mut terminal, model.clone()).await?;
drop(signal);
Ok::<(), darkfi::Error>(())
})
@@ -232,11 +232,7 @@ async fn poll(client: Map, model: Arc<Model>) -> Result<()> {
}
}
async fn render<B: Backend>(
terminal: &mut Terminal<B>,
model: Arc<Model>,
config: DnvConfig,
) -> io::Result<()> {
async fn render<B: Backend>(terminal: &mut Terminal<B>, model: Arc<Model>) -> io::Result<()> {
let mut asi = async_stdin();
terminal.clear()?;
@@ -251,7 +247,7 @@ async fn render<B: Backend>(
loop {
view.update(model.info_list.infos.lock().await.clone());
terminal.draw(|f| {
ui::ui(f, view.clone(), &config);
ui::ui(f, view.clone());
})?;
for k in asi.by_ref().keys() {
match k.unwrap() {

View File

@@ -1,4 +1,4 @@
use crate::{view::View, DnvConfig};
use crate::view::View;
use tui::{
backend::Backend,
@@ -9,7 +9,7 @@ use tui::{
Frame,
};
pub fn ui<B: Backend>(f: &mut Frame<'_, B>, mut view: View, config: &DnvConfig) {
pub fn ui<B: Backend>(f: &mut Frame<'_, B>, mut view: View) {
let slice = Layout::default()
.direction(Direction::Horizontal)
.margin(2)