Update project display and assignment dialog
This commit is contained in:
parent
e661ad8ba1
commit
f9459edf09
2 changed files with 26 additions and 22 deletions
31
src/ui.rs
31
src/ui.rs
|
|
@ -240,7 +240,7 @@ fn render_help(frame: &mut Frame, app: &App) {
|
|||
"Main Commands:",
|
||||
"Enter - Start/stop timer",
|
||||
"d - Delete task from list",
|
||||
"p - Reassign project/tag",
|
||||
"p - Reassign project name",
|
||||
"v - View Watson log",
|
||||
"Ctrl+e - Edit tasks config file",
|
||||
"c - Edit app config file",
|
||||
|
|
@ -378,12 +378,13 @@ fn render_section(
|
|||
Style::default()
|
||||
};
|
||||
|
||||
let mut line = item.name.clone();
|
||||
if !item.tags.is_empty() {
|
||||
line.push_str(" [");
|
||||
line.push_str(&item.tags.join(", "));
|
||||
line.push(']');
|
||||
}
|
||||
let line = if !item.tags.is_empty() {
|
||||
// Display as: tag [project]
|
||||
format!("{} [{}]", item.tags.join(", "), item.name)
|
||||
} else {
|
||||
// No tags, just show project
|
||||
item.name.clone()
|
||||
};
|
||||
|
||||
ListItem::new(Line::from(vec![Span::styled(line, style)]))
|
||||
})
|
||||
|
|
@ -422,14 +423,20 @@ fn render_reassign_project(frame: &mut Frame, app: &App) {
|
|||
_ => &app.state.permanent_items,
|
||||
};
|
||||
|
||||
let current_item_name = items
|
||||
let current_item_display = items
|
||||
.get(app.state.selected_indices[app.state.current_pane])
|
||||
.map(|item| item.name.as_str())
|
||||
.unwrap_or("");
|
||||
.map(|item| {
|
||||
if !item.tags.is_empty() {
|
||||
format!("{} [{}]", item.tags.join(", "), item.name)
|
||||
} else {
|
||||
item.name.clone()
|
||||
}
|
||||
})
|
||||
.unwrap_or_default();
|
||||
|
||||
// Project input
|
||||
let project_block = Block::default()
|
||||
.title(format!("Reassign Tag for: {}", current_item_name))
|
||||
.title(format!("Reassign Project for: {}", current_item_display))
|
||||
.borders(Borders::ALL)
|
||||
.style(Style::default().fg(ACTIVE_COLOR));
|
||||
|
||||
|
|
@ -448,7 +455,7 @@ fn render_reassign_project(frame: &mut Frame, app: &App) {
|
|||
frame.render_widget(project_paragraph, chunks[0]);
|
||||
|
||||
// Help text
|
||||
let help_text = Paragraph::new("Enter new tag (leave empty to remove), press Enter to save, Esc to cancel")
|
||||
let help_text = Paragraph::new("Enter new project name, press Enter to save, Esc to cancel")
|
||||
.style(Style::default().fg(Color::DarkGray))
|
||||
.alignment(Alignment::Center);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue