2025-05-14 10:13:29 -07:00
|
|
|
use ratatui::buffer::Buffer;
|
|
|
|
|
use ratatui::widgets::WidgetRef;
|
|
|
|
|
|
2025-05-15 14:50:30 -07:00
|
|
|
use crate::app_event_sender::AppEventSender;
|
2025-05-14 10:13:29 -07:00
|
|
|
use crate::status_indicator_widget::StatusIndicatorWidget;
|
|
|
|
|
|
|
|
|
|
use super::BottomPaneView;
|
|
|
|
|
use super::bottom_pane_view::ConditionalUpdate;
|
|
|
|
|
|
|
|
|
|
pub(crate) struct StatusIndicatorView {
|
|
|
|
|
view: StatusIndicatorWidget,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl StatusIndicatorView {
|
2025-07-25 01:56:40 -07:00
|
|
|
pub fn new(app_event_tx: AppEventSender) -> Self {
|
2025-05-14 10:13:29 -07:00
|
|
|
Self {
|
2025-07-25 01:56:40 -07:00
|
|
|
view: StatusIndicatorWidget::new(app_event_tx),
|
2025-05-14 10:13:29 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn update_text(&mut self, text: String) {
|
|
|
|
|
self.view.update_text(text);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-17 11:40:00 -07:00
|
|
|
impl BottomPaneView<'_> for StatusIndicatorView {
|
2025-05-14 10:13:29 -07:00
|
|
|
fn update_status_text(&mut self, text: String) -> ConditionalUpdate {
|
|
|
|
|
self.update_text(text);
|
|
|
|
|
ConditionalUpdate::NeedsRedraw
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn should_hide_when_task_is_done(&mut self) -> bool {
|
|
|
|
|
true
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-31 00:43:21 -07:00
|
|
|
fn desired_height(&self, width: u16) -> u16 {
|
|
|
|
|
self.view.desired_height(width)
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-25 01:56:40 -07:00
|
|
|
fn render(&self, area: ratatui::layout::Rect, buf: &mut Buffer) {
|
2025-05-14 10:13:29 -07:00
|
|
|
self.view.render_ref(area, buf);
|
|
|
|
|
}
|
|
|
|
|
}
|