1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
mod pods;

pub use pods::*;

use crate::input::key::Key;
use crate::ui::StateRenderer;

pub enum AppState {
    Initializing,
    Pods(Pods),
    Deployments,
}

impl AppState {
    pub fn render<R: StateRenderer>(&self, r: R) {
        match self {
            Self::Pods(pods) => pods.render(r),
            _ => {}
        }
    }

    pub async fn on_key(&self, key: Key) {
        match self {
            Self::Pods(pods) => {
                pods.on_key(key).await;
            }
            _ => {}
        }
    }
}

impl Default for AppState {
    fn default() -> Self {
        Self::Initializing
    }
}