hgame 0.26.4

CG production management structs, e.g. of assets, personnels, progress, etc.
Documentation
use super::*;
use mkutil::text::*;

#[derive(Debug, Clone, Default)]
#[cfg_attr(feature = "persistence", derive(Serialize, Deserialize))]

/// Ability to access projects on network server without any Database setups.
/// For this we don't need any Pan-project Umbrella and go straight to the Pan-project Members.
pub struct Offline {
    /// The raw "manually input string" of production scope.
    pub pp_members_input: String,
    pub pp_members: Vec<Project>,
}

impl Offline {
    pub fn parse(&mut self, draft: &str) {
        self.pp_members = ascii_from_comma_sep_singleline(draft, MAX_PROJECT_NAME_LENGTH)
            .into_iter()
            .map(|s| Project::Manual(s))
            .collect::<Vec<Project>>();
        // updates internal string so that it will be used in the next `TextEdit` frame
        self.pp_members_input = draft.to_owned();
    }

    #[cfg(feature = "gui")]
    pub fn projects_ui(&mut self, ui: &mut egui::Ui) -> egui::Response {
        ui.add(
            egui::TextEdit::singleline(&mut self.pp_members_input)
                .hint_text("Enter project codes, separated by commas"),
        )
    }
}