buttons in add_logic and add_table works properly well now
This commit is contained in:
@@ -252,14 +252,11 @@ pub fn render_add_logic(
|
||||
])
|
||||
.split(buttons_area);
|
||||
|
||||
let save_active = add_logic_state.focus_outside_canvas
|
||||
&& add_logic_state.focused_button_index == 0;
|
||||
let save_button = Paragraph::new(" Save Logic ")
|
||||
.style(if save_active {
|
||||
Style::default().fg(theme.highlight).add_modifier(Modifier::BOLD)
|
||||
} else {
|
||||
Style::default().fg(theme.secondary)
|
||||
})
|
||||
.style(get_button_style(
|
||||
AddLogicFocus::SaveButton,
|
||||
add_logic_state.current_focus(),
|
||||
))
|
||||
.alignment(Alignment::Center)
|
||||
.block(
|
||||
Block::default()
|
||||
@@ -272,14 +269,11 @@ pub fn render_add_logic(
|
||||
);
|
||||
f.render_widget(save_button, button_chunks[0]);
|
||||
|
||||
let cancel_active = add_logic_state.focus_outside_canvas
|
||||
&& add_logic_state.focused_button_index == 1;
|
||||
let cancel_button = Paragraph::new(" Cancel ")
|
||||
.style(if cancel_active {
|
||||
Style::default().fg(theme.highlight).add_modifier(Modifier::BOLD)
|
||||
} else {
|
||||
Style::default().fg(theme.secondary)
|
||||
})
|
||||
.style(get_button_style(
|
||||
AddLogicFocus::CancelButton,
|
||||
add_logic_state.current_focus(),
|
||||
))
|
||||
.alignment(Alignment::Center)
|
||||
.block(
|
||||
Block::default()
|
||||
|
||||
@@ -489,10 +489,8 @@ pub fn render_add_table(
|
||||
])
|
||||
.split(bottom_buttons_area);
|
||||
|
||||
let save_active = add_table_state.focus_outside_canvas
|
||||
&& add_table_state.focused_button_index == 0;
|
||||
let save_button = Paragraph::new(" Save table ")
|
||||
.style(if save_active {
|
||||
.style(if add_table_state.current_focus() == AddTableFocus::SaveButton {
|
||||
Style::default().fg(theme.highlight).add_modifier(Modifier::BOLD)
|
||||
} else {
|
||||
Style::default().fg(theme.secondary)
|
||||
@@ -509,37 +507,39 @@ pub fn render_add_table(
|
||||
);
|
||||
f.render_widget(save_button, bottom_button_chunks[0]);
|
||||
|
||||
let delete_active = add_table_state.focus_outside_canvas
|
||||
&& add_table_state.focused_button_index == 1;
|
||||
let delete_button = Paragraph::new(" Delete Selected ")
|
||||
.style(if delete_active {
|
||||
.style(if add_table_state.current_focus() == AddTableFocus::DeleteSelectedButton {
|
||||
Style::default().fg(theme.highlight).add_modifier(Modifier::BOLD)
|
||||
} else {
|
||||
Style::default().fg(theme.secondary)
|
||||
})
|
||||
.alignment(Alignment::Center)
|
||||
.alignment(Alignment::Center)
|
||||
.block(
|
||||
Block::default()
|
||||
.borders(Borders::ALL)
|
||||
.border_type(BorderType::Rounded)
|
||||
.border_style(get_button_border_style(delete_active, theme)),
|
||||
.borders(Borders::ALL)
|
||||
.border_type(BorderType::Rounded)
|
||||
.border_style(get_button_border_style(
|
||||
add_table_state.current_focus() == AddTableFocus::DeleteSelectedButton,
|
||||
theme,
|
||||
)),
|
||||
);
|
||||
f.render_widget(delete_button, bottom_button_chunks[1]);
|
||||
|
||||
let cancel_active = add_table_state.focus_outside_canvas
|
||||
&& add_table_state.focused_button_index == 2;
|
||||
let cancel_button = Paragraph::new(" Cancel ")
|
||||
.style(if cancel_active {
|
||||
.style(if add_table_state.current_focus() == AddTableFocus::CancelButton {
|
||||
Style::default().fg(theme.highlight).add_modifier(Modifier::BOLD)
|
||||
} else {
|
||||
Style::default().fg(theme.secondary)
|
||||
})
|
||||
.alignment(Alignment::Center)
|
||||
.alignment(Alignment::Center)
|
||||
.block(
|
||||
Block::default()
|
||||
.borders(Borders::ALL)
|
||||
.border_type(BorderType::Rounded)
|
||||
.border_style(get_button_border_style(cancel_active, theme)),
|
||||
.borders(Borders::ALL)
|
||||
.border_type(BorderType::Rounded)
|
||||
.border_style(get_button_border_style(
|
||||
add_table_state.current_focus() == AddTableFocus::CancelButton,
|
||||
theme,
|
||||
)),
|
||||
);
|
||||
f.render_widget(cancel_button, bottom_button_chunks[2]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user