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);
|
.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 ")
|
let save_button = Paragraph::new(" Save Logic ")
|
||||||
.style(if save_active {
|
.style(get_button_style(
|
||||||
Style::default().fg(theme.highlight).add_modifier(Modifier::BOLD)
|
AddLogicFocus::SaveButton,
|
||||||
} else {
|
add_logic_state.current_focus(),
|
||||||
Style::default().fg(theme.secondary)
|
))
|
||||||
})
|
|
||||||
.alignment(Alignment::Center)
|
.alignment(Alignment::Center)
|
||||||
.block(
|
.block(
|
||||||
Block::default()
|
Block::default()
|
||||||
@@ -272,14 +269,11 @@ pub fn render_add_logic(
|
|||||||
);
|
);
|
||||||
f.render_widget(save_button, button_chunks[0]);
|
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 ")
|
let cancel_button = Paragraph::new(" Cancel ")
|
||||||
.style(if cancel_active {
|
.style(get_button_style(
|
||||||
Style::default().fg(theme.highlight).add_modifier(Modifier::BOLD)
|
AddLogicFocus::CancelButton,
|
||||||
} else {
|
add_logic_state.current_focus(),
|
||||||
Style::default().fg(theme.secondary)
|
))
|
||||||
})
|
|
||||||
.alignment(Alignment::Center)
|
.alignment(Alignment::Center)
|
||||||
.block(
|
.block(
|
||||||
Block::default()
|
Block::default()
|
||||||
|
|||||||
@@ -489,10 +489,8 @@ pub fn render_add_table(
|
|||||||
])
|
])
|
||||||
.split(bottom_buttons_area);
|
.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 ")
|
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)
|
Style::default().fg(theme.highlight).add_modifier(Modifier::BOLD)
|
||||||
} else {
|
} else {
|
||||||
Style::default().fg(theme.secondary)
|
Style::default().fg(theme.secondary)
|
||||||
@@ -509,37 +507,39 @@ pub fn render_add_table(
|
|||||||
);
|
);
|
||||||
f.render_widget(save_button, bottom_button_chunks[0]);
|
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 ")
|
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)
|
Style::default().fg(theme.highlight).add_modifier(Modifier::BOLD)
|
||||||
} else {
|
} else {
|
||||||
Style::default().fg(theme.secondary)
|
Style::default().fg(theme.secondary)
|
||||||
})
|
})
|
||||||
.alignment(Alignment::Center)
|
.alignment(Alignment::Center)
|
||||||
.block(
|
.block(
|
||||||
Block::default()
|
Block::default()
|
||||||
.borders(Borders::ALL)
|
.borders(Borders::ALL)
|
||||||
.border_type(BorderType::Rounded)
|
.border_type(BorderType::Rounded)
|
||||||
.border_style(get_button_border_style(delete_active, theme)),
|
.border_style(get_button_border_style(
|
||||||
|
add_table_state.current_focus() == AddTableFocus::DeleteSelectedButton,
|
||||||
|
theme,
|
||||||
|
)),
|
||||||
);
|
);
|
||||||
f.render_widget(delete_button, bottom_button_chunks[1]);
|
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 ")
|
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)
|
Style::default().fg(theme.highlight).add_modifier(Modifier::BOLD)
|
||||||
} else {
|
} else {
|
||||||
Style::default().fg(theme.secondary)
|
Style::default().fg(theme.secondary)
|
||||||
})
|
})
|
||||||
.alignment(Alignment::Center)
|
.alignment(Alignment::Center)
|
||||||
.block(
|
.block(
|
||||||
Block::default()
|
Block::default()
|
||||||
.borders(Borders::ALL)
|
.borders(Borders::ALL)
|
||||||
.border_type(BorderType::Rounded)
|
.border_type(BorderType::Rounded)
|
||||||
.border_style(get_button_border_style(cancel_active, theme)),
|
.border_style(get_button_border_style(
|
||||||
|
add_table_state.current_focus() == AddTableFocus::CancelButton,
|
||||||
|
theme,
|
||||||
|
)),
|
||||||
);
|
);
|
||||||
f.render_widget(cancel_button, bottom_button_chunks[2]);
|
f.render_widget(cancel_button, bottom_button_chunks[2]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user