import { Box } from '@mui/material';
import { alpha, useTheme } from '@mui/material/styles';
import Header from '@blocklet/ui-react/lib/Header';
interface LoadingViewProps {
mode?: string;
}
// Pulsing dots — minimal loading indicator
function PulsingDots() {
return (
{[0, 1, 2].map((i) => (
))}
);
}
// Reuse the same blob decoration as error-view (without wireframe mesh for simplicity)
function LoadingDecoration() {
return (
`linear-gradient(45deg, ${alpha(t.palette.primary.main, 0.1)}, ${alpha(t.palette.primary.main, 0.03)})`,
filter: 'blur(1px)',
animation: 'spin 20s linear infinite',
'@keyframes spin': { from: { transform: 'rotate(0deg)' }, to: { transform: 'rotate(360deg)' } },
}}
/>
`linear-gradient(135deg, ${alpha(t.palette.primary.main, 0.07)}, ${alpha(t.palette.primary.main, 0.01)})`,
filter: 'blur(1px)',
transform: 'scale(0.88)',
opacity: 0.6,
animation: 'spinReverse 15s linear infinite',
'@keyframes spinReverse': {
from: { transform: 'scale(0.88) rotate(0deg)' },
to: { transform: 'scale(0.88) rotate(-360deg)' },
},
}}
/>
);
}
export default function LoadingView({ mode = 'inline' }: LoadingViewProps) {
const isFullScreen = mode === 'standalone';
const theme = useTheme();
const primaryColor = theme.palette.primary.main;
// Shared background — must match checkout-layout parent exactly
const bgSx = {
background: {
xs: 'none',
md: `linear-gradient(160deg, ${alpha(primaryColor, 0.03)} 0%, ${alpha(primaryColor, 0.07)} 50%, ${alpha(primaryColor, 0.04)} 100%)`,
},
bgcolor: (t: any) => (t.palette.mode === 'dark' ? 'background.default' : '#f8faff'),
};
// Centered content
const centerContent = (
);
if (!isFullScreen) {
return (
{centerContent}
);
}
// Standalone (full-screen) mode
return (
{/* Header */}
buildIns.filter((addon: any) => ['locale-selector', 'theme-mode-toggle', 'session-user'].includes(addon.key))
}
/>
{centerContent}
);
}