@@ -71,42 +71,45 @@ pub fn draw_header(
7171/// Draws the application footer with help text and status
7272pub fn draw_footer ( frame : & mut Frame , area : Rect , job_stat : ( usize , usize , usize ) ) {
7373 // Controls help (lower part of footer)
74- let footer_text = vec ! [
75- Span :: styled( "q" , Style :: default ( ) . fg( Color :: Cyan ) ) ,
76- Span :: raw( ": Quit | " ) ,
77- Span :: styled( "↑/↓" , Style :: default ( ) . fg( Color :: Cyan ) ) ,
78- Span :: raw( ": Navigate | " ) ,
79- Span :: styled( "Space" , Style :: default ( ) . fg( Color :: Cyan ) ) ,
80- Span :: raw( ": Select | " ) ,
81- Span :: styled( "Enter" , Style :: default ( ) . fg( Color :: Cyan ) ) ,
82- Span :: raw( ": View Script | " ) ,
83- Span :: styled( "f" , Style :: default ( ) . fg( Color :: Cyan ) ) ,
84- Span :: raw( ": Filter | " ) ,
85- Span :: styled( "c" , Style :: default ( ) . fg( Color :: Cyan ) ) ,
86- Span :: raw( ": Columns | " ) ,
87- Span :: styled( "v" , Style :: default ( ) . fg( Color :: Cyan ) ) ,
88- Span :: raw( ": View Log | " ) ,
89- Span :: styled( "a" , Style :: default ( ) . fg( Color :: Cyan ) ) ,
90- Span :: raw( ": SelectAll | " ) ,
91- Span :: styled( "r" , Style :: default ( ) . fg( Color :: Cyan ) ) ,
92- Span :: raw( ": Refresh | " ) ,
93- // stat_text
94- Span :: styled( "Job Stat: " , Style :: default ( ) . fg( Color :: Cyan ) ) ,
95- // Yellow for P, Green for R, Blue for Other
96- Span :: styled(
97- format!( "P[ {} ] " , job_stat. 0 ) ,
98- Style :: default ( ) . fg( Color :: Yellow ) ,
99- ) ,
100- Span :: styled(
101- format!( "R[ {} ] " , job_stat. 1 ) ,
102- Style :: default ( ) . fg( Color :: Green ) ,
103- ) ,
104- Span :: styled(
105- format!( "Other[ {} ]" , job_stat. 2 ) ,
106- Style :: default ( ) . fg( Color :: Blue ) ,
107- ) ,
74+ let color_style = Style :: default ( ) . fg ( Color :: Cyan ) ;
75+ let text_hashmap = [
76+ ( "q" , "Quit" ) ,
77+ ( "↑/↓" , "Navigate" ) ,
78+ ( "Space" , "Select" ) ,
79+ ( "Enter" , "View Script" ) ,
80+ ( "f" , "Filter" ) ,
81+ ( "c" , "Columns" ) ,
82+ ( "v" , "View Log" ) ,
83+ ( "a" , "SelectAll" ) ,
84+ ( "r" , "Refresh" ) ,
10885 ] ;
10986
87+ let mut footer_text: Vec < Span > = text_hashmap
88+ . iter ( )
89+ . flat_map ( |( key, description) | {
90+ vec ! [
91+ Span :: styled( * key, color_style) ,
92+ Span :: raw( ": " ) ,
93+ Span :: raw( * description) ,
94+ Span :: raw( " | " ) ,
95+ ]
96+ } )
97+ . collect ( ) ;
98+
99+ footer_text. push ( Span :: styled ( "Job Stat: " , Style :: default ( ) . fg ( Color :: Cyan ) ) ) ;
100+ footer_text. push ( Span :: styled (
101+ format ! ( "P[ {} ] " , job_stat. 0 ) ,
102+ Style :: default ( ) . fg ( Color :: Yellow ) ,
103+ ) ) ;
104+ footer_text. push ( Span :: styled (
105+ format ! ( "R[ {} ] " , job_stat. 1 ) ,
106+ Style :: default ( ) . fg ( Color :: Green ) ,
107+ ) ) ;
108+ footer_text. push ( Span :: styled (
109+ format ! ( "Other[ {} ]" , job_stat. 2 ) ,
110+ Style :: default ( ) . fg ( Color :: Blue ) ,
111+ ) ) ;
112+
110113 let footer =
111114 Paragraph :: new ( Line :: from ( footer_text) ) . block ( Block :: default ( ) . borders ( Borders :: ALL ) ) ;
112115
0 commit comments