From c9e38723e74b8e2ed18ca9d86e90060d97fb3609 Mon Sep 17 00:00:00 2001 From: Robin Davies Date: Thu, 10 Oct 2024 19:05:28 -0400 Subject: [PATCH] Modal loading... and error panes. --- react/src/AppThemed.tsx | 154 ++++++++++++++++++++-------------------- 1 file changed, 78 insertions(+), 76 deletions(-) diff --git a/react/src/AppThemed.tsx b/react/src/AppThemed.tsx index f158d4c..3b54b8e 100644 --- a/react/src/AppThemed.tsx +++ b/react/src/AppThemed.tsx @@ -17,12 +17,12 @@ // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -import { SyntheticEvent } from 'react'; import { WithStyles } from '@mui/styles'; import './AppThemed.css'; - +//import {alpha} from '@mui/material/styles'; import AppBar from '@mui/material/AppBar'; +import Modal from '@mui/material/Modal'; import Toolbar from '@mui/material/Toolbar'; import CssBaseline from '@mui/material/CssBaseline'; import Typography from '@mui/material/Typography'; @@ -94,6 +94,17 @@ const appStyles = (theme: Theme) => createStyles({ listSubheader: { backgroundImage: "linear-gradient(255,255,255,0.15),rgba(255,255,255,0.15)" }, + loadingMask: { + position: "absolute", + minHeight: "10em", + left: "0px", + top: "0px", + right: "0px", + bottom: "0px", + opacity: 0.8, + background: + isDarkMode() ? "#222" : "#DDD", + }, loadingContent: { display: "block", position: "absolute", @@ -102,7 +113,6 @@ const appStyles = (theme: Theme) => createStyles({ top: "0px", width: "100%", height: "100%", - background: isDarkMode() ? "#222" : "#DDD", opacity: "0.95", justifyContent: "center", textAlign: "center", @@ -168,22 +178,22 @@ const appStyles = (theme: Theme) => createStyles({ }, loadingBox: { - position: "relative", + display: "flex", + flexFlow: "column nowrap", + position: "absolute", top: "20%", + left: 0, right: 0, color: isDarkMode() ? theme.palette.text.secondary : "#888", // border: "3px solid #888", - borderRadius: "12px", - padding: "12px", - justifyContent: "center", + alignItems: "center", textAlign: "center", opacity: 0.8, - zIndex: 2010 }, loadingBoxItem: { - justifyContent: "center", + display: "flex", flexFlow: "row nowrap", + alignItems: "center", textAlign: "center", - zIndex: 2010 }, @@ -249,9 +259,8 @@ function setFullScreen(value: boolean) { if (docEl.requestFullscren) // the latest offical api. { - if (value) - { - window.document.documentElement.requestFullscreen({navigationUI: "show"}); + if (value) { + window.document.documentElement.requestFullscreen({ navigationUI: "show" }); } else { window.document.exitFullscreen(); } @@ -269,10 +278,10 @@ function setFullScreen(value: boolean) { } -function preventDefault(e: SyntheticEvent): void { - e.stopPropagation(); - e.preventDefault(); -} +// function preventDefault(e: SyntheticEvent): void { +// e.stopPropagation(); +// e.preventDefault(); +// } type AppState = { zoomedControlInfo: ZoomedControlInfo | undefined; @@ -494,7 +503,7 @@ const AppThemed = withStyles(appStyles)(class extends ResizeResponsiveComponent< } handleDrawerSelectBank() { - + this.setState({ bankDialogOpen: true, editBankDialogOpen: false @@ -692,8 +701,7 @@ const AppThemed = withStyles(appStyles)(class extends ResizeResponsiveComponent< let result: BankIndexEntry[] = []; - if (nListEntries <= nDisplayEntries) - { + if (nListEntries <= nDisplayEntries) { for (let i = 0; i < nListEntries; ++i) { result.push(entries[i]); } @@ -706,15 +714,14 @@ const AppThemed = withStyles(appStyles)(class extends ResizeResponsiveComponent< break; } } - - let minN = selectedIndex-Math.floor(nDisplayEntries/2); + + let minN = selectedIndex - Math.floor(nDisplayEntries / 2); if (minN < 0) minN = 0; let maxN = minN + nDisplayEntries; if (maxN > entries.length) { maxN = entries.length; } - for (let i = minN; i < maxN; ++i) - { + for (let i = minN; i < maxN; ++i) { result.push(entries[i]); } } @@ -755,7 +762,7 @@ const AppThemed = withStyles(appStyles)(class extends ResizeResponsiveComponent<
{ @@ -1051,67 +1058,62 @@ const AppThemed = withStyles(appStyles)(class extends ResizeResponsiveComponent< -
-
-
 
-
-
- -
-
-

- Error: {this.state.errorMessage} -

-
-
- +
+
+
 
+
+
+ +
+
+

+ Error: {this.state.errorMessage} +

+
+
+ +
- +
 
-
 
- -
- {/* initial load mask*/} -
-
-
-
- -
- - Loading... - -
-
+ {/* Reloading mask */} -
-
- -
-
- +
+
+
+
+ +
+ + { + this.state.displayState === State.Loading ? + "Loading..." + :this.getReloadingMessage() + } +
- - {this.getReloadingMessage()} -
-
- +
+ ); } });