Skip to content

Commit 4bb6aba

Browse files
committed
Lock screen when loading Boriel BASIC
1 parent 9b55461 commit 4bb6aba

8 files changed

Lines changed: 27 additions & 18 deletions

File tree

apps/web/public/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ code {
100100
bottom: 0;
101101
left: 0;
102102
right: 0;
103-
background-color: black;
103+
background-color: rgba(0, 0, 0, 0.5);
104104
transition: opacity 350ms;
105105
visibility: hidden;
106106
opacity: 0;

apps/web/src/components/DemoAssemblyEditor.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import CodeMirror from "./CodeMirror";
55
import { setAssemblyCode, runAssembly } from "../redux/demo/actions";
66
import "../lib/syntax/pasmo";
77
import { dashboardLock } from "../dashboard_lock";
8+
import { showLoading } from "../dashboard_loading";
89
import LineNumbersToggle from "./LineNumbersToggle";
910
import { Divider } from "primereact/divider";
1011

@@ -51,6 +52,7 @@ export function DemoAssemblyEditor() {
5152
className="margin-top-8"
5253
onClick={() => {
5354
dashboardLock();
55+
showLoading();
5456
dispatch(runAssembly());
5557
}}
5658
/>

apps/web/src/components/DemoSinclairBasicEditor.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import CodeMirror from "./CodeMirror";
55
import {setSinclairBasicCode, runSinclairBasic} from "../redux/demo/actions";
66
import "../lib/syntax/zmakebas";
77
import {dashboardLock} from "../dashboard_lock";
8+
import {showLoading} from "../dashboard_loading";
89
import LineNumbersToggle from "./LineNumbersToggle";
910
import {Divider} from "primereact/divider";
1011

@@ -51,6 +52,7 @@ export function DemoSinclairBasicEditor() {
5152
className="margin-top-8"
5253
onClick={() => {
5354
dashboardLock();
55+
showLoading();
5456
dispatch(runSinclairBasic());
5557
}}
5658
/>
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
import React from "react";
2-
3-
export default function LoadingScreen() {
4-
return <div className="dashboard-loading-screen"/>
5-
}
1+
import React from "react";
2+
import {ProgressSpinner} from "primereact/progressspinner";
3+
4+
export default function LoadingScreen() {
5+
return (
6+
<div className="dashboard-loading-screen">
7+
<ProgressSpinner/>
8+
</div>
9+
)
10+
}

apps/web/src/components/LockScreen.jsx

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import React from "react";
2-
import {ProgressSpinner} from "primereact/progressspinner";
32

43
export default function LockScreen() {
54
return (
65
<React.Fragment>
76
<div className="dashboard-lock-screen" style={styles.fullPage}/>
87
<div className="dashboard-lock-screen" style={styles.contentBlanker}/>
98
<div className="dashboard-lock-screen" style={styles.container}>
10-
<div className="center-screen" style={styles.centerScreen}>
11-
<ProgressSpinner/>
9+
<div className="center-screen">
10+
1211
</div>
1312
</div>
1413
</React.Fragment>
@@ -38,7 +37,7 @@ const styles = {
3837
width: '100%',
3938
height: '100vh',
4039
backgroundColor: 'black',
41-
opacity: 0.5,
40+
opacity: 0.05,
4241
display: 'none',
4342
userSelect: 'none'
4443
},
@@ -53,12 +52,5 @@ const styles = {
5352
height: '100vh',
5453
display: 'none',
5554
userSelect: 'none'
56-
},
57-
centerScreen: {
58-
display: 'flex',
59-
alignItems: 'center',
60-
justifyContent: 'center',
61-
width: '100%',
62-
height: '100%'
6355
}
6456
};

apps/web/src/components/ProjectEditor.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import "../lib/syntax/z88dk-c";
2222
import "../lib/syntax/sdcc";
2323
import "../lib/syntax/zxbasic";
2424
import { dashboardLock } from "../dashboard_lock";
25+
import { showLoading } from "../dashboard_loading";
2526
import clsx from "clsx";
2627
import { Dialog } from "primereact/dialog";
2728
import { InputText } from "primereact/inputtext";
@@ -157,6 +158,7 @@ export function ProjectEditor() {
157158
className={clsx("mt-2 mr-2", isMobile && "ml-2")}
158159
onClick={() => {
159160
dashboardLock();
161+
showLoading();
160162
dispatch(runProjectCode());
161163
}}
162164
/>

apps/web/src/dashboard_loading.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export function showLoading() {
33
for (let i = 0; i < elems.length; i++) {
44
const elem = elems[i];
55
elem.style.visibility = 'visible';
6-
elem.style.opacity = '0.5';
6+
elem.style.opacity = '1';
77
}
88
}
99

apps/web/src/dashboard_lock.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import {hideLoading} from "./dashboard_loading";
2+
13
export function dashboardLock() {
24
const elems = document.getElementsByClassName('dashboard-lock-screen');
35
for (let i = 0; i < elems.length; i++) {
@@ -12,4 +14,8 @@ export function dashboardUnlock() {
1214
const elem = elems[i];
1315
elem.style.display = 'none';
1416
}
17+
18+
// The run-program overlay (with spinner) is shown only on run paths, but is
19+
// torn down here so it can't be stranded by any lock-release site.
20+
hideLoading();
1521
}

0 commit comments

Comments
 (0)