Standing up global settings page. (#63)

* Adds markup to Settings page.

* Fixes card styling. Makes theme a dropdown. Fleshes out theme store and helpers.

* Settings wired up to backend. Omorphia package bumped.

* settings not syncing

* Further polishes Global Settings.

* Post-merge cleanup.

* Cleans up code. Ensures Java versions are present.

* Wires up auto-detect modal. Wires up Java version browse. Styling updates.

* Styling inputs. Adjusts modals.

* Removes theme helpers. Removes unnecessary classes.

* Always displays settings save btn. Watch code removed. New Card added.

* Cleans up merge from master. Adds AnimatedLogo to settings.

* Installs updated Omorphia. Removes unnecessary styles. Fixes loading logo position.

* Starts wiring up theming to settings. Adds Tauri command to get just theme.

* Settings page polish. allowList updated.

* Condenses modals into one. Implements JRE checking.

* Updates Omorphia package. Removes unnecessary styles.

* Removes get_theme. Styling changes.

* Changes appbar background for light-mode.

* Fixes

* fix color with var

---------

Co-authored-by: thesuzerain <wverchere@gmail.com>
Co-authored-by: Jai A <jaiagr+gpg@pm.me>
This commit is contained in:
Zach Baird
2023-04-21 17:45:50 -04:00
committed by GitHub
parent 6887c33b66
commit 16f297b546
17 changed files with 704 additions and 3041 deletions

View File

@@ -26,7 +26,7 @@ pub enum TheseusGuiError {
// Serializable error intermediary, so TheseusGuiError can be Serializable (eg: so that we can return theseus::Errors in Tauri directly)
#[derive(Error, Debug)]
pub enum TheseusSerializableError {
#[error("Theseus API error: {0}")]
#[error("{0}")]
Theseus(#[from] theseus::Error),
#[error("IO error: {0}")]
@@ -34,9 +34,6 @@ pub enum TheseusSerializableError {
#[error("No profile found at {0}")]
NoProfileFound(String),
#[error("Improperly formatted environment variables: {0}")]
BadEnvVars(String),
}
// Generic implementation of From<T> for ErrorTypeA
@@ -78,5 +75,4 @@ impl_serialize! {
Theseus,
IO,
NoProfileFound,
BadEnvVars,
}

View File

@@ -2,8 +2,6 @@ use crate::api::Result;
use serde::{Deserialize, Serialize};
use theseus::prelude::*;
use super::TheseusSerializableError;
// Identical to theseus::settings::Settings except for the custom_java_args field
// This allows us to split the custom_java_args string into a Vec<String> here and join it back into a string in the backend
#[derive(Serialize, Deserialize, Debug, Clone)]
@@ -53,18 +51,15 @@ pub async fn settings_set(settings: FrontendSettings) -> Result<()> {
.custom_env_args
.split_whitespace()
.map(|s| s.to_string())
.map(|f| {
.flat_map(|f| {
let mut split = f.split('=');
if let (Some(name), Some(value)) = (split.next(), split.next()) {
Ok((name.to_string(), value.to_string()))
Some((name.to_string(), value.to_string()))
} else {
Err(TheseusSerializableError::BadEnvVars(
"Invalid environment variable: {}".to_string(),
)
.into())
None
}
})
.collect::<Result<Vec<(String, String)>>>()?;
.collect::<Vec<(String, String)>>();
let backend_settings = Settings {
theme: settings.theme,