1pub mod shell;
4pub mod context;
5pub mod explanation;
6pub mod help;
7pub mod lesson;
8pub mod lesson_menu;
9pub mod onboarding;
10pub mod settings;
11pub mod achievements;
12pub mod progress;
13pub mod challenges;
14pub mod notification;
15
16use ratatui::{layout::Rect, Frame};
17
18#[derive(Debug, Clone, Copy, PartialEq, Eq)]
20pub enum PanelId {
21 Shell,
22 Output,
23 Context,
24 Explanation,
25}
26
27impl PanelId {
28 pub fn next(self) -> Self {
30 match self {
31 Self::Shell => Self::Output,
32 Self::Output => Self::Context,
33 Self::Context => Self::Explanation,
34 Self::Explanation => Self::Shell,
35 }
36 }
37
38 pub fn previous(self) -> Self {
40 match self {
41 Self::Shell => Self::Explanation,
42 Self::Output => Self::Shell,
43 Self::Context => Self::Output,
44 Self::Explanation => Self::Context,
45 }
46 }
47
48 pub fn title(self) -> &'static str {
50 match self {
51 Self::Shell => "Shell",
52 Self::Output => "Output",
53 Self::Context => "Context",
54 Self::Explanation => "Learning",
55 }
56 }
57}
58
59pub trait Panel {
61 fn render(&self, frame: &mut Frame, area: Rect, focused: bool);
63
64 fn handle_input(&mut self, key: crossterm::event::KeyEvent) -> bool;
66}