1- use crate :: app:: {
2- App , connection:: ConnectionType , output_fmt:: OutputFmt , selected_tab:: SelectedTab ,
3- } ;
1+ use crate :: app:: { App , connection:: ConnectionType , output_fmt:: OutputFmt } ;
42use ratatui:: {
53 Frame ,
64 layout:: Rect ,
75 style:: { Color , Modifier , Style , Stylize } ,
86 text:: { Line , Span } ,
9- widgets:: { Block , List , Paragraph , Tabs } ,
7+ widgets:: { Block , List , Paragraph } ,
108} ;
11- use strum:: IntoEnumIterator ;
12-
13- pub fn ui ( f : & mut Frame , app : & App ) {
14- // Render tabs at the top.
15-
16- let titles = SelectedTab :: iter ( ) . map ( SelectedTab :: title) ;
17-
18- let tabs = Tabs :: new ( titles) . select ( app. selected_tab as usize ) ;
19-
20- f. render_widget ( tabs, Rect :: new ( 0 , 0 , f. area ( ) . width , f. area ( ) . height ) ) ;
21-
22- // Render contents of selected tab.
23- match app. selected_tab {
24- SelectedTab :: Live => render_tab_live ( f, app) ,
25- SelectedTab :: Log => render_tab_log ( f, app) ,
26- }
27- }
289
29- fn render_tab_live ( f : & mut Frame , app : & App ) {
10+ pub fn render_tab_live ( f : & mut Frame , app : & App ) {
3011 let mut list_items: Vec < Line < ' _ > > = Vec :: new ( ) ;
3112
3213 for conn in app. connections . lock ( ) . unwrap ( ) . iter ( ) {
@@ -39,7 +20,7 @@ fn render_tab_live(f: &mut Frame, app: &App) {
3920
4021 let conn_output: Line < ' _ > = match app. output_fmt {
4122 OutputFmt :: Bullet => Line :: from ( vec ! [
42- Span :: from( " ■ " ) . style( color) ,
23+ Span :: from( " " ) . style( color) ,
4324 Span :: from( format!( "{} ({})" , conn. name, url) ) ,
4425 ] ) ,
4526 OutputFmt :: Line => Line :: from ( Span :: from ( format ! ( " {} ({})" , conn. name, url) ) ) . style (
@@ -66,7 +47,7 @@ fn render_tab_live(f: &mut Frame, app: &App) {
6647 ) ;
6748}
6849
69- fn render_tab_log ( f : & mut Frame , app : & App ) {
50+ pub fn render_tab_log ( f : & mut Frame , app : & App ) {
7051 let ( idx, conn) = app. log_conn ( ) ;
7152
7253 let block =
@@ -115,7 +96,7 @@ const fn status_to_color(status: Result<u16, ()>, conn_type: &ConnectionType) ->
11596 } ;
11697
11798 match conn_type {
118- ConnectionType :: Web { .. } => match code {
99+ ConnectionType :: Remote { .. } => match code {
119100 200 => Color :: Green ,
120101 _ => Color :: Yellow ,
121102 } ,
0 commit comments