diff --git a/src/components/interfaces.rs b/src/components/interfaces.rs index 082f269..152db04 100644 --- a/src/components/interfaces.rs +++ b/src/components/interfaces.rs @@ -93,7 +93,8 @@ impl Interfaces { let active_interface = &self.active_interfaces[self.active_interface_index]; let header = Row::new(vec!["", "name", "mac", "ipv4", "ipv6"]) .style(Style::default().fg(Color::Yellow)) - .bottom_margin(1); + .height(1); + // .bottom_margin(1); let mut rows = Vec::new(); for w in &self.interfaces { let mut active = String::from(""); @@ -158,7 +159,6 @@ impl Interfaces { .header(header) .block( Block::default() - // .title("|Interfaces|") .title(Line::from(vec![ Span::styled("|Inter", Style::default().fg(Color::Yellow)), Span::styled("f", Style::default().fg(Color::Red)), @@ -168,7 +168,7 @@ impl Interfaces { .title_style(Style::default().fg(Color::Yellow)) .title_alignment(Alignment::Right) .borders(Borders::ALL) - .padding(Padding::new(1, 0, 1, 0)), + .padding(Padding::new(0, 0, 1, 0)), ) .column_spacing(1); table diff --git a/src/components/packetdump.rs b/src/components/packetdump.rs index 5016ca8..237c883 100644 --- a/src/components/packetdump.rs +++ b/src/components/packetdump.rs @@ -778,11 +778,15 @@ impl PacketDump { fn make_table<'a>(rows: Vec>, packet_type: PacketTypeEnum) -> Table<'a> { let header = Row::new(vec!["time", "packet log"]) .style(Style::default().fg(Color::Yellow)) + .top_margin(1) .bottom_margin(1); let mut type_titles = vec![ Span::styled("|", Style::default().fg(Color::Yellow)), - String::from(char::from_u32(0x25c0).unwrap_or('<')).into(), + Span::styled( + String::from(char::from_u32(0x25c0).unwrap_or('<')), + Style::default().fg(Color::Red), + ), ]; let mut enum_titles = PacketTypeEnum::iter() .enumerate() @@ -799,7 +803,10 @@ impl PacketDump { }) .collect::>(); type_titles.append(&mut enum_titles); - type_titles.push(String::from(char::from_u32(0x25b6).unwrap_or('>')).into()); + type_titles.push(Span::styled( + String::from(char::from_u32(0x25b6).unwrap_or('>')), + Style::default().fg(Color::Red), + )); type_titles.push(Span::styled("|", Style::default().fg(Color::Yellow))); let table = Table::new(rows, [Constraint::Min(10), Constraint::Percentage(100)]) diff --git a/src/components/wifi_interface.rs b/src/components/wifi_interface.rs index 84e83ec..1782540 100644 --- a/src/components/wifi_interface.rs +++ b/src/components/wifi_interface.rs @@ -88,9 +88,21 @@ impl WifiInterface { .unwrap_or(&"") .parse::() .unwrap_or(String::from("")), - ssid: hash.get("ssid").unwrap_or(&"").parse::().unwrap_or(String::from("")), - ifindex: hash.get("ifindex").unwrap_or(&"").parse::().unwrap_or(0), - mac: hash.get("addr").unwrap_or(&"").parse::().unwrap_or(String::from("")), + ssid: hash + .get("ssid") + .unwrap_or(&"") + .parse::() + .unwrap_or(String::from("")), + ifindex: hash + .get("ifindex") + .unwrap_or(&"") + .parse::() + .unwrap_or(0), + mac: hash + .get("addr") + .unwrap_or(&"") + .parse::() + .unwrap_or(String::from("")), channel: hash .get("channel") .unwrap_or(&"") @@ -155,11 +167,11 @@ impl WifiInterface { let list = List::new(items).block( Block::default() - .borders(Borders::ALL) + .borders(Borders::TOP) .title("|WiFi Interface|") .border_style(Style::default().fg(Color::Rgb(100, 100, 100))) - // .border_type(BorderType::Rounded) .title_style(Style::default().fg(Color::Yellow)) + .padding(Padding::new(2, 0, 0, 0)) .title_alignment(Alignment::Right), ); @@ -258,7 +270,7 @@ impl Component for WifiInterface { .split(area); let rect = Rect::new( (area.width / 2) + 1, - (layout[0].y + layout[0].height) - 4, + (layout[0].y + layout[0].height) - 3, (area.width / 2) - 2, 4, ); diff --git a/src/components/wifi_scan.rs b/src/components/wifi_scan.rs index 26a4526..e2160b4 100644 --- a/src/components/wifi_scan.rs +++ b/src/components/wifi_scan.rs @@ -88,8 +88,8 @@ impl WifiScan { fn make_table(&mut self) -> Table { let header = Row::new(vec!["time", "ssid", "ch", "mac", "signal"]) - .style(Style::default().fg(Color::Yellow)) - .bottom_margin(1); + .style(Style::default().fg(Color::Yellow)); + // .bottom_margin(1); let mut rows = Vec::new(); for w in &self.wifis { let s_clamp = w.signal.max(MIN_DBM).min(MAX_DBM); @@ -152,7 +152,7 @@ impl WifiScan { ) .border_style(Style::default().fg(Color::Rgb(100, 100, 100))) .borders(Borders::ALL) - .padding(Padding::new(1, 0, 1, 0)), + .padding(Padding::new(0, 0, 1, 0)), ) .column_spacing(1); table diff --git a/src/enums.rs b/src/enums.rs index 3f6b5f1..23645b8 100644 --- a/src/enums.rs +++ b/src/enums.rs @@ -66,6 +66,17 @@ pub enum PacketsInfoTypesEnum { Icmp6(ICMP6PacketInfo), } +#[derive(Default, Clone, Copy, Display, FromRepr, EnumIter, EnumCount, PartialEq, Debug)] +pub enum TabsEnum { + #[default] + #[strum(to_string = "Discovery")] + Discovery, + #[strum(to_string = "Packets")] + Packets, + #[strum(to_string = "Ports")] + Ports, +} + #[derive(Default, Clone, Copy, Display, FromRepr, EnumIter, EnumCount, PartialEq, Debug)] pub enum PacketTypeEnum { #[default]