Skip to content

Commit 5835f78

Browse files
skeptomaiclaude
andcommitted
fix: Auto-fetch version from WASM and remove scrollbar
Scrollbar fix: - Remove overflow-y:auto from .disclaimer that was causing persistent scrollbar Version automation: - Remove hardcoded version constant - Load WASM module on app startup via useEffect - Call get_interpreter_version() to fetch version from Cargo.toml - Single source of truth - no manual updates needed - Version displays once WASM loads (typically <1 second) Now version is automatically pulled from CARGO_PKG_VERSION at build time, no need to update in two places. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 2f50a7a commit 5835f78

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

web/css/terminal.css

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,8 +420,6 @@ body {
420420
padding: var(--terminal-padding);
421421
max-width: 700px;
422422
margin: 0 auto;
423-
overflow-y: auto;
424-
max-height: 100vh;
425423
box-sizing: border-box;
426424
}
427425

web/js/main.js

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ function Disclaimer({ onContinue, onLoadOwn, theme, onThemeChange, font, onFontC
118118
<div class="terminal theme-${theme} font-${font} ${crtClass}">
119119
<div class="disclaimer">
120120
<h1 class="disclaimer-title">GRUESOME</h1>
121-
<p class="disclaimer-subtitle">Z-Machine Interpreter v${version}</p>
121+
<p class="disclaimer-subtitle">Z-Machine Interpreter${version ? ` v${version}` : ''}</p>
122122
123123
<${ThemeToggle} theme=${theme} onToggle=${onThemeChange} />
124124
<${FontToggle} font=${font} onToggle=${onFontChange} />
@@ -187,9 +187,6 @@ function Disclaimer({ onContinue, onLoadOwn, theme, onThemeChange, font, onFontC
187187
`;
188188
}
189189

190-
// Version is set at build time - this should match Cargo.toml
191-
const GRUESOME_VERSION = '2.16.0';
192-
193190
/**
194191
* Main Application Component
195192
*/
@@ -204,8 +201,8 @@ function App() {
204201
// WASM interpreter instance
205202
const interpreterRef = useRef(null);
206203

207-
// Interpreter version - use constant for immediate display
208-
const interpreterVersion = GRUESOME_VERSION;
204+
// Interpreter version - fetch from WASM on load
205+
const [interpreterVersion, setInterpreterVersion] = useState(null);
209206

210207
// Game state (when playing with real WASM)
211208
const [gameState, setGameState] = useState({
@@ -215,6 +212,25 @@ function App() {
215212
quit: false,
216213
});
217214

215+
// Load WASM and get version on app startup
216+
useEffect(() => {
217+
async function loadVersion() {
218+
try {
219+
const response = await fetch('./pkg/gruesome.js', { method: 'HEAD' });
220+
if (response.ok) {
221+
const wasm = await import('../pkg/gruesome.js');
222+
await wasm.default();
223+
const version = wasm.get_interpreter_version();
224+
setInterpreterVersion(version);
225+
console.log('Gruesome version:', version);
226+
}
227+
} catch (err) {
228+
console.log('Could not load version:', err);
229+
}
230+
}
231+
loadVersion();
232+
}, []);
233+
218234
// Settings - load from localStorage if available
219235
const [settings, setSettings] = useState(() => {
220236
const saved = localStorage.getItem('gruesome-settings');

0 commit comments

Comments
 (0)