From b25469208f999dd44e7884c42f525d48dca05a32 Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Tue, 17 Sep 2024 18:31:39 -0700 Subject: [PATCH] move render file up a level --- packages/cli/src/serve/mod.rs | 1 + packages/cli/src/serve/output.rs | 14 +++++++------- packages/cli/src/serve/{output => }/render.rs | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) rename packages/cli/src/serve/{output => }/render.rs (99%) diff --git a/packages/cli/src/serve/mod.rs b/packages/cli/src/serve/mod.rs index de16c4c5a..b739d66d5 100644 --- a/packages/cli/src/serve/mod.rs +++ b/packages/cli/src/serve/mod.rs @@ -17,6 +17,7 @@ mod hot_reloading_file_map; mod logs_tab; mod output; mod proxy; +mod render; mod server; mod watcher; diff --git a/packages/cli/src/serve/output.rs b/packages/cli/src/serve/output.rs index 37deafa75..1a34ae56c 100644 --- a/packages/cli/src/serve/output.rs +++ b/packages/cli/src/serve/output.rs @@ -36,7 +36,7 @@ use tokio::{ }; use tracing::Level; -mod render; +use super::render; // How many lines should be scroll on each mouse scroll or arrow key input. const SCROLL_SPEED: u16 = 2; @@ -47,7 +47,7 @@ const SCROLL_MODIFIER_KEY: KeyModifiers = KeyModifiers::SHIFT; #[derive(Default)] pub struct BuildProgress { - current_builds: HashMap, + pub(crate) current_builds: HashMap, } impl BuildProgress { @@ -700,9 +700,9 @@ impl Output { #[derive(Default, Debug, PartialEq)] pub struct ActiveBuild { - stage: Stage, - progress: f64, - failed: Option, + pub stage: Stage, + pub progress: f64, + pub failed: Option, } impl ActiveBuild { @@ -727,7 +727,7 @@ impl ActiveBuild { } } - fn make_spans(&self, area: Rect) -> Vec { + pub fn make_spans(&self, area: Rect) -> Vec { let mut spans = Vec::new(); let message = match self.stage { @@ -757,7 +757,7 @@ impl ActiveBuild { spans } - fn max_layout_size(&self) -> u16 { + pub fn max_layout_size(&self) -> u16 { let progress_size = 4; let stage_size = self.stage.to_string().len() as u16; let brace_size = 2; diff --git a/packages/cli/src/serve/output/render.rs b/packages/cli/src/serve/render.rs similarity index 99% rename from packages/cli/src/serve/output/render.rs rename to packages/cli/src/serve/render.rs index 6adfcae73..f25dd17ff 100644 --- a/packages/cli/src/serve/output/render.rs +++ b/packages/cli/src/serve/render.rs @@ -1,5 +1,5 @@ -use super::{BuildProgress, TraceMsg, TraceSrc}; -use crate::config::Platform; +use super::BuildProgress; +use crate::{config::Platform, TraceMsg, TraceSrc}; use ansi_to_tui::IntoText as _; use ratatui::{ layout::{Alignment, Constraint, Direction, Layout, Rect},