mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-24 06:01:02 +00:00
88 lines
2.3 KiB
TypeScript
88 lines
2.3 KiB
TypeScript
import React from "react";
|
|
import { Checkbox } from "./ui/checkbox";
|
|
import { Label } from "./ui/label";
|
|
|
|
import { Settings } from "@/settings";
|
|
|
|
interface SettingsMenuProps {
|
|
settings: Settings;
|
|
onChange: (settings: Settings) => void;
|
|
}
|
|
|
|
export class SettingsMenu extends React.Component<SettingsMenuProps, Settings> {
|
|
constructor(props: SettingsMenuProps) {
|
|
super(props);
|
|
this.getSettings = this.getSettings.bind(this);
|
|
this.state = props.settings;
|
|
}
|
|
|
|
getSettings() {
|
|
return this.state;
|
|
}
|
|
|
|
updateSettings(settings: Settings) {
|
|
this.setState(() => settings);
|
|
}
|
|
|
|
componentDidUpdate() {
|
|
this.props.onChange(this.state);
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<div className="grid gap-4">
|
|
<div className="space-y-2">
|
|
<h4 className="font-medium leading-none">Settings</h4>
|
|
<p className="text-sm text-muted-foreground">
|
|
Set the settings for the emulation.
|
|
</p>
|
|
</div>
|
|
|
|
<div className="flex gap-6">
|
|
<Checkbox
|
|
id="settings-verbose"
|
|
checked={this.state.verbose}
|
|
onCheckedChange={(checked: boolean) => {
|
|
this.setState({ verbose: checked });
|
|
}}
|
|
/>
|
|
<Label htmlFor="settings-verbose">Verbose Logging</Label>
|
|
</div>
|
|
|
|
<div className="flex gap-6">
|
|
<Checkbox
|
|
id="settings-concise"
|
|
checked={this.state.concise}
|
|
onCheckedChange={(checked: boolean) => {
|
|
this.setState({ concise: checked });
|
|
}}
|
|
/>
|
|
<Label htmlFor="settings-concise">Concise Logging</Label>
|
|
</div>
|
|
|
|
<div className="flex gap-6">
|
|
<Checkbox
|
|
id="settings-silent"
|
|
checked={this.state.silent}
|
|
onCheckedChange={(checked: boolean) => {
|
|
this.setState({ silent: checked });
|
|
}}
|
|
/>
|
|
<Label htmlFor="settings-silent">Silent Logging</Label>
|
|
</div>
|
|
|
|
<div className="flex gap-6">
|
|
<Checkbox
|
|
id="settings-buffer"
|
|
checked={this.state.bufferStdout}
|
|
onCheckedChange={(checked: boolean) => {
|
|
this.setState({ bufferStdout: checked });
|
|
}}
|
|
/>
|
|
<Label htmlFor="settings-buffer">Buffer stdout</Label>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
}
|