refactor: clarify content and tui ownership

This commit is contained in:
objz committed 2026-07-27 11:03:46 +02:00
1 parent 078afe4b9d
commit 15d76c18a0
32 files changed
+893 -1144

No files matched your search

+2 -1
View File
@@ -1,9 +1,10 @@
mod render;
mod state;
pub use super::LoadState;
pub(crate) use render::render_select_list;
pub use render::{popup_rect, render};
pub use state::{LoadState, WizardParams, WizardState, WizardStep, handle_key, take_result};
pub use state::{WizardParams, WizardState, WizardStep, handle_key, take_result};
#[cfg(test)]
pub(crate) fn reset_for_test() {
@@ -1,9 +1,10 @@
// rendering for the new instance wizard. each step gets its own render fn
// and the popup resizes itself based on which step is active.
use super::super::LoadState;
use super::state::{
LoadState, WIZARD_STATE, WizardState, WizardStep, clamp_loader_version_index,
clamp_version_index, ensure_loader_versions_loaded, ensure_versions_loaded, visible_versions,
WIZARD_STATE, WizardState, WizardStep, clamp_loader_version_index, clamp_version_index,
ensure_loader_versions_loaded, ensure_versions_loaded, visible_versions,
};
use crate::config::theme::THEME;
use crate::instance::models::ModLoader;
+2 -9
View File
@@ -12,6 +12,8 @@ use std::sync::LazyLock;
use std::sync::{Arc, Mutex};
use tui_prompts::{FocusState, State as PromptState, TextState};
use super::super::LoadState;
pub(crate) static WIZARD_STATE: LazyLock<Arc<Mutex<WizardState>>> =
LazyLock::new(|| Arc::new(Mutex::new(WizardState::default())));
// populated on confirm, consumed by the main event loop to actually create the instance
@@ -36,15 +38,6 @@ pub enum WizardStep {
Confirm,
}
#[derive(Debug, Clone, Default)]
pub enum LoadState<T> {
#[default]
Idle,
Loading,
Loaded(T),
Error(String),
}
#[derive(Debug, Clone)]
pub struct WizardState {
pub step: WizardStep,