Enhanced BulkAction: 7 options, arrow navigation, PickList, visual selection
- Added: Mark as uncomplete, Set due Tomorrow, Set due Next Week - Added: Move to existing list (PickList popup) - ↑/↓ navigate options, Enter executes, 1-7 for number shortcuts - Selected tasks now show bg(DarkGray) for clearer visual feedback - BulkAction popup with 7 options, PickList popup for list selection
This commit is contained in:
+72
-25
@@ -127,7 +127,7 @@ pub fn render_task_list(
|
||||
};
|
||||
|
||||
let checkbox_style = if is_selected {
|
||||
Style::default().fg(Color::Yellow).add_modifier(Modifier::BOLD)
|
||||
Style::default().fg(Color::Yellow).add_modifier(Modifier::BOLD).bg(Color::DarkGray)
|
||||
} else if task.status == TaskStatus::Completed {
|
||||
Style::default().fg(Color::Green)
|
||||
} else {
|
||||
@@ -135,7 +135,7 @@ pub fn render_task_list(
|
||||
};
|
||||
|
||||
let title_style = if is_selected {
|
||||
Style::default().fg(Color::Yellow).add_modifier(Modifier::BOLD)
|
||||
Style::default().fg(Color::Yellow).add_modifier(Modifier::BOLD).bg(Color::DarkGray)
|
||||
} else {
|
||||
Style::default().fg(DETAIL_COLOR).add_modifier(
|
||||
if task.status == TaskStatus::Completed {
|
||||
@@ -507,8 +507,8 @@ pub fn render_confirm_popup(frame: &mut Frame, area: Rect) {
|
||||
frame.render_widget(paragraph, popup_area);
|
||||
}
|
||||
|
||||
pub fn render_bulk_action_popup(frame: &mut Frame, area: Rect, count: usize) {
|
||||
let popup_area = centered_rect(55, 9, area);
|
||||
pub fn render_bulk_action_popup(frame: &mut Frame, area: Rect, count: usize, selected: usize) {
|
||||
let popup_area = centered_rect(55, 12, area);
|
||||
frame.render_widget(Clear, popup_area);
|
||||
let block = Block::default()
|
||||
.borders(Borders::ALL)
|
||||
@@ -517,28 +517,75 @@ pub fn render_bulk_action_popup(frame: &mut Frame, area: Rect, count: usize) {
|
||||
.title(format!(" Bulk Actions ({} selected) ", count))
|
||||
.title_alignment(Alignment::Left);
|
||||
|
||||
let text = Text::from(vec![
|
||||
Line::from(""),
|
||||
Line::from(Span::styled(
|
||||
" 1. Mark as completed",
|
||||
Style::default().fg(Color::Cyan),
|
||||
)),
|
||||
Line::from(Span::styled(
|
||||
" 2. Set due date to Today",
|
||||
Style::default().fg(Color::Cyan),
|
||||
)),
|
||||
Line::from(Span::styled(
|
||||
" 3. Move to new list...",
|
||||
Style::default().fg(Color::Cyan),
|
||||
)),
|
||||
Line::from(""),
|
||||
Line::from(Span::styled(
|
||||
" Press 1-3 or Esc to cancel",
|
||||
Style::default().fg(Color::DarkGray),
|
||||
)),
|
||||
]);
|
||||
let options = [
|
||||
"1. Mark as completed",
|
||||
"2. Mark as uncomplete",
|
||||
"3. Set due date to Today",
|
||||
"4. Set due date to Tomorrow",
|
||||
"5. Set due date to Next Week",
|
||||
"6. Move to new list...",
|
||||
"7. Move to existing list...",
|
||||
];
|
||||
|
||||
let paragraph = Paragraph::new(text)
|
||||
let mut lines = vec![Line::from("")];
|
||||
for (i, opt) in options.iter().enumerate() {
|
||||
let style = if i == selected {
|
||||
Style::default().fg(FOCUS_COLOR).add_modifier(Modifier::BOLD)
|
||||
} else {
|
||||
Style::default().fg(Color::Cyan)
|
||||
};
|
||||
lines.push(Line::from(Span::styled(
|
||||
format!(" {}", opt),
|
||||
style,
|
||||
)));
|
||||
}
|
||||
lines.push(Line::from(""));
|
||||
lines.push(Line::from(Span::styled(
|
||||
" ↑/↓: navigate Enter:ok 1-7:shortcut Esc:cancel",
|
||||
Style::default().fg(Color::DarkGray),
|
||||
)));
|
||||
|
||||
let paragraph = Paragraph::new(Text::from(lines))
|
||||
.block(block)
|
||||
.alignment(Alignment::Left);
|
||||
|
||||
frame.render_widget(paragraph, popup_area);
|
||||
}
|
||||
|
||||
pub fn render_pick_list_popup(
|
||||
frame: &mut Frame,
|
||||
area: Rect,
|
||||
lists: &[(String, String)],
|
||||
selected: usize,
|
||||
) {
|
||||
let popup_area = centered_rect(60, 10, area);
|
||||
frame.render_widget(Clear, popup_area);
|
||||
let block = Block::default()
|
||||
.borders(Borders::ALL)
|
||||
.style(Style::default().bg(POPUP_BG))
|
||||
.border_style(Style::default().fg(POPUP_BORDER))
|
||||
.title(" Select List ")
|
||||
.title_alignment(Alignment::Left);
|
||||
|
||||
let mut lines = vec![Line::from("")];
|
||||
for (i, (title, _)) in lists.iter().enumerate() {
|
||||
let style = if i == selected {
|
||||
Style::default().fg(FOCUS_COLOR).add_modifier(Modifier::BOLD)
|
||||
} else {
|
||||
Style::default().fg(Color::Cyan)
|
||||
};
|
||||
lines.push(Line::from(Span::styled(
|
||||
format!(" {}", title),
|
||||
style,
|
||||
)));
|
||||
}
|
||||
lines.push(Line::from(""));
|
||||
lines.push(Line::from(Span::styled(
|
||||
" ↑/↓: navigate Enter:ok Esc:cancel",
|
||||
Style::default().fg(Color::DarkGray),
|
||||
)));
|
||||
|
||||
let paragraph = Paragraph::new(Text::from(lines))
|
||||
.block(block)
|
||||
.alignment(Alignment::Left);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user