From ca231964f24bb157f12fd0a8d8dcccae8fdddd59 Mon Sep 17 00:00:00 2001 From: filipriec Date: Fri, 18 Apr 2025 11:31:50 +0200 Subject: [PATCH] fullscreen on enter for add_table --- client/src/components/admin/add_table.rs | 35 ++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/client/src/components/admin/add_table.rs b/client/src/components/admin/add_table.rs index 3c107bb..dfb4719 100644 --- a/client/src/components/admin/add_table.rs +++ b/client/src/components/admin/add_table.rs @@ -48,6 +48,41 @@ pub fn render_add_table( let inner_area = main_block.inner(area); f.render_widget(main_block, area); + // --- Fullscreen Columns Table Check (Narrow Screens Only) --- + if area.width < NARROW_LAYOUT_THRESHOLD && add_table_state.current_focus == AddTableFocus::InsideColumnsTable { + // Render ONLY the columns table taking the full inner area + let columns_border_style = Style::default().fg(theme.highlight); // Always highlighted when fullscreen + let column_rows: Vec> = add_table_state + .columns + .iter() + .map(|col_def| { + Row::new(vec![ + Cell::from(if col_def.selected { "[*]" } else { "[ ]" }), + Cell::from(col_def.name.clone()), + Cell::from(col_def.data_type.clone()), + ]) + .style(Style::default().fg(theme.fg)) + }) + .collect(); + let header_cells = ["Sel", "Name", "Type"] + .iter() + .map(|h| Cell::from(*h).style(Style::default().fg(theme.accent))); + let header = Row::new(header_cells).height(1).bottom_margin(1); + let columns_table = Table::new(column_rows, [Constraint::Length(5), Constraint::Percentage(50), Constraint::Percentage(50)]) + .header(header) + .block( + Block::default() + .title(Span::styled(" Columns (Fullscreen) ", theme.fg)) // Indicate fullscreen + .title_alignment(Alignment::Center) + .borders(Borders::ALL) + .border_type(BorderType::Rounded) + .border_style(columns_border_style), + ) + .highlight_symbol(" > "); // Use the inside symbol + f.render_stateful_widget(columns_table, inner_area, &mut add_table_state.column_table_state); + return; // IMPORTANT: Stop rendering here for fullscreen mode + } + // --- Area Variable Declarations --- let top_info_area: Rect; let columns_area: Rect;