1- use std:: { fmt :: format , sync:: Arc } ;
1+ use std:: sync:: Arc ;
22
33use anyhow:: Context ;
44
@@ -89,25 +89,27 @@ impl Adapter {
8989 None => false ,
9090 } ;
9191
92- let ( device_block, access_point_block, connected_devices_block) = {
92+ let ( device_block, access_point_block, connected_devices_block, help_block ) = {
9393 let chunks = Layout :: default ( )
9494 . direction ( Direction :: Vertical )
9595 . constraints ( if any_connected_devices {
9696 & [
9797 Constraint :: Percentage ( 33 ) ,
9898 Constraint :: Percentage ( 33 ) ,
9999 Constraint :: Percentage ( 33 ) ,
100+ Constraint :: Length ( 1 ) ,
100101 ]
101102 } else {
102103 & [
103104 Constraint :: Percentage ( 50 ) ,
104105 Constraint :: Percentage ( 50 ) ,
105106 Constraint :: Fill ( 1 ) ,
107+ Constraint :: Length ( 1 ) ,
106108 ]
107109 } )
108110 . margin ( 1 )
109111 . split ( frame. area ( ) ) ;
110- ( chunks[ 0 ] , chunks[ 1 ] , chunks[ 2 ] )
112+ ( chunks[ 0 ] , chunks[ 1 ] , chunks[ 2 ] , chunks [ 3 ] )
111113 } ;
112114
113115 // Device
@@ -430,6 +432,29 @@ impl Adapter {
430432
431433 frame. render_widget ( connected_devices_list, connected_devices_block) ;
432434 }
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) ;
433458 }
434459
435460 pub fn render_station_mode (
@@ -446,7 +471,7 @@ impl Adapter {
446471 Constraint :: Length ( 5 ) ,
447472 Constraint :: Min ( 5 ) ,
448473 Constraint :: Min ( 5 ) ,
449- Constraint :: Length ( 3 ) ,
474+ Constraint :: Length ( 1 ) ,
450475 ] )
451476 . margin ( 1 )
452477 . split ( frame. area ( ) ) ;
0 commit comments