moving the state from general to each page owning its own state of button or canvas focus
This commit is contained in:
@@ -252,11 +252,14 @@ 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(get_button_style(
|
||||
AddLogicFocus::SaveButton,
|
||||
add_logic_state.current_focus(),
|
||||
))
|
||||
.style(if save_active {
|
||||
Style::default().fg(theme.highlight).add_modifier(Modifier::BOLD)
|
||||
} else {
|
||||
Style::default().fg(theme.secondary)
|
||||
})
|
||||
.alignment(Alignment::Center)
|
||||
.block(
|
||||
Block::default()
|
||||
@@ -269,11 +272,14 @@ 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(get_button_style(
|
||||
AddLogicFocus::CancelButton,
|
||||
add_logic_state.current_focus(),
|
||||
))
|
||||
.style(if cancel_active {
|
||||
Style::default().fg(theme.highlight).add_modifier(Modifier::BOLD)
|
||||
} else {
|
||||
Style::default().fg(theme.secondary)
|
||||
})
|
||||
.alignment(Alignment::Center)
|
||||
.block(
|
||||
Block::default()
|
||||
|
||||
Reference in New Issue
Block a user