-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- prepared tabs - change home to title - packetdump change pause logic for arp packets handling
- Loading branch information
Showing
5 changed files
with
96 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
use std::{collections::HashMap, time::Duration}; | ||
|
||
use color_eyre::eyre::Result; | ||
use crossterm::event::{KeyCode, KeyEvent}; | ||
use ratatui::{prelude::*, widgets::*}; | ||
use serde::{Deserialize, Serialize}; | ||
use tokio::sync::mpsc::UnboundedSender; | ||
|
||
use super::{Component, Frame}; | ||
use crate::{ | ||
action::Action, | ||
config::{Config, KeyBindings}, | ||
}; | ||
|
||
#[derive(Default)] | ||
pub struct Title { | ||
command_tx: Option<UnboundedSender<Action>>, | ||
config: Config, | ||
} | ||
|
||
impl Title { | ||
pub fn new() -> Self { | ||
Self { | ||
command_tx: None, | ||
config: Config::default(), | ||
} | ||
} | ||
} | ||
|
||
impl Component for Title { | ||
fn register_action_handler(&mut self, tx: UnboundedSender<Action>) -> Result<()> { | ||
self.command_tx = Some(tx); | ||
Ok(()) | ||
} | ||
|
||
fn register_config_handler(&mut self, config: Config) -> Result<()> { | ||
self.config = config; | ||
Ok(()) | ||
} | ||
|
||
fn update(&mut self, action: Action) -> Result<Option<Action>> { | ||
match action { | ||
Action::Tick => {} | ||
_ => {} | ||
} | ||
Ok(None) | ||
} | ||
|
||
fn draw(&mut self, f: &mut Frame<'_>, area: Rect) -> Result<()> { | ||
let rect = Rect::new(0, 0, f.size().width, 1); | ||
let version: &str = env!("CARGO_PKG_VERSION"); | ||
let title = format!(" Network Scanner (v{})", version); | ||
f.render_widget(Paragraph::new(title), rect); | ||
Ok(()) | ||
} | ||
} |