@@ -13,7 +13,7 @@ use tui_input::{backend::crossterm::EventHandler, Input};
13
13
use ratatui:: {
14
14
layout:: { Alignment , Constraint , Direction , Flex , Layout , Margin , Rect } ,
15
15
style:: { Color , Style , Stylize } ,
16
- text:: Line ,
16
+ text:: { Line , Text } ,
17
17
widgets:: {
18
18
Bar , BarChart , BarGroup , Block , BorderType , Borders , Cell , Clear , HighlightSpacing ,
19
19
Padding , Row , Scrollbar , ScrollbarOrientation , ScrollbarState , Table ,
@@ -385,7 +385,7 @@ impl Metrics {
385
385
. direction ( Direction :: Vertical )
386
386
. constraints ( [
387
387
Constraint :: Fill ( 1 ) ,
388
- Constraint :: Length ( 9 ) ,
388
+ Constraint :: Length ( 10 ) , // Form
389
389
Constraint :: Fill ( 1 ) ,
390
390
] )
391
391
. flex ( ratatui:: layout:: Flex :: SpaceBetween )
@@ -401,6 +401,16 @@ impl Metrics {
401
401
. flex ( ratatui:: layout:: Flex :: SpaceBetween )
402
402
. split ( layout[ 1 ] ) [ 1 ] ;
403
403
404
+ let ( form_block, message_block) = {
405
+ let chunks = Layout :: default ( )
406
+ . direction ( Direction :: Vertical )
407
+ . constraints ( [ Constraint :: Fill ( 1 ) , Constraint :: Length ( 3 ) ] )
408
+ . flex ( ratatui:: layout:: Flex :: SpaceBetween )
409
+ . split ( block) ;
410
+
411
+ ( chunks[ 0 ] , chunks[ 1 ] )
412
+ } ;
413
+
404
414
//TODO: Center
405
415
let rows = [
406
416
Row :: new ( vec ! [
@@ -438,19 +448,37 @@ impl Metrics {
438
448
)
439
449
. column_spacing ( 2 )
440
450
. flex ( Flex :: SpaceBetween )
441
- . highlight_spacing ( HighlightSpacing :: Always )
442
- . block (
443
- Block :: default ( )
444
- . title ( " Metrics Explorer " )
445
- . bold ( )
446
- . title_alignment ( ratatui:: layout:: Alignment :: Center )
447
- . borders ( Borders :: all ( ) )
448
- . border_type ( ratatui:: widgets:: BorderType :: Thick )
449
- . border_style ( Style :: default ( ) . green ( ) )
450
- . padding ( Padding :: uniform ( 1 ) ) ,
451
- ) ;
451
+ . highlight_spacing ( HighlightSpacing :: Always ) ;
452
+
453
+ let help_message =
454
+ Text :: styled ( "💡Examples: 443, 8080, 5555-9999" , Style :: new ( ) . dark_gray ( ) ) . centered ( ) ;
452
455
453
456
frame. render_widget ( Clear , block) ;
454
- frame. render_widget ( table, block) ;
457
+ frame. render_widget (
458
+ table,
459
+ form_block. inner ( Margin {
460
+ horizontal : 2 ,
461
+ vertical : 0 ,
462
+ } ) ,
463
+ ) ;
464
+ frame. render_widget (
465
+ help_message,
466
+ message_block. inner ( Margin {
467
+ horizontal : 2 ,
468
+ vertical : 0 ,
469
+ } ) ,
470
+ ) ;
471
+
472
+ frame. render_widget (
473
+ Block :: default ( )
474
+ . title ( " Metrics Explorer " )
475
+ . bold ( )
476
+ . title_alignment ( ratatui:: layout:: Alignment :: Center )
477
+ . borders ( Borders :: all ( ) )
478
+ . border_type ( ratatui:: widgets:: BorderType :: Thick )
479
+ . border_style ( Style :: default ( ) . green ( ) )
480
+ . padding ( Padding :: uniform ( 1 ) ) ,
481
+ block,
482
+ ) ;
455
483
}
456
484
}
0 commit comments