feat(fxt): wire Pods cockpit as key 7, update event loop

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jgrusewski
2026-03-04 13:11:49 +01:00
parent 87b01cdbd5
commit ae0b2ed817
2 changed files with 9 additions and 7 deletions

View File

@@ -26,6 +26,7 @@ use crate::grpc::FoxhuntClient;
use super::cockpit::Cockpit;
use super::cockpits::data::DataCockpit;
use super::cockpits::overview::OverviewCockpit;
use super::cockpits::pods::PodsCockpit;
use super::cockpits::risk::RiskCockpit;
use super::cockpits::services::ServicesCockpit;
use super::cockpits::trading::TradingCockpit;
@@ -35,7 +36,7 @@ use super::state::{AppState, ConnectionStatus};
use super::theme;
/// Number of cockpit views.
const COCKPIT_COUNT: usize = 6;
const COCKPIT_COUNT: usize = 7;
/// Tick interval for the event loop (1 second).
const TICK_RATE: Duration = Duration::from_secs(1);
@@ -166,6 +167,7 @@ async fn event_loop(
Box::new(ServicesCockpit),
Box::new(RiskCockpit),
Box::new(DataCockpit),
Box::new(PodsCockpit),
];
loop {
@@ -212,7 +214,7 @@ async fn event_loop(
}
// Cockpit switching (1-6)
KeyCode::Char(c @ '1'..='6') => {
KeyCode::Char(c @ '1'..='7') => {
let idx = (c as usize).saturating_sub('1' as usize);
if idx < COCKPIT_COUNT {
state.current_cockpit = idx;
@@ -400,7 +402,7 @@ fn render_status_bar(frame: &mut ratatui::Frame, area: Rect, state: &AppState) {
Span::styled(" help ", theme::muted_style()),
Span::styled("r", Style::default().fg(theme::SECONDARY)),
Span::styled(" refresh ", theme::muted_style()),
Span::styled("1-6", Style::default().fg(theme::SECONDARY)),
Span::styled("1-7", Style::default().fg(theme::SECONDARY)),
Span::styled(" switch cockpit ", theme::muted_style()),
Span::styled(
format!("Updated: {ago}"),
@@ -428,7 +430,7 @@ fn render_help_overlay(frame: &mut ratatui::Frame, area: Rect) {
let help_text = vec![
Line::from(""),
Line::from(vec![
Span::styled(" 1-6 ", Style::default().fg(theme::SECONDARY)),
Span::styled(" 1-7 ", Style::default().fg(theme::SECONDARY)),
Span::styled("Switch cockpit view", Style::default().fg(theme::TEXT)),
]),
Line::from(vec![
@@ -457,7 +459,7 @@ fn render_help_overlay(frame: &mut ratatui::Frame, area: Rect) {
theme::muted_style(),
)]),
Line::from(vec![Span::styled(
" Services | Risk | Data",
" Services | Risk | Data | Pods",
theme::muted_style(),
)]),
];

View File

@@ -29,9 +29,9 @@ impl Default for ConnectionStatus {
// Top-level state
// ---------------------------------------------------------------------------
/// Root state shared across all six cockpit views.
/// Root state shared across all seven cockpit views.
pub struct AppState {
/// Active cockpit index (0..=5).
/// Active cockpit index (0..=6).
pub current_cockpit: usize,
/// Whether the help overlay is visible.
pub show_help: bool,