1
- use std:: { fmt :: format , sync:: Arc } ;
1
+ use std:: sync:: Arc ;
2
2
3
3
use anyhow:: Context ;
4
4
@@ -89,25 +89,27 @@ impl Adapter {
89
89
None => false ,
90
90
} ;
91
91
92
- let ( device_block, access_point_block, connected_devices_block) = {
92
+ let ( device_block, access_point_block, connected_devices_block, help_block ) = {
93
93
let chunks = Layout :: default ( )
94
94
. direction ( Direction :: Vertical )
95
95
. constraints ( if any_connected_devices {
96
96
& [
97
97
Constraint :: Percentage ( 33 ) ,
98
98
Constraint :: Percentage ( 33 ) ,
99
99
Constraint :: Percentage ( 33 ) ,
100
+ Constraint :: Length ( 1 ) ,
100
101
]
101
102
} else {
102
103
& [
103
104
Constraint :: Percentage ( 50 ) ,
104
105
Constraint :: Percentage ( 50 ) ,
105
106
Constraint :: Fill ( 1 ) ,
107
+ Constraint :: Length ( 1 ) ,
106
108
]
107
109
} )
108
110
. margin ( 1 )
109
111
. split ( frame. area ( ) ) ;
110
- ( chunks[ 0 ] , chunks[ 1 ] , chunks[ 2 ] )
112
+ ( chunks[ 0 ] , chunks[ 1 ] , chunks[ 2 ] , chunks [ 3 ] )
111
113
} ;
112
114
113
115
// Device
@@ -430,6 +432,29 @@ impl Adapter {
430
432
431
433
frame. render_widget ( connected_devices_list, connected_devices_block) ;
432
434
}
435
+
436
+ let help_message = match focused_block {
437
+ FocusedBlock :: Device => {
438
+ format ! (
439
+ "⇄: Nav | {}: Show information | {}: Toggle power" ,
440
+ self . config. device. infos, self . config. device. toggle_power
441
+ )
442
+ }
443
+ FocusedBlock :: AdapterInfos | FocusedBlock :: AccessPointInput => {
444
+ "⇄: Nav | : Discard" . to_string ( )
445
+ }
446
+ FocusedBlock :: AccessPoint => {
447
+ format ! (
448
+ "⇄: Nav | {}: New AP | {}: Stop AP" ,
449
+ self . config. ap. start, self . config. ap. stop
450
+ )
451
+ }
452
+ _ => "" . to_string ( ) ,
453
+ } ;
454
+
455
+ let help_message = Text :: from ( help_message) . centered ( ) . bold ( ) . blue ( ) ;
456
+
457
+ frame. render_widget ( help_message, help_block) ;
433
458
}
434
459
435
460
pub fn render_station_mode (
@@ -446,7 +471,7 @@ impl Adapter {
446
471
Constraint :: Length ( 5 ) ,
447
472
Constraint :: Min ( 5 ) ,
448
473
Constraint :: Min ( 5 ) ,
449
- Constraint :: Length ( 3 ) ,
474
+ Constraint :: Length ( 1 ) ,
450
475
] )
451
476
. margin ( 1 )
452
477
. split ( frame. area ( ) ) ;
0 commit comments