mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
map: fixed more import errors and cleaned warnings
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
use crate::{
|
||||
list::NodeIdList,
|
||||
node::{NodeInfo, NodeInfoView},
|
||||
node_info::{NodeInfo, NodeInfoView},
|
||||
};
|
||||
use rand::Rng;
|
||||
use smol::Timer;
|
||||
use std::{collections::HashMap, time::Duration};
|
||||
//use smol::Timer;
|
||||
//use std::{collections::HashMap, time::Duration};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct App {
|
||||
@@ -16,31 +15,31 @@ impl App {
|
||||
pub fn new() -> App {
|
||||
let infos = vec![
|
||||
NodeInfo {
|
||||
id: "sodisofjhosd".to_string(),
|
||||
id: "0385048034sodisofjhosd1111q3434".to_string(),
|
||||
connections: 10,
|
||||
is_active: true,
|
||||
last_message: "hey how are you?".to_string(),
|
||||
},
|
||||
NodeInfo {
|
||||
id: "snfksdfkdjflsjkdfj".to_string(),
|
||||
id: "09w30we9wsnfksdfkdjflsjkdfjdfsd".to_string(),
|
||||
connections: 5,
|
||||
is_active: false,
|
||||
last_message: "lmao".to_string(),
|
||||
},
|
||||
NodeInfo {
|
||||
id: "alsdlasjfrsdfsdfsd".to_string(),
|
||||
id: "038043325alsdlasjfrsdfsdfsdjsdf".to_string(),
|
||||
connections: 5,
|
||||
is_active: true,
|
||||
last_message: "gm".to_string(),
|
||||
},
|
||||
NodeInfo {
|
||||
id: "ldflsdjflsdjflsdjfii".to_string(),
|
||||
id: "04985034953ldflsdjflsdjflsdjfii".to_string(),
|
||||
connections: 2,
|
||||
is_active: true,
|
||||
last_message: "hihi".to_string(),
|
||||
},
|
||||
NodeInfo {
|
||||
id: "asdjapsdika;lsk;asdkas".to_string(),
|
||||
id: "09850249352asdjapsdikalskasdkas".to_string(),
|
||||
connections: 10,
|
||||
is_active: true,
|
||||
last_message: "wtf".to_string(),
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use crate::node::{NodeInfo, NodeInfoView};
|
||||
use std::collections::HashMap;
|
||||
//use std::collections::HashMap;
|
||||
use tui::widgets::ListState;
|
||||
|
||||
#[derive(Clone)]
|
||||
|
||||
@@ -1,15 +1,4 @@
|
||||
// next/ prev:
|
||||
// select_node(i)
|
||||
// NodeInfo
|
||||
// set-content(node_info)
|
||||
// clear current text
|
||||
// let text = ...
|
||||
|
||||
use std::{
|
||||
io,
|
||||
io::Read,
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
use std::{io, io::Read, time::Duration};
|
||||
use termion::{async_stdin, event::Key, input::TermRead, raw::IntoRawMode};
|
||||
use tui::{
|
||||
backend::{Backend, TermionBackend},
|
||||
@@ -48,7 +37,7 @@ fn main() -> Result<(), io::Error> {
|
||||
fn run_app<B: Backend>(
|
||||
terminal: &mut Terminal<B>,
|
||||
mut app: App,
|
||||
tick_rate: Duration,
|
||||
_tick_rate: Duration,
|
||||
) -> io::Result<()> {
|
||||
let mut asi = async_stdin();
|
||||
|
||||
@@ -56,7 +45,7 @@ fn run_app<B: Backend>(
|
||||
|
||||
app.node_list.state.select(Some(0));
|
||||
|
||||
let mut last_tick = Instant::now();
|
||||
//let mut last_tick = Instant::now();
|
||||
|
||||
loop {
|
||||
terminal.draw(|f| ui::ui(f, &mut app))?;
|
||||
|
||||
@@ -1,19 +1,10 @@
|
||||
use rand::Rng;
|
||||
|
||||
// TODO: make Node data structure
|
||||
// hashmap of node_id and node_info
|
||||
// make NodeInfoView that implements scrolling
|
||||
//
|
||||
// NodeInfoView
|
||||
// next and previous updates index
|
||||
// and updates info content
|
||||
#[derive(Clone)]
|
||||
pub struct NodeInfoView {
|
||||
pub index: usize,
|
||||
}
|
||||
|
||||
impl NodeInfoView {
|
||||
pub fn new(infos: Vec<NodeInfo>) -> NodeInfoView {
|
||||
pub fn new(_infos: Vec<NodeInfo>) -> NodeInfoView {
|
||||
let index = 0;
|
||||
NodeInfoView { index }
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
use crate::{
|
||||
app::App,
|
||||
node::{NodeInfo, NodeInfoView},
|
||||
//node_info::{NodeInfo, NodeInfoView},
|
||||
};
|
||||
use tui::{
|
||||
backend::Backend,
|
||||
layout::{Constraint, Direction, Layout},
|
||||
style::{Color, Modifier, Style},
|
||||
text::Spans,
|
||||
widgets::{Block, Borders, List, ListItem, Paragraph},
|
||||
widgets::{Block, Borders, List, ListItem},
|
||||
Frame,
|
||||
};
|
||||
|
||||
@@ -22,7 +22,7 @@ pub fn ui<B: Backend>(f: &mut Frame<B>, app: &mut App) {
|
||||
.node_list
|
||||
.node_id
|
||||
.iter()
|
||||
.map(|(id)| {
|
||||
.map(|id| {
|
||||
let line1 = Spans::from(id.to_string());
|
||||
ListItem::new(vec![line1]).style(Style::default())
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user