proper scroll behaviour on the page now
This commit is contained in:
@@ -186,8 +186,7 @@ pub fn render_add_table(
|
||||
// --- Common Widget Rendering (Uses calculated areas) ---
|
||||
|
||||
// --- Columns Table Rendering ---
|
||||
let columns_focused =
|
||||
add_table_state.current_focus == AddTableFocus::ColumnsTable;
|
||||
let columns_focused = matches!(add_table_state.current_focus, AddTableFocus::ColumnsTable | AddTableFocus::InsideColumnsTable);
|
||||
let columns_border_style = if columns_focused {
|
||||
Style::default().fg(theme.highlight)
|
||||
} else {
|
||||
@@ -204,11 +203,11 @@ pub fn render_add_table(
|
||||
.style(Style::default().fg(theme.fg))
|
||||
})
|
||||
.collect();
|
||||
// Use different headers/constraints based on layout? For now, keep consistent.
|
||||
let header_cells = ["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_highlight_symbol = if add_table_state.current_focus == AddTableFocus::InsideColumnsTable { " > " } else { " " };
|
||||
let columns_table = Table::new(
|
||||
column_rows,
|
||||
[Constraint::Percentage(60), Constraint::Percentage(40)],
|
||||
@@ -218,7 +217,7 @@ pub fn render_add_table(
|
||||
Block::default()
|
||||
.title(Span::styled(" Columns ", theme.fg))
|
||||
.title_alignment(Alignment::Center)
|
||||
.borders(Borders::ALL) // Use ALL borders for consistency
|
||||
.borders(Borders::ALL)
|
||||
.border_type(BorderType::Rounded)
|
||||
.border_style(columns_border_style),
|
||||
)
|
||||
@@ -287,11 +286,10 @@ pub fn render_add_table(
|
||||
add_table_state.current_focus,
|
||||
)),
|
||||
);
|
||||
f.render_widget(add_button, add_button_area); // Render into the calculated area
|
||||
f.render_widget(add_button, add_button_area);
|
||||
|
||||
// --- Indexes Table Rendering ---
|
||||
let indexes_focused =
|
||||
add_table_state.current_focus == AddTableFocus::IndexesTable;
|
||||
let indexes_focused = matches!(add_table_state.current_focus, AddTableFocus::IndexesTable | AddTableFocus::InsideIndexesTable);
|
||||
let indexes_border_style = if indexes_focused {
|
||||
Style::default().fg(theme.highlight)
|
||||
} else {
|
||||
@@ -309,6 +307,7 @@ pub fn render_add_table(
|
||||
.iter()
|
||||
.map(|h| Cell::from(*h).style(Style::default().fg(theme.accent)));
|
||||
let index_header = Row::new(index_header_cells).height(1).bottom_margin(1);
|
||||
let indexes_highlight_symbol = if add_table_state.current_focus == AddTableFocus::InsideIndexesTable { " > " } else { " " };
|
||||
let indexes_table =
|
||||
Table::new(index_rows, [Constraint::Percentage(100)])
|
||||
.header(index_header)
|
||||
@@ -333,7 +332,7 @@ pub fn render_add_table(
|
||||
);
|
||||
|
||||
// --- Links Table Rendering ---
|
||||
let links_focused = add_table_state.current_focus == AddTableFocus::LinksTable;
|
||||
let links_focused = matches!(add_table_state.current_focus, AddTableFocus::LinksTable | AddTableFocus::InsideLinksTable);
|
||||
let links_border_style = if links_focused {
|
||||
Style::default().fg(theme.highlight)
|
||||
} else {
|
||||
@@ -350,10 +349,11 @@ pub fn render_add_table(
|
||||
.style(Style::default().fg(theme.fg))
|
||||
})
|
||||
.collect();
|
||||
let link_header_cells = ["Linked Table", "Req"]
|
||||
let link_header_cells = ["Linked Table", "Selected"]
|
||||
.iter()
|
||||
.map(|h| Cell::from(*h).style(Style::default().fg(theme.accent)));
|
||||
let link_header = Row::new(link_header_cells).height(1).bottom_margin(1);
|
||||
let links_highlight_symbol = if add_table_state.current_focus == AddTableFocus::InsideLinksTable { " > " } else { " " };
|
||||
let links_table =
|
||||
Table::new(link_rows, [Constraint::Percentage(80), Constraint::Min(5)])
|
||||
.header(link_header)
|
||||
@@ -381,9 +381,9 @@ pub fn render_add_table(
|
||||
let bottom_button_chunks = Layout::default()
|
||||
.direction(Direction::Horizontal)
|
||||
.constraints([
|
||||
Constraint::Percentage(33), // Save Button
|
||||
Constraint::Percentage(34), // Delete Button
|
||||
Constraint::Percentage(33), // Cancel Button
|
||||
Constraint::Percentage(33), // Save Button
|
||||
Constraint::Percentage(34), // Delete Button
|
||||
Constraint::Percentage(33), // Cancel Button
|
||||
])
|
||||
.split(bottom_buttons_area);
|
||||
|
||||
@@ -404,22 +404,22 @@ pub fn render_add_table(
|
||||
);
|
||||
f.render_widget(save_button, bottom_button_chunks[0]);
|
||||
|
||||
let delete_button = Paragraph::new(" Delete Selected ")
|
||||
.style(get_button_style(
|
||||
AddTableFocus::DeleteSelectedButton,
|
||||
add_table_state.current_focus,
|
||||
))
|
||||
.alignment(Alignment::Center)
|
||||
.block(
|
||||
Block::default()
|
||||
.borders(Borders::ALL)
|
||||
.border_type(BorderType::Rounded)
|
||||
.border_style(get_button_border_style(
|
||||
AddTableFocus::DeleteSelectedButton,
|
||||
add_table_state.current_focus,
|
||||
)),
|
||||
);
|
||||
f.render_widget(delete_button, bottom_button_chunks[1]);
|
||||
let delete_button = Paragraph::new(" Delete Selected ")
|
||||
.style(get_button_style(
|
||||
AddTableFocus::DeleteSelectedButton,
|
||||
add_table_state.current_focus,
|
||||
))
|
||||
.alignment(Alignment::Center)
|
||||
.block(
|
||||
Block::default()
|
||||
.borders(Borders::ALL)
|
||||
.border_type(BorderType::Rounded)
|
||||
.border_style(get_button_border_style(
|
||||
AddTableFocus::DeleteSelectedButton,
|
||||
add_table_state.current_focus,
|
||||
)),
|
||||
);
|
||||
f.render_widget(delete_button, bottom_button_chunks[1]);
|
||||
|
||||
let cancel_button = Paragraph::new(" Cancel ")
|
||||
.style(get_button_style(
|
||||
|
||||
Reference in New Issue
Block a user