| 1 | use ratatui::layout::{Constraint, Direction}; |
| 2 | use serde::{Deserialize, Serialize}; |
| 3 | |
| 4 | use crate::ui::{ |
| 5 | popup::PopupConfig, |
| 6 | tabs::{DeviceColumnKind, NetworkColumnKind, TableConfig}, |
| 7 | toast::ToastConfig, |
| 8 | }; |
| 9 | |
| 10 | pub mod area; |
| 11 | pub mod header; |
| 12 | pub mod help; |
| 13 | pub mod input; |
| 14 | pub mod list; |
| 15 | pub mod margin; |
| 16 | pub mod popup; |
| 17 | pub mod style_config; |
| 18 | pub mod tabs; |
| 19 | pub mod toast; |
| 20 | |
| 21 | #[derive(Deserialize, Serialize)] |
| 22 | pub struct Ui { |
| 23 | pub layout: LayoutConfig, |
| 24 | |
| 25 | // Tables |
| 26 | pub known_networks: TableConfig<NetworkColumnKind>, |
| 27 | pub available_networks: TableConfig<NetworkColumnKind>, |
| 28 | pub devices: TableConfig<DeviceColumnKind>, |
| 29 | |
| 30 | // Popups |
| 31 | pub password_popup: PopupConfig, |
| 32 | pub toast: ToastConfig, |
| 33 | } |
| 34 | |
| 35 | #[derive(Deserialize, Serialize)] |
| 36 | pub struct LayoutConfig { |
| 37 | pub direction: Direction, |
| 38 | pub panels: Vec<PanelConfig>, |
| 39 | } |
| 40 | |
| 41 | #[derive(Deserialize, Serialize)] |
| 42 | pub struct PanelConfig { |
| 43 | pub kind: PanelKind, |
| 44 | pub constraint: Constraint, |
| 45 | } |
| 46 | |
| 47 | #[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq)] |
| 48 | pub enum PanelKind { |
| 49 | Header, |
| 50 | KnownNetworks, |
| 51 | AvailableNetworks, |
| 52 | Devices, |
| 53 | Help, |
| 54 | } |
