Drop dead CD-ROM handler and tighten navigate typing

This commit is contained in:
Felix Rieseberg
2026-04-11 08:51:08 -07:00
parent 74fc2d291e
commit a0ee5a2f10
4 changed files with 6 additions and 24 deletions

View File

@@ -41,7 +41,7 @@
input[type="text"] {
width: 100%;
font-family: "Pixelated MS Sans Serif", Arial;
font-family: @win-font;
}
input[type="text"]:read-only {

View File

@@ -5,12 +5,10 @@ import { resetState } from "./utils/reset-state";
interface CardSettingsProps {
bootFromScratch: () => void;
setFloppy: (file: File) => void;
setCdrom: (cdrom: File) => void;
setSmbSharePath: (path: string) => void;
pickFolder: () => Promise<string | null>;
navigate: (to: string) => void;
navigate: (to: "start" | "settings") => void;
floppy?: File;
cdrom?: File;
smbSharePath: string;
}
@@ -29,7 +27,6 @@ export class CardSettings extends React.Component<
super(props);
this.onChangeFloppy = this.onChangeFloppy.bind(this);
this.onChangeCdrom = this.onChangeCdrom.bind(this);
this.onResetState = this.onResetState.bind(this);
this.state = {
@@ -206,19 +203,6 @@ export class CardSettings extends React.Component<
}
}
private onChangeCdrom(event: React.ChangeEvent<HTMLInputElement>) {
const cdromFile =
event.target.files && event.target.files.length > 0
? event.target.files[0]
: null;
if (cdromFile) {
this.props.setCdrom(cdromFile);
} else {
console.log(`Cdrom: Input changed but no file selected`);
}
}
private async onResetState() {
await resetState();
this.setState({ isStateReset: true });

View File

@@ -2,7 +2,7 @@ import * as React from "react";
export interface CardStartProps {
startEmulator: () => void;
navigate: (to: string) => void;
navigate: (to: "start" | "settings") => void;
}
const TIPS = [

View File

@@ -210,14 +210,14 @@ export class Emulator extends React.Component<{}, EmulatorState> {
* 🤡
*/
public renderUI() {
const { isRunning, currentUiCard, floppyFile, cdromFile } = this.state;
const { isRunning, currentUiCard, floppyFile } = this.state;
if (isRunning) {
return null;
}
const navigate = (target: string) =>
this.setState({ currentUiCard: target as "start" | "settings" });
const navigate = (currentUiCard: "start" | "settings") =>
this.setState({ currentUiCard });
let card;
@@ -225,7 +225,6 @@ export class Emulator extends React.Component<{}, EmulatorState> {
card = (
<CardSettings
setFloppy={(floppyFile) => this.setState({ floppyFile })}
setCdrom={(cdromFile) => this.setState({ cdromFile })}
setSmbSharePath={(smbSharePath) => {
this.setState({ smbSharePath });
ipcRenderer.invoke(IPC_COMMANDS.SET_SMB_SHARE_PATH, smbSharePath);
@@ -233,7 +232,6 @@ export class Emulator extends React.Component<{}, EmulatorState> {
pickFolder={() => ipcRenderer.invoke(IPC_COMMANDS.PICK_FOLDER)}
bootFromScratch={this.bootFromScratch}
floppy={floppyFile}
cdrom={cdromFile}
smbSharePath={this.state.smbSharePath}
navigate={navigate}
/>