@@ -1062,11 +1062,40 @@ fn draw_model_detail(f: &mut Frame, area: Rect, app: &App) {
10621062 let has_updated = model. last_updated . is_some ( ) ;
10631063 let dates_rows: u16 = if has_updated { 2 } else { 1 } ;
10641064
1065+ // ── Pre-build modalities paragraph for dynamic height ────────────────
1066+ let ( mod_in, mod_out) = match & model. modalities {
1067+ Some ( m) => (
1068+ if m. input . is_empty ( ) {
1069+ "text" . to_string ( )
1070+ } else {
1071+ m. input . join ( ", " )
1072+ } ,
1073+ if m. output . is_empty ( ) {
1074+ "text" . to_string ( )
1075+ } else {
1076+ m. output . join ( ", " )
1077+ } ,
1078+ ) ,
1079+ None => ( "text" . to_string ( ) , "text" . to_string ( ) ) ,
1080+ } ;
1081+ let mod_para = Paragraph :: new ( vec ! [
1082+ Line :: from( vec![
1083+ Span :: styled( "Input: " , Style :: default ( ) . fg( label_color) ) ,
1084+ Span :: styled( mod_in, Style :: default ( ) . fg( text_color) ) ,
1085+ ] ) ,
1086+ Line :: from( vec![
1087+ Span :: styled( "Output: " , Style :: default ( ) . fg( label_color) ) ,
1088+ Span :: styled( mod_out, Style :: default ( ) . fg( text_color) ) ,
1089+ ] ) ,
1090+ ] )
1091+ . wrap ( Wrap { trim : false } ) ;
1092+ let mod_rows = mod_para. line_count ( inner. width ) as u16 ;
1093+
10651094 // ── Vertical layout ───────────────────────────────────────────────────
1066- // identity(2 ) + gap(1) + cap_hdr(1) + cap(1 ) + gap(1)
1095+ // identity(3 ) + gap(1) + cap_hdr(1) + cap(3 ) + gap(1)
10671096 // + price_hdr(1) + price_tbl(2) + gap(1)
10681097 // + limits_hdr(1) + limits_tbl(1) + gap(1)
1069- // + mod_hdr(1) + mod(1 ) + gap(1)
1098+ // + mod_hdr(1) + mod(dynamic ) + gap(1)
10701099 // + dates_hdr(1) + dates_tbl(1 or 2) + remainder
10711100 let chunks = Layout :: default ( )
10721101 . direction ( Direction :: Vertical )
@@ -1083,7 +1112,7 @@ fn draw_model_detail(f: &mut Frame, area: Rect, app: &App) {
10831112 Constraint :: Length ( 1 ) , // 9: limits table
10841113 Constraint :: Length ( 1 ) , // 10: gap
10851114 Constraint :: Length ( 1 ) , // 11: modalities header
1086- Constraint :: Length ( 1 ) , // 12: modalities content
1115+ Constraint :: Length ( mod_rows ) , // 12: modalities content (dynamic)
10871116 Constraint :: Length ( 1 ) , // 13: gap
10881117 Constraint :: Length ( 1 ) , // 14: dates header
10891118 Constraint :: Length ( dates_rows) , // 15: dates table
@@ -1290,37 +1319,7 @@ fn draw_model_detail(f: &mut Frame, area: Rect, app: &App) {
12901319
12911320 // ── Modalities ────────────────────────────────────────────────────────
12921321 render_section_header ( f, chunks[ 11 ] , "Modalities" ) ;
1293-
1294- let ( mod_in, mod_out) = match & model. modalities {
1295- Some ( m) => (
1296- if m. input . is_empty ( ) {
1297- "text" . to_string ( )
1298- } else {
1299- m. input . join ( ", " )
1300- } ,
1301- if m. output . is_empty ( ) {
1302- "text" . to_string ( )
1303- } else {
1304- m. output . join ( ", " )
1305- } ,
1306- ) ,
1307- None => ( "text" . to_string ( ) , "text" . to_string ( ) ) ,
1308- } ;
1309- let modalities_table = Table :: new (
1310- vec ! [ Row :: new( vec![
1311- Cell :: from( Span :: styled( "Input:" , Style :: default ( ) . fg( label_color) ) ) ,
1312- Cell :: from( Span :: styled( mod_in, Style :: default ( ) . fg( text_color) ) ) ,
1313- Cell :: from( Span :: styled( "Output:" , Style :: default ( ) . fg( label_color) ) ) ,
1314- Cell :: from( Span :: styled( mod_out, Style :: default ( ) . fg( text_color) ) ) ,
1315- ] ) ] ,
1316- [
1317- Constraint :: Length ( 7 ) ,
1318- Constraint :: Fill ( 1 ) ,
1319- Constraint :: Length ( 8 ) ,
1320- Constraint :: Fill ( 1 ) ,
1321- ] ,
1322- ) ;
1323- f. render_widget ( modalities_table, chunks[ 12 ] ) ;
1322+ f. render_widget ( mod_para, chunks[ 12 ] ) ;
13241323
13251324 // ── Dates ─────────────────────────────────────────────────────────────
13261325 render_section_header ( f, chunks[ 14 ] , "Dates" ) ;
0 commit comments