Skip to content

Commit

Permalink
refactor(mode): move Mode to app module
Browse files Browse the repository at this point in the history
  • Loading branch information
joshka committed Jul 14, 2024
1 parent 530ea7c commit 642b2c9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
9 changes: 8 additions & 1 deletion component/template/src/app.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use color_eyre::Result;
use crossterm::event::KeyEvent;
use ratatui::prelude::Rect;
use serde::{Deserialize, Serialize};
use tokio::sync::mpsc;
use tracing::{debug, info};

use crate::{
action::Action,
components::{fps::FpsCounter, home::Home, Component},
config::Config,
mode::Mode,
tui::{Event, Tui},
};

Expand All @@ -25,6 +25,13 @@ pub struct App {
action_rx: mpsc::UnboundedReceiver<Action>,
}

#[derive(Default, Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Mode {
#[default]
Home,
}


impl App {
pub fn new(tick_rate: f64, frame_rate: f64) -> Result<Self> {
let (action_tx, action_rx) = mpsc::unbounded_channel();
Expand Down
2 changes: 1 addition & 1 deletion component/template/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use ratatui::style::{Color, Modifier, Style};
use serde::{de::Deserializer, Deserialize};
use tracing::error;

use crate::{action::Action, mode::Mode};
use crate::{action::Action, app::Mode};

const CONFIG: &str = include_str!("../.config/config.json5");

Expand Down
1 change: 0 additions & 1 deletion component/template/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ mod components;
mod config;
mod error_handling;
mod logging;
mod mode;
mod tui;

#[tokio::main]
Expand Down
7 changes: 0 additions & 7 deletions component/template/src/mode.rs

This file was deleted.

0 comments on commit 642b2c9

Please sign in to comment.