Updated tracking indicator
This commit is contained in:
parent
f9459edf09
commit
ace5c1bf33
1 changed files with 39 additions and 28 deletions
43
src/ui.rs
43
src/ui.rs
|
|
@ -170,14 +170,35 @@ fn render_new_entry(frame: &mut Frame, app: &App) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_bottom_bar(frame: &mut Frame, area: Rect, app: &App) {
|
fn render_bottom_bar(frame: &mut Frame, area: Rect, app: &App) {
|
||||||
// Render status message if present
|
// Split the bottom bar into left (tracking indicator) and right (help/status)
|
||||||
|
let chunks = Layout::default()
|
||||||
|
.direction(Direction::Horizontal)
|
||||||
|
.constraints([Constraint::Percentage(70), Constraint::Percentage(30)])
|
||||||
|
.split(area);
|
||||||
|
|
||||||
|
// Left side: Tracking indicator (only when actively tracking)
|
||||||
|
if let Some((active_item, _)) = &app.state.active_timer {
|
||||||
|
let tracking_text = if !active_item.tags.is_empty() {
|
||||||
|
format!("❯❯ Tracking {} [{}] ❯❯", active_item.tags.join(", "), active_item.name)
|
||||||
|
} else {
|
||||||
|
format!("❯❯ Tracking {} ❯❯", active_item.name)
|
||||||
|
};
|
||||||
|
|
||||||
|
let tracking = Paragraph::new(tracking_text)
|
||||||
|
.alignment(Alignment::Left)
|
||||||
|
.style(Style::default().fg(ACTIVE_COLOR).add_modifier(Modifier::BOLD));
|
||||||
|
frame.render_widget(tracking, chunks[0]);
|
||||||
|
}
|
||||||
|
// No else - show nothing when not tracking
|
||||||
|
|
||||||
|
// Right side: Status message or help hint
|
||||||
if let Some((ref message, _)) = app.status_message {
|
if let Some((ref message, _)) = app.status_message {
|
||||||
let text = Paragraph::new(message.as_str())
|
let text = Paragraph::new(message.as_str())
|
||||||
.style(Style::default().fg(Color::Yellow))
|
.style(Style::default().fg(Color::Yellow))
|
||||||
.alignment(Alignment::Center);
|
.alignment(Alignment::Right);
|
||||||
frame.render_widget(text, area);
|
frame.render_widget(text, chunks[1]);
|
||||||
} else if app.config.show_help_hint {
|
} else if app.config.show_help_hint {
|
||||||
render_help_hint(frame, area);
|
render_help_hint(frame, chunks[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -343,7 +364,7 @@ fn render_section(
|
||||||
items: &[TimeItem],
|
items: &[TimeItem],
|
||||||
is_active: bool,
|
is_active: bool,
|
||||||
selected: usize,
|
selected: usize,
|
||||||
state: &AppState,
|
_state: &AppState,
|
||||||
) {
|
) {
|
||||||
let border_color = if is_active {
|
let border_color = if is_active {
|
||||||
ACTIVE_COLOR
|
ACTIVE_COLOR
|
||||||
|
|
@ -360,17 +381,7 @@ fn render_section(
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.map(|(i, item)| {
|
.map(|(i, item)| {
|
||||||
let is_running = state
|
let style = if i == selected && is_active {
|
||||||
.active_timer
|
|
||||||
.as_ref()
|
|
||||||
.map(|(active, _)| active.name == item.name)
|
|
||||||
.unwrap_or(false);
|
|
||||||
|
|
||||||
let style = if is_running {
|
|
||||||
Style::default()
|
|
||||||
.fg(ACTIVE_COLOR)
|
|
||||||
.add_modifier(Modifier::BOLD)
|
|
||||||
} else if i == selected && is_active {
|
|
||||||
Style::default()
|
Style::default()
|
||||||
.fg(border_color)
|
.fg(border_color)
|
||||||
.add_modifier(Modifier::REVERSED)
|
.add_modifier(Modifier::REVERSED)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue