mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
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:
@@ -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() {
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user