boot-up screen active, state change on keypress
This commit is contained in:
parent
5dad42c371
commit
7ef54e8de3
10
GroundControl/frontend/package-lock.json
generated
10
GroundControl/frontend/package-lock.json
generated
|
@ -11541,6 +11541,11 @@
|
||||||
"whatwg-fetch": "^3.6.2"
|
"whatwg-fetch": "^3.6.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"react-clickable-div": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-clickable-div/-/react-clickable-div-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-N1ABsLy5tuCXXHHcO8azMkqbLXgXLqj57CraBih/pRpoYI3jLcyPXq/sMbl2o+FONgBTwZhGSBDrfj2OmyJ8TA=="
|
||||||
|
},
|
||||||
"react-dev-utils": {
|
"react-dev-utils": {
|
||||||
"version": "12.0.1",
|
"version": "12.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-12.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-12.0.1.tgz",
|
||||||
|
@ -11646,6 +11651,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
|
||||||
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
|
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
|
||||||
},
|
},
|
||||||
|
"react-keyboard-event-handler": {
|
||||||
|
"version": "1.5.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-keyboard-event-handler/-/react-keyboard-event-handler-1.5.4.tgz",
|
||||||
|
"integrity": "sha512-MSOxU/sQ5q9XWNHhXAJxzh4xVLZjKORGNC2Pzvx3qUo24TQeztGB0tq8oSArwX6vfKSIVijiw8wBmkN5pJOB4w=="
|
||||||
|
},
|
||||||
"react-refresh": {
|
"react-refresh": {
|
||||||
"version": "0.11.0",
|
"version": "0.11.0",
|
||||||
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz",
|
||||||
|
|
|
@ -9,7 +9,9 @@
|
||||||
"babel-runtime": "^6.26.0",
|
"babel-runtime": "^6.26.0",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-animated-text": "^0.1.4",
|
"react-animated-text": "^0.1.4",
|
||||||
|
"react-clickable-div": "^1.0.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
|
"react-keyboard-event-handler": "^1.5.4",
|
||||||
"react-scripts": "5.0.1",
|
"react-scripts": "5.0.1",
|
||||||
"react-typing-animation": "^1.6.2",
|
"react-typing-animation": "^1.6.2",
|
||||||
"web-vitals": "^2.1.4"
|
"web-vitals": "^2.1.4"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font: 14px "Courier New", monospace;
|
font: 14px "Courier New", monospace;
|
||||||
background: #121212;
|
background: #0d0d0d;
|
||||||
color: #02d300;
|
color: #02d300;
|
||||||
margin: 20px;
|
margin: 20px;
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
|
@ -53,3 +53,17 @@ ol, ul {
|
||||||
.game-info {
|
.game-info {
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fail-text{
|
||||||
|
color: #d82222;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blink-text {
|
||||||
|
animation: blinker 1s step-start infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes blinker {
|
||||||
|
50% {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,8 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ReactDOM from 'react-dom/client';
|
import ReactDOM from 'react-dom/client';
|
||||||
import Typing from 'react-typing-animation';
|
import Typing from 'react-typing-animation';
|
||||||
|
import ClickableDiv from 'react-clickable-div';
|
||||||
|
import KeyboardEventHandler from 'react-keyboard-event-handler'
|
||||||
import './index.css';
|
import './index.css';
|
||||||
import logos from './BoSLOO logo.json';
|
import logos from './BoSLOO logo.json';
|
||||||
|
|
||||||
|
@ -124,34 +126,67 @@ class Terminal extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
lines: [
|
bodyObj: <SelfTest />,
|
||||||
{ text: 'BoSLOO v0.1', printed: false },
|
init: false,
|
||||||
{ text: 'Today is Saturday.', printed: false },
|
|
||||||
{ text: logos.logo, printed: false}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
appendToBody(newContent) {
|
||||||
var rawLines = [];
|
let bodyObj = JSON.parse(JSON.stringify(this.state.bodyObj)) + newContent;
|
||||||
var typingLines = [];
|
this.setState({
|
||||||
for (let line of this.state.lines) {
|
bodyObj: bodyObj
|
||||||
line.printed ? rawLines = rawLines.concat([line.text]) : typingLines = typingLines.concat([line.text]);
|
});
|
||||||
}
|
}
|
||||||
const raw = rawLines.join('\n');
|
|
||||||
const type = typingLines.join('\n');
|
replaceBody(newContent) {
|
||||||
|
this.setState({
|
||||||
|
bodyObj: newContent
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
handler() {
|
||||||
|
const init = this.state.init;
|
||||||
|
if (!init) { this.replaceBody('YIPPIE!'); this.setState({ init: true }); }
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className='Terminal'>
|
<div className='terminal'>
|
||||||
{raw}
|
{this.state.bodyObj}
|
||||||
<Typing speed={2 }>
|
<KeyboardEventHandler handleKeys={['all']}
|
||||||
{type}
|
onKeyEvent={(key, e) => { if (!this.state.init) { this.replaceBody('YIPPIE!'); this.setState({ init: true }); } }} />
|
||||||
</Typing>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========================================
|
class SelfTest extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
logodisplay: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const final = <span>{logos.logo} < br /><br /><br /><Typing speed={5}>Press any key to continue...<br/>> <span className='blink-text'>_</span></Typing></span>;
|
||||||
|
return (
|
||||||
|
<div className='power-on-self-test'>
|
||||||
|
<Typing speed={5} onFinishedTyping={() => this.setState({logodisplay: true})}>
|
||||||
|
BoSLOO ACPI BIOS v0.1<br />
|
||||||
|
Sakimori Ind. 2022<br />
|
||||||
|
Initializing cache.................................<Typing.Speed ms={200} />...<Typing.Speed ms={5} /> OK!<br />
|
||||||
|
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 />
|
||||||
|
</Typing>
|
||||||
|
{this.state.logodisplay ? final : null}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// =========================================
|
||||||
|
|
||||||
const root = ReactDOM.createRoot(document.getElementById("root"));
|
const root = ReactDOM.createRoot(document.getElementById("root"));
|
||||||
root.render(<Terminal />);
|
root.render(<Terminal />);
|
Loading…
Reference in a new issue