mirror of
https://github.com/felixrieseberg/windows95.git
synced 2026-05-09 00:24:09 +00:00
Drop dead CD-ROM handler and tighten navigate typing
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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 });
|
||||
|
||||
@@ -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 = [
|
||||
|
||||
@@ -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}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user