Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
323 changes: 322 additions & 1 deletion Cargo.lock

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "worldgen"
version = "1.0.0"
version = "1.2.0"
edition = "2021"
license = "MIT"

Expand All @@ -20,8 +20,10 @@ serde_json = "1.0"
wasm-bindgen = { version = "0.2", features = ["serde-serialize"] }
wasm-bindgen-futures = "0.4"
serde-wasm-bindgen = "0.6"
web-sys = { version = "0.3", features = ["Request", "RequestInit", "RequestMode", "Response", "Window", "Headers"] }
web-sys = { version = "0.3", features = ["Request", "RequestInit", "RequestMode", "Response", "Window", "Headers", "Storage"] }
wasm-logger = "0.2"
leptos-use = { version = "0.16.2", features = ["storage"] }
codee = "0.3.2"

[[bin]]
name = "main"
Expand Down
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

<link data-trunk rel="rust" data-bin="main" />
<link data-trunk rel="css" href="style.css" />
<link data-trunk rel="copy-file" href="public/css/modal.css" />
<link data-trunk rel="css" href="public/css/modal.css" />
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
6 changes: 6 additions & 0 deletions notes/TODO_process_trades_placement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- Fix placement: Process Trades + Profit should be rendered after the Total row, not before
- Re-add UI row with Process Trades + Profit in the Revenue section, after the Total span
- Ensure Goods Profit row always renders when show_sell_price is true; investigate the blank box issue
- Confirm Sell Qty input logic: no mutation of manifest quantities on change; only set sell_plan
- After fixes, cargo check and run app to visually verify layout

136 changes: 136 additions & 0 deletions public/css/modal.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
:root {
--tg-modal-bg: #0b0f12;
--tg-modal-surface: #2e3136; /* neutral grey */
--tg-modal-border: #42474d;
--tg-modal-text: #edf2f7; /* light but not stark white */
--tg-modal-muted: #b7c0c9;
--tg-blue: #51A9EE;
--tg-blue-dark: #1976d2;
--tg-red: #ff5575;
}

@keyframes tg-fade-in {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes tg-slide-in {
from { opacity: 0; transform: translate(-50%, -6%); }
to { opacity: 1; transform: translate(-50%, 0); }
}

.tg-modal-backdrop {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.5);
z-index: 1000;
animation: tg-fade-in .18s ease-out both;
}

.tg-modal-panel {
position: fixed;
z-index: 1001;
left: 50%;
top: 15%;
transform: translate(-50%, 0);
background: var(--tg-modal-surface);
color: var(--tg-modal-text);
border: 1px solid var(--tg-modal-border);
padding: 16px 16px 14px 16px;
border-radius: 10px;
min-width: 380px;
max-width: 92vw;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
animation: tg-slide-in .22s cubic-bezier(.2,.7,.2,1) both;
}

.tg-modal-textstyle {
margin: 0 0 .5rem 0;
}
.tg-modal-panel h5 {
margin: 0 0 12px 0;
color: var(--tg-blue);
font-weight: 700;
letter-spacing: .25px;
}

.tg-modal-panel .modal-body {
display: flex;
flex-direction: column;
gap: 10px;
}

.tg-modal-panel .modal-label {
font-size: 11pt;
color: var(--tg-modal-muted);
margin-top: .5rem;
}

.tg-modal-panel select,
.tg-modal-panel input[type="number"],
.tg-modal-panel input[type="text"] {
appearance: none;
-webkit-appearance: none;
background: #0e151b;
border: 1px solid var(--tg-modal-border);
color: var(--tg-modal-text);
border-radius: 8px;
padding: 8px 10px;
font-family: "Space Mono", monospace;
}

.tg-modal-panel select:focus,
.tg-modal-panel input:focus {
outline: none;
border-color: var(--tg-blue);
box-shadow: 0 0 0 2px rgba(81,169,238,.2);
}

.tg-modal-panel input[type="number"]::-webkit-outer-spin-button,
.tg-modal-panel input[type="number"]::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}

.tg-modal-panel .modal-actions {
display: flex;
gap: 12px;
justify-content: flex-end;
margin-top: 14px;
}

.tg-modal-error {
min-height: 1.2em;
}

.tg-btn {
font-family: inherit;
font-size: 10pt;
padding: 7px 16px;
cursor: pointer;
transition: all .15s ease;
}

.tg-btn-cancel {
background: transparent;
color: var(--tg-modal-muted);
border: 1px solid var(--tg-modal-border);
border-radius: 22px; /* match Done pill shape */
}
.tg-btn-cancel:hover { color: var(--tg-blue); border-color: var(--tg-blue); }

.tg-btn-done {
background: linear-gradient(135deg, #51A9EE 0%, #1976d2 100%);
color: white;
border: 1px solid #1976d2;
border-radius: 22px;
box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.tg-btn-done:hover { filter: brightness(1.05); }
.tg-btn-done:active { transform: translateY(1px); }

.tg-error {
color: var(--tg-red);
font-size: 10pt;
margin-top: 4px;
}

4 changes: 2 additions & 2 deletions src/components/system_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ fn print() {
pub fn World() -> impl IntoView {
// Initialize global context stores with default world and empty system
provide_context(Store::new(
World::from_upp(INITIAL_NAME.to_string(), INITIAL_UPP, false, true).unwrap(),
World::from_upp(INITIAL_NAME, INITIAL_UPP, false, true).unwrap(),
));
provide_context(Store::new(System::default()));

Expand All @@ -206,7 +206,7 @@ pub fn World() -> impl IntoView {
debug!("Building world {name} with UPP {upp}");

// Attempt to parse the UWP string into a world object
let Ok(mut w) = World::from_upp(name, upp.as_str(), false, true) else {
let Ok(mut w) = World::from_upp(&name, upp.as_str(), false, true) else {
// If parsing fails, log error and bail out to prevent crashes
log::error!("Failed to parse UWP in hook to build main world: {upp}");
return;
Expand Down
Loading