From f9be33b3830c1d24d082f268ca7d2523abe376a1 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Sat, 12 Jul 2025 09:10:17 +0200 Subject: [PATCH] Better summary --- page/src/components/emulation-summary.css | 4 +++ page/src/components/emulation-summary.tsx | 29 +++++++++++++++ page/src/playground.tsx | 43 ++++++----------------- 3 files changed, 44 insertions(+), 32 deletions(-) create mode 100644 page/src/components/emulation-summary.css create mode 100644 page/src/components/emulation-summary.tsx diff --git a/page/src/components/emulation-summary.css b/page/src/components/emulation-summary.css new file mode 100644 index 00000000..712cd2ac --- /dev/null +++ b/page/src/components/emulation-summary.css @@ -0,0 +1,4 @@ +.emulation-summary { + box-shadow: 0px 0px 10px 4px rgba(255, 255, 255, 0.1); + /*border: 1px solid rgba(255, 255, 255, 0.2);*/ +} diff --git a/page/src/components/emulation-summary.tsx b/page/src/components/emulation-summary.tsx new file mode 100644 index 00000000..3bfa5575 --- /dev/null +++ b/page/src/components/emulation-summary.tsx @@ -0,0 +1,29 @@ +import { EmulationStatus } from "@/emulator"; +import { TextTooltip } from "./text-tooltip"; +import { BarChartSteps, CpuFill } from "react-bootstrap-icons"; + +import "./emulation-summary.css"; + +export interface EmulationSummaryProps { + status?: EmulationStatus; +} + +export function EmulationSummary(props: EmulationSummaryProps) { + if (!props.status) { + return <>; + } + + return ( +
+ + {props.status.activeThreads} + + +
+ + {props.status.executedInstructions.toLocaleString()} + + +
+ ); +} diff --git a/page/src/playground.tsx b/page/src/playground.tsx index c9e620a6..89f19db1 100644 --- a/page/src/playground.tsx +++ b/page/src/playground.tsx @@ -23,8 +23,6 @@ import { GearFill, PauseFill, HouseFill, - BarChartSteps, - CpuFill, } from "react-bootstrap-icons"; import { StatusIndicator } from "@/components/status-indicator"; import { Header } from "./Header"; @@ -42,15 +40,16 @@ import { import { FilesystemExplorer } from "./filesystem-explorer"; import { EmulationStatus } from "./emulator"; import { TextTooltip } from "./components/text-tooltip"; +import { EmulationSummary } from "./components/emulation-summary"; interface PlaygroundProps {} interface PlaygroundState { settings: Settings; - filesystemPromise: Promise | null; - filesystem: Filesystem | null; - emulator: Emulator | null; - emulationStatus: EmulationStatus | null; - application: string | undefined; + filesystemPromise?: Promise; + filesystem?: Filesystem; + emulator?: Emulator; + emulationStatus?: EmulationStatus; + application?: string; drawerOpen: boolean; allowWasm64: boolean; } @@ -96,12 +95,7 @@ export class Playground extends React.Component< this.state = { settings: loadSettings(), - filesystemPromise: null, - filesystem: null, - emulator: null, - emulationStatus: null, drawerOpen: false, - application: undefined, allowWasm64: false, }; } @@ -120,8 +114,8 @@ export class Playground extends React.Component< await this.state.filesystem.delete(); this.setState({ - filesystemPromise: null, - filesystem: null, + filesystemPromise: undefined, + filesystem: undefined, drawerOpen: false, }); @@ -136,7 +130,7 @@ export class Playground extends React.Component< _onEmulatorStateChanged(s: EmulationState, persistFs: boolean) { if (isFinalState(s) && persistFs) { - this.setState({ filesystemPromise: null, filesystem: null }); + this.setState({ filesystemPromise: undefined, filesystem: undefined }); this.initFilesys(true); } else { this.forceUpdate(); @@ -331,6 +325,7 @@ export class Playground extends React.Component< )} + {/* Separator */}
@@ -345,23 +340,7 @@ export class Playground extends React.Component<
-
- {!this.state.emulationStatus ? ( - <> - ) : ( - <> - - {this.state.emulationStatus.activeThreads} - - -
- - {this.state.emulationStatus.executedInstructions.toLocaleString()} - - - - )} -
+