import React, { memo } from "react"; import { Box, Stack, Typography } from "@mui/material"; import CircularProgress from "@mui/material/CircularProgress"; import Fade from "@mui/material/Fade"; import { Theme, useTheme } from "@mui/material/styles"; import { alpha } from "@mui/system"; import Logo from "../components/Logo"; import { LogoType } from "../types"; import { ss } from "../util/select_styles"; const styles = (theme: Theme) => ({ root: { position: "fixed", top: 0, left: 0, width: "100%", height: "100%", }, backdrop: { position: "absolute", zIndex: 2000, backgroundColor: alpha(theme.palette.background.default, 0.666), }, backdropPrimary: { backgroundColor: alpha(theme.palette.primary.main, 0.666), }, backdropSecondary: { backgroundColor: alpha(theme.palette.secondary.main, 0.666), }, backdropPaper: { backgroundColor: alpha(theme.palette.background.paper, 0.666), }, spinner: { color: theme.palette.primary.main, }, spinnerContrast: { color: theme.palette.primary.contrastText, }, logo: { position: "absolute", margin: 0, marginTop: theme.spacing(-36), }, }) as const; export interface LoadingScreenBaseProps { color?: string; label?: string; loading?: boolean; logo?: LogoType; } export interface LoadingScreenInnerProps extends LoadingScreenBaseProps { classes: ReturnType; backdrop: boolean; } const LoadingScreenInner: React.FC = ({ backdrop, classes, color, label, loading, logo, }) => ( {logo != null && } {loading && } {label != null && ( {label} )} ); export interface LoadingScreenProps extends LoadingScreenBaseProps { backdrop?: boolean; classes?: ReturnType; } export const LoadingScreen: React.FC = ({ backdrop = false, classes = styles(useTheme()), color, label, loading = true, logo, }) => backdrop ? (
) : ( ); export default memo(LoadingScreen);