Skip to content

Commit 526a785

Browse files
committed
remove help popup
1 parent b7d4b6c commit 526a785

File tree

8 files changed

+9
-248
lines changed

8 files changed

+9
-248
lines changed
File renamed without changes.

src/app.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use async_channel::{Receiver, Sender};
1818
use futures::FutureExt;
1919
use iwdrs::{agent::Agent, modes::Mode, session::Session};
2020

21-
use crate::{adapter::Adapter, event::Event, help::Help, notification::Notification};
21+
use crate::{adapter::Adapter, event::Event, notification::Notification};
2222

2323
pub type AppResult<T> = std::result::Result<T, Box<dyn Error>>;
2424

@@ -29,7 +29,6 @@ pub enum FocusedBlock {
2929
AccessPoint,
3030
KnownNetworks,
3131
NewNetworks,
32-
Help,
3332
AuthKey,
3433
AdapterInfos,
3534
AccessPointInput,
@@ -46,7 +45,6 @@ pub enum ColorMode {
4645
pub struct App {
4746
pub running: bool,
4847
pub focused_block: FocusedBlock,
49-
pub help: Help,
5048
pub color_mode: ColorMode,
5149
pub notifications: Vec<Notification>,
5250
pub session: Arc<Session>,
@@ -91,7 +89,7 @@ pub async fn request_confirmation(
9189
}
9290

9391
impl App {
94-
pub async fn new(help: Help, mode: Mode, sender: UnboundedSender<Event>) -> AppResult<Self> {
92+
pub async fn new(mode: Mode, sender: UnboundedSender<Event>) -> AppResult<Self> {
9593
let session = {
9694
match iwdrs::session::Session::new().await {
9795
Ok(session) => Arc::new(session),
@@ -144,7 +142,6 @@ impl App {
144142
Ok(Self {
145143
running: true,
146144
focused_block: FocusedBlock::Device,
147-
help,
148145
color_mode,
149146
notifications: Vec::new(),
150147
session,

src/device.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ use iwdrs::{device::Device as iwdDevice, modes::Mode, session::Session};
55
use tokio::sync::mpsc::UnboundedSender;
66

77
use crate::{
8-
access_point::AccessPoint, app::AppResult, event::Event, notification::Notification,
9-
station::Station,
8+
ap::AccessPoint, app::AppResult, event::Event, notification::Notification, station::Station,
109
};
1110

1211
#[derive(Debug, Clone)]

src/handler.rs

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::sync::Arc;
22

3-
use crate::access_point::APFocusedSection;
3+
use crate::ap::APFocusedSection;
44
use crate::app::{App, AppResult, FocusedBlock};
55
use crate::config::Config;
66
use crate::event::Event;
@@ -119,23 +119,16 @@ pub async fn handle_key_events(
119119
}
120120
}
121121

122-
// Show help
123-
KeyCode::Char('?') => {
124-
app.focused_block = FocusedBlock::Help;
125-
}
126-
127122
// Switch mode
128123
KeyCode::Char(c)
129124
if c == config.switch && key_event.modifiers == KeyModifiers::CONTROL =>
130125
{
131126
app.reset_mode = true;
132127
}
133128

134-
// Discard help popup
129+
// Discard popup
135130
KeyCode::Esc => {
136-
if app.focused_block == FocusedBlock::Help
137-
|| app.focused_block == FocusedBlock::AdapterInfos
138-
{
131+
if app.focused_block == FocusedBlock::AdapterInfos {
139132
app.focused_block = FocusedBlock::Device;
140133
}
141134
}
@@ -645,9 +638,6 @@ pub async fn handle_key_events(
645638
}
646639
}
647640

648-
FocusedBlock::Help => {
649-
app.help.scroll_down();
650-
}
651641
_ => {}
652642
}
653643
}
@@ -718,9 +708,6 @@ pub async fn handle_key_events(
718708
.select(Some(i));
719709
}
720710
}
721-
FocusedBlock::Help => {
722-
app.help.scroll_up();
723-
}
724711
_ => {}
725712
},
726713
_ => {}
@@ -741,19 +728,6 @@ pub async fn handle_key_events(
741728
}
742729
}
743730

744-
// Scroll down
745-
KeyCode::Char('j') | KeyCode::Down => {
746-
if app.focused_block == FocusedBlock::Help {
747-
app.help.scroll_down();
748-
}
749-
}
750-
751-
KeyCode::Char('k') | KeyCode::Up => {
752-
if app.focused_block == FocusedBlock::Help {
753-
app.help.scroll_up();
754-
}
755-
}
756-
757731
_ => {}
758732
},
759733
_ => {}

src/help.rs

Lines changed: 0 additions & 199 deletions
This file was deleted.

src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ pub mod config;
1212

1313
pub mod notification;
1414

15-
pub mod help;
16-
1715
pub mod device;
1816

1917
pub mod station;
@@ -26,7 +24,7 @@ pub mod auth;
2624

2725
pub mod adapter;
2826

29-
pub mod access_point;
27+
pub mod ap;
3028

3129
pub mod cli;
3230

src/main.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use impala::app::{App, AppResult};
22
use impala::config::Config;
33
use impala::event::{Event, EventHandler};
44
use impala::handler::handle_key_events;
5-
use impala::help::Help;
65
use impala::tui::Tui;
76
use impala::{cli, rfkill};
87
use iwdrs::modes::Mode;
@@ -19,8 +18,6 @@ async fn main() -> AppResult<()> {
1918

2019
let config = Arc::new(Config::new());
2120

22-
let help = Help::new(&config.clone());
23-
2421
let backend = CrosstermBackend::new(io::stdout());
2522
let terminal = Terminal::new(backend)?;
2623
let events = EventHandler::new(2_000);
@@ -39,7 +36,7 @@ async fn main() -> AppResult<()> {
3936
tui.exit()?;
4037
}
4138

42-
let mut app = App::new(help.clone(), mode, tui.events.sender.clone()).await?;
39+
let mut app = App::new(mode, tui.events.sender.clone()).await?;
4340

4441
while app.running {
4542
tui.draw(&mut app)?;
@@ -64,7 +61,7 @@ async fn main() -> AppResult<()> {
6461
{
6562
tui.exit()?;
6663
}
67-
app = App::new(help.clone(), mode, tui.events.sender.clone()).await?;
64+
app = App::new(mode, tui.events.sender.clone()).await?;
6865
}
6966
_ => {}
7067
}

src/ui.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ pub fn render(app: &mut App, frame: &mut Frame) {
3232
ap.render_input(frame);
3333
}
3434

35-
// Help
36-
if let FocusedBlock::Help = app.focused_block {
37-
app.help.render(frame, app.color_mode);
38-
}
39-
4035
// Notifications
4136
for (index, notification) in app.notifications.iter().enumerate() {
4237
notification.render(index, frame);

0 commit comments

Comments
 (0)