2022-07-02 16:30:30 +00:00
|
|
|
import React from 'react';
|
|
|
|
import ReactDOM from 'react-dom/client';
|
2022-07-02 20:58:33 +00:00
|
|
|
import Typing from 'react-typing-animation';
|
2022-07-03 02:30:48 +00:00
|
|
|
import ClickableDiv from 'react-clickable-div';
|
|
|
|
import KeyboardEventHandler from 'react-keyboard-event-handler'
|
2022-07-02 16:30:30 +00:00
|
|
|
import './index.css';
|
2022-07-02 20:58:33 +00:00
|
|
|
import logos from './BoSLOO logo.json';
|
2022-07-05 00:39:35 +00:00
|
|
|
import Terminal from './terminal.js';
|
|
|
|
import StatusBar from './statusbar.js';
|
|
|
|
|
2022-07-05 01:16:35 +00:00
|
|
|
const nominal = <Terminal />;
|
2022-07-02 16:30:30 +00:00
|
|
|
|
2022-07-04 00:43:28 +00:00
|
|
|
class Console extends React.Component {
|
2022-07-02 20:58:33 +00:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
2022-07-05 00:39:35 +00:00
|
|
|
this.swapper = this.swapper.bind(this);
|
2022-07-02 20:58:33 +00:00
|
|
|
this.state = {
|
2022-07-05 00:39:35 +00:00
|
|
|
bodyObj: <PowerOn onClick={this.swapper} />,
|
|
|
|
init: 0,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
swapper(key, e) {
|
|
|
|
if (this.state.init === 0) {
|
|
|
|
this.replaceBody(<SelfTest />);
|
|
|
|
this.playSound();
|
|
|
|
} else if (this.state.init === 1) {
|
|
|
|
this.replaceBody(nominal);
|
2022-07-02 20:58:33 +00:00
|
|
|
}
|
2022-07-05 00:39:35 +00:00
|
|
|
this.setState({ init: this.state.init + 1 });
|
2022-07-02 20:58:33 +00:00
|
|
|
}
|
|
|
|
|
2022-07-03 02:30:48 +00:00
|
|
|
appendToBody(newContent) {
|
|
|
|
let bodyObj = JSON.parse(JSON.stringify(this.state.bodyObj)) + newContent;
|
|
|
|
this.setState({
|
|
|
|
bodyObj: bodyObj
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
replaceBody(newContent) {
|
|
|
|
this.setState({
|
|
|
|
bodyObj: newContent
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-07-05 00:39:35 +00:00
|
|
|
playSound() {
|
|
|
|
var sound = document.getElementById("boot-sound")
|
|
|
|
sound.volume = 0.1;
|
|
|
|
sound.play();
|
|
|
|
}
|
|
|
|
|
2022-07-02 20:58:33 +00:00
|
|
|
render() {
|
2022-07-03 02:30:48 +00:00
|
|
|
return (
|
2022-07-04 00:43:28 +00:00
|
|
|
<div className='console'>
|
2022-07-05 00:39:35 +00:00
|
|
|
<KeyboardEventHandler handleKeys={['all']} onKeyEvent={this.swapper} />
|
2022-07-03 02:30:48 +00:00
|
|
|
{this.state.bodyObj}
|
2022-07-05 01:16:35 +00:00
|
|
|
{this.state.init >= 2 ? <StatusBar/> : null}
|
2022-07-03 02:30:48 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class SelfTest extends React.Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
this.state = {
|
|
|
|
logodisplay: false
|
2022-07-05 00:39:35 +00:00
|
|
|
}
|
2022-07-03 02:30:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2022-07-04 22:13:41 +00:00
|
|
|
const final = <span className='logo'>{logos.logo} < br /><br /><br /><Typing speed={5}>Press any key to continue...<br />{'>'} <span className='blink-text'>_</span></Typing></span>;
|
2022-07-02 20:58:33 +00:00
|
|
|
return (
|
2022-07-05 00:39:35 +00:00
|
|
|
<div className='power-on-self-test'>
|
|
|
|
<Typing speed={30} onFinishedTyping={() => this.setState({ logodisplay: true })}>
|
2022-07-03 02:30:48 +00:00
|
|
|
BoSLOO ACPI BIOS v0.1<br />
|
|
|
|
Sakimori Ind. 2022<br />
|
2022-07-05 00:39:35 +00:00
|
|
|
<Typing.Speed ms={ 5}/>Initializing cache.................................<Typing.Speed ms={200} />...<Typing.Speed ms={5} /> OK!<br />
|
2022-07-03 02:30:48 +00:00
|
|
|
Initializing network.........<Typing.Speed ms={500} />....<Typing.Speed ms={5} />.................<Typing.Speed ms={300} />....<Typing.Speed ms={5} /> OK!<br />
|
|
|
|
Initializing GPU...................................<Typing.Speed ms={1000} />...<Typing.Speed ms={5} /> <span className='fail-text'>FAIL!</span><br />
|
|
|
|
<br />
|
2022-07-02 20:58:33 +00:00
|
|
|
</Typing>
|
2022-07-03 02:30:48 +00:00
|
|
|
{this.state.logodisplay ? final : null}
|
2022-07-02 20:58:33 +00:00
|
|
|
</div>
|
2022-07-03 02:30:48 +00:00
|
|
|
)
|
2022-07-02 20:58:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-05 00:39:35 +00:00
|
|
|
function PowerOn(props) {
|
|
|
|
return (
|
|
|
|
<div className="power-on-container"><div className='power-on-box'><span id='start-text' onClick={props.onClick}><span className='blink-text'>START</span></span></div></div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-07-03 02:30:48 +00:00
|
|
|
// =========================================
|
2022-07-02 16:30:30 +00:00
|
|
|
|
|
|
|
const root = ReactDOM.createRoot(document.getElementById("root"));
|
2022-07-04 00:43:28 +00:00
|
|
|
root.render(<Console />);
|