A ton of AI assisted web development

This commit is contained in:
Thomas Faour
2025-06-21 23:29:14 -04:00
parent a8fcb5a7d9
commit e59d1d90b3
40 changed files with 8990 additions and 139 deletions
+24
View File
@@ -0,0 +1,24 @@
[package]
name = "orbital-simulator-gui"
version = "0.1.0"
description = "Desktop GUI for Orbital Simulator"
authors = ["Thomas Faour"]
license = "MIT"
repository = ""
edition = "2021"
[build-dependencies]
tauri-build = { version = "1.0", features = [] }
[dependencies]
tauri = { version = "1.0", features = ["api-all"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tokio = { version = "1", features = ["full"] }
[features]
# by default Tauri runs in production mode
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
default = ["custom-protocol"]
# this feature is used for production builds or when `devPath` points to the filesystem
custom-protocol = ["tauri/custom-protocol"]
+106
View File
@@ -0,0 +1,106 @@
#![cfg_attr(
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]
use tauri::{command, Context, generate_handler, generate_context};
use std::process::Command;
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize)]
struct SimulationConfig {
name: String,
path: String,
description: String,
}
#[command]
async fn get_available_configs() -> Result<Vec<SimulationConfig>, String> {
let configs = vec![
SimulationConfig {
name: "Earth-Sun System".to_string(),
path: "config/earthsun_corrected.toml".to_string(),
description: "Simple two-body system for testing".to_string(),
},
SimulationConfig {
name: "Inner Solar System".to_string(),
path: "config/inner_solar_system.toml".to_string(),
description: "Mercury through Mars plus Moon".to_string(),
},
SimulationConfig {
name: "Complete Solar System".to_string(),
path: "config/planets.toml".to_string(),
description: "All planets plus major moons".to_string(),
},
];
Ok(configs)
}
#[command]
async fn start_api_server() -> Result<String, String> {
// Start the API server in the background
let mut cmd = Command::new("cargo");
cmd.args(&["run", "--release", "--bin", "api_server"]);
match cmd.spawn() {
Ok(_) => Ok("API server started on http://localhost:3000".to_string()),
Err(e) => Err(format!("Failed to start API server: {}", e)),
}
}
#[command]
async fn run_simulation(
config_path: String,
time_str: String,
step_size: f64,
output_file: String,
) -> Result<String, String> {
let mut cmd = Command::new("cargo");
cmd.args(&[
"run",
"--release",
"--bin",
"simulator",
"--",
"--config", &config_path,
"--time", &time_str,
"--step-size", &step_size.to_string(),
"--output-file", &output_file,
"--force-overwrite",
]);
match cmd.output() {
Ok(output) => {
if output.status.success() {
Ok(format!("Simulation completed: {}", output_file))
} else {
let stderr = String::from_utf8_lossy(&output.stderr);
Err(format!("Simulation failed: {}", stderr))
}
}
Err(e) => Err(format!("Failed to run simulation: {}", e)),
}
}
#[command]
async fn visualize_trajectory(trajectory_file: String) -> Result<String, String> {
let mut cmd = Command::new("python3");
cmd.args(&["plot_trajectories.py", &trajectory_file, "--animate"]);
match cmd.spawn() {
Ok(_) => Ok("Visualization started".to_string()),
Err(e) => Err(format!("Failed to start visualization: {}", e)),
}
}
fn main() {
tauri::Builder::default()
.invoke_handler(generate_handler![
get_available_configs,
start_api_server,
run_simulation,
visualize_trajectory
])
.run(generate_context!())
.expect("error while running tauri application");
}
+79
View File
@@ -0,0 +1,79 @@
{
"build": {
"beforeDevCommand": "cd web && npm run dev",
"beforeBuildCommand": "cd web && npm run build",
"devPath": "http://localhost:5173",
"distDir": "../web/dist",
"withGlobalTauri": false
},
"package": {
"productName": "Orbital Simulator",
"version": "0.1.0"
},
"tauri": {
"allowlist": {
"all": false,
"shell": {
"all": false,
"open": true
},
"dialog": {
"all": false,
"open": true,
"save": true
},
"fs": {
"all": false,
"readFile": true,
"writeFile": true,
"readDir": true,
"copyFile": true,
"createDir": true,
"removeDir": true,
"removeFile": true,
"renameFile": true,
"exists": true
},
"path": {
"all": true
},
"window": {
"all": false,
"close": true,
"hide": true,
"show": true,
"maximize": true,
"minimize": true,
"unmaximize": true,
"unminimize": true,
"startDragging": true
}
},
"bundle": {
"active": true,
"targets": "all",
"identifier": "com.orbital-simulator.app",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/[email protected]",
"icons/icon.icns",
"icons/icon.ico"
]
},
"security": {
"csp": null
},
"windows": [
{
"fullscreen": false,
"resizable": true,
"title": "Orbital Simulator",
"width": 1400,
"height": 900,
"minWidth": 800,
"minHeight": 600
}
]
}
}