added config

This commit is contained in:
2026-02-13 22:03:18 -06:00
parent 8b562a2780
commit 5f07f6e611
5 changed files with 185 additions and 2 deletions

View File

@@ -1,3 +1,5 @@
mod core;
use std::{
io,
time::{Duration, Instant},
@@ -26,6 +28,7 @@ enum View {
struct App {
should_exit: bool,
status: String,
config_status: String,
view_stack: Vec<View>,
@@ -35,11 +38,16 @@ struct App {
impl Default for App {
fn default() -> Self {
let config_status = match core::config::load_config() {
Ok(cfg) => format!("config: ok ({})", cfg.base_url),
Err(e) => format!("config: missing/invalid ({:?})", e),
};
Self {
should_exit: false,
status: "Press q to quit".to_string(),
config_status,
view_stack: vec![View::Categories],
items: vec![
"Shows".into(),
"Movies".into(),
@@ -178,7 +186,8 @@ fn ui(frame: &mut Frame, app: &App) {
panes.left_output,
);
frame.render_widget(
Block::bordered().title("Info").merge_borders(MergeStrategy::Exact),
Paragraph::new(app.config_status.as_str())
.block(Block::bordered().title("Info").merge_borders(MergeStrategy::Exact)),
panes.right_output,
);
}