Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d353f24f01 | ||
|
|
5755347a31 | ||
|
|
ade1dff30d | ||
|
|
5ca65260c9 | ||
|
|
c276106cfc | ||
|
|
a1ec426a6e | ||
|
|
e20202f895 |
@@ -1,147 +0,0 @@
|
|||||||
.pre-loader {
|
|
||||||
display: flex;
|
|
||||||
width: 100%;
|
|
||||||
min-height: 100vh;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item {
|
|
||||||
width: 10px;
|
|
||||||
height: 10px;
|
|
||||||
background: #000;
|
|
||||||
}
|
|
||||||
.pre-loader .pre-loader-center {
|
|
||||||
align-items: center;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
.pre-loader .pre-loader-wrapper {
|
|
||||||
width: 50px;
|
|
||||||
height: 50px;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(0) {
|
|
||||||
animation-delay: 0ms;
|
|
||||||
animation-direction: reverse;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:first-child {
|
|
||||||
animation-delay: -0.1s;
|
|
||||||
animation-direction: alternate;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(2) {
|
|
||||||
animation-delay: 0.3s;
|
|
||||||
animation-direction: reverse;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(3) {
|
|
||||||
animation-delay: -0.45s;
|
|
||||||
animation-direction: alternate;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(4) {
|
|
||||||
animation-delay: 1s;
|
|
||||||
animation-direction: reverse;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(5) {
|
|
||||||
animation-delay: -0.75s;
|
|
||||||
animation-direction: alternate;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(6) {
|
|
||||||
animation-delay: 0.9s;
|
|
||||||
animation-direction: reverse;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(7) {
|
|
||||||
animation-delay: -1.4s;
|
|
||||||
animation-direction: alternate;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(8) {
|
|
||||||
animation-delay: 1.6s;
|
|
||||||
animation-direction: reverse;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(9) {
|
|
||||||
animation-delay: -0.45s;
|
|
||||||
animation-direction: alternate;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(10) {
|
|
||||||
animation-delay: 1.5s;
|
|
||||||
animation-direction: reverse;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(11) {
|
|
||||||
animation-delay: -2.75s;
|
|
||||||
animation-direction: alternate;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(12) {
|
|
||||||
animation-delay: 1.2s;
|
|
||||||
animation-direction: reverse;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(13) {
|
|
||||||
animation-delay: -1.95s;
|
|
||||||
animation-direction: alternate;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(14) {
|
|
||||||
animation-delay: 2.8s;
|
|
||||||
animation-direction: reverse;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(15) {
|
|
||||||
animation-delay: -0.75s;
|
|
||||||
animation-direction: alternate;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(16) {
|
|
||||||
animation-delay: 4s;
|
|
||||||
animation-direction: reverse;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(17) {
|
|
||||||
animation-delay: -0.85s;
|
|
||||||
animation-direction: alternate;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(18) {
|
|
||||||
animation-delay: 1.8s;
|
|
||||||
animation-direction: reverse;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(19) {
|
|
||||||
animation-delay: -1.9s;
|
|
||||||
animation-direction: alternate;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(20) {
|
|
||||||
animation-delay: 5s;
|
|
||||||
animation-direction: reverse;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(21) {
|
|
||||||
animation-delay: -5.25s;
|
|
||||||
animation-direction: alternate;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(22) {
|
|
||||||
animation-delay: 4.4s;
|
|
||||||
animation-direction: reverse;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(23) {
|
|
||||||
animation-delay: -5.75s;
|
|
||||||
animation-direction: alternate;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(24) {
|
|
||||||
animation-delay: 4.8s;
|
|
||||||
animation-direction: reverse;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(25) {
|
|
||||||
animation-delay: -5s;
|
|
||||||
animation-direction: alternate;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item {
|
|
||||||
animation: flickering 0.4s linear infinite alternate;
|
|
||||||
}
|
|
||||||
@keyframes flickering {
|
|
||||||
0% {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
25% {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
26% {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
html.dark .pre-loader .loader-item {
|
|
||||||
background: #fff;
|
|
||||||
}
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
.pre-loader {
|
|
||||||
display: flex;
|
|
||||||
width: 100%;
|
|
||||||
min-height: 100vh;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
.loader-item {
|
|
||||||
width: 10px;
|
|
||||||
height: 10px;
|
|
||||||
background: black;
|
|
||||||
}
|
|
||||||
.pre-loader-center {
|
|
||||||
align-items: center;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
.pre-loader-wrapper {
|
|
||||||
width: 50px;
|
|
||||||
height: 50px;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
@for $i from 0 through 25 {
|
|
||||||
.loader-item:nth-child(#{$i}) {
|
|
||||||
@if $i % 2 == 0 {
|
|
||||||
animation-delay: #{$i * 50 * random(5)}ms;
|
|
||||||
animation-direction: reverse;
|
|
||||||
} @else {
|
|
||||||
animation-delay: #{$i * -50 * random(5)}ms;
|
|
||||||
animation-direction: alternate;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.loader-item {
|
|
||||||
animation: flickering 0.4s linear alternate infinite;
|
|
||||||
}
|
|
||||||
@keyframes flickering {
|
|
||||||
0% {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
25% {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
26% {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
html.dark {
|
|
||||||
.pre-loader {
|
|
||||||
.loader-item {
|
|
||||||
background: white;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+4
-8
@@ -1,6 +1,7 @@
|
|||||||
import type { InMemoryCacheConfig } from '@apollo/client';
|
import type { InMemoryCacheConfig } from '@apollo/client';
|
||||||
import {
|
import {
|
||||||
AppFailure,
|
AppFailure,
|
||||||
|
AppLoader,
|
||||||
DocsLinks,
|
DocsLinks,
|
||||||
NetworkLoader,
|
NetworkLoader,
|
||||||
NodeGuard,
|
NodeGuard,
|
||||||
@@ -9,15 +10,10 @@ import {
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import { MaintenancePage } from '@vegaprotocol/ui-toolkit';
|
import { MaintenancePage } from '@vegaprotocol/ui-toolkit';
|
||||||
import { VegaWalletProvider } from '@vegaprotocol/wallet';
|
import { VegaWalletProvider } from '@vegaprotocol/wallet';
|
||||||
import dynamic from 'next/dynamic';
|
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
import { Web3Provider } from './web3-provider';
|
import { Web3Provider } from './web3-provider';
|
||||||
|
|
||||||
export const DynamicLoader = dynamic(() => import('../preloader/preloader'), {
|
export const Bootstrapper = ({ children }: { children: ReactNode }) => {
|
||||||
loading: () => <>Loading...</>,
|
|
||||||
});
|
|
||||||
|
|
||||||
export const AppLoader = ({ children }: { children: ReactNode }) => {
|
|
||||||
const {
|
const {
|
||||||
error,
|
error,
|
||||||
VEGA_URL,
|
VEGA_URL,
|
||||||
@@ -47,13 +43,13 @@ export const AppLoader = ({ children }: { children: ReactNode }) => {
|
|||||||
return (
|
return (
|
||||||
<NetworkLoader
|
<NetworkLoader
|
||||||
cache={cacheConfig}
|
cache={cacheConfig}
|
||||||
skeleton={<DynamicLoader />}
|
skeleton={<AppLoader />}
|
||||||
failure={
|
failure={
|
||||||
<AppFailure title={t('Could not initialize app')} error={error} />
|
<AppFailure title={t('Could not initialize app')} error={error} />
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<NodeGuard
|
<NodeGuard
|
||||||
skeleton={<DynamicLoader />}
|
skeleton={<AppLoader />}
|
||||||
failure={<AppFailure title={t(`Node: ${VEGA_URL} is unsuitable`)} />}
|
failure={<AppFailure title={t(`Node: ${VEGA_URL} is unsuitable`)} />}
|
||||||
>
|
>
|
||||||
<Web3Provider>
|
<Web3Provider>
|
||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
export * from './app-loader';
|
export * from './bootstrapper';
|
||||||
export * from './web3-provider';
|
export * from './web3-provider';
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
import { Loader } from '@vegaprotocol/ui-toolkit';
|
|
||||||
|
|
||||||
export const Preloader = () => {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<style>
|
|
||||||
{`
|
|
||||||
body{
|
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
html.dark body{
|
|
||||||
background: #000;
|
|
||||||
}
|
|
||||||
`}
|
|
||||||
</style>
|
|
||||||
<div className="pre-loader">
|
|
||||||
<Loader />
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Preloader;
|
|
||||||
@@ -36,7 +36,7 @@ import {
|
|||||||
useSearchParams,
|
useSearchParams,
|
||||||
} from 'react-router-dom';
|
} from 'react-router-dom';
|
||||||
import { Connectors } from '../lib/vega-connectors';
|
import { Connectors } from '../lib/vega-connectors';
|
||||||
import { AppLoader, DynamicLoader } from '../components/app-loader';
|
import { Bootstrapper } from '../components/bootstrapper';
|
||||||
import { useDataProvider } from '@vegaprotocol/data-provider';
|
import { useDataProvider } from '@vegaprotocol/data-provider';
|
||||||
import { activeOrdersProvider } from '@vegaprotocol/orders';
|
import { activeOrdersProvider } from '@vegaprotocol/orders';
|
||||||
import { useTelemetryApproval } from '../lib/hooks/use-telemetry-approval';
|
import { useTelemetryApproval } from '../lib/hooks/use-telemetry-approval';
|
||||||
@@ -52,6 +52,7 @@ import { ViewingBanner } from '../components/viewing-banner';
|
|||||||
import { NavHeader } from '../components/navbar/nav-header';
|
import { NavHeader } from '../components/navbar/nav-header';
|
||||||
import { Telemetry } from '../components/telemetry';
|
import { Telemetry } from '../components/telemetry';
|
||||||
import { Routes as AppRoutes } from '../lib/links';
|
import { Routes as AppRoutes } from '../lib/links';
|
||||||
|
import { SSRLoader } from './ssr-loader';
|
||||||
|
|
||||||
const DEFAULT_TITLE = t('Welcome to Vega trading!');
|
const DEFAULT_TITLE = t('Welcome to Vega trading!');
|
||||||
|
|
||||||
@@ -144,14 +145,14 @@ function VegaTradingApp(props: AppProps) {
|
|||||||
// Prevent HashRouter from being server side rendered as it
|
// Prevent HashRouter from being server side rendered as it
|
||||||
// relies on presence of document object
|
// relies on presence of document object
|
||||||
if (status === 'default') {
|
if (status === 'default') {
|
||||||
return <DynamicLoader />;
|
return <SSRLoader />;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HashRouter>
|
<HashRouter>
|
||||||
<AppLoader>
|
<Bootstrapper>
|
||||||
<AppBody {...props} />
|
<AppBody {...props} />
|
||||||
</AppLoader>
|
</Bootstrapper>
|
||||||
<NodeSwitcherDialog open={nodeSwitcherOpen} setOpen={setNodeSwitcher} />
|
<NodeSwitcherDialog open={nodeSwitcherOpen} setOpen={setNodeSwitcher} />
|
||||||
</HashRouter>
|
</HashRouter>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -22,14 +22,17 @@ export default function Document() {
|
|||||||
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
||||||
<link rel="apple-touch-icon" content="/favicon.ico" />
|
<link rel="apple-touch-icon" content="/favicon.ico" />
|
||||||
|
|
||||||
{/* eslint-disable-next-line @next/next/no-css-tags */}
|
|
||||||
<link rel="stylesheet" href="/preloader.css" media="all" />
|
|
||||||
|
|
||||||
{/* scripts */}
|
{/* scripts */}
|
||||||
<script src="/theme-setter.js" type="text/javascript" async />
|
<script src="/theme-setter.js" type="text/javascript" async />
|
||||||
</Head>
|
</Head>
|
||||||
<Html>
|
<Html>
|
||||||
<body className="bg-white dark:bg-vega-cdark-900 text-default font-alpha">
|
<body
|
||||||
|
// Nextjs will set body to display none until js runs. Because the entire app is client rendered
|
||||||
|
// and delivered via ipfs we override this to show a server side render loading animation until the
|
||||||
|
// js is downloaded and react takes over rendering
|
||||||
|
style={{ display: 'block' }}
|
||||||
|
className="bg-white dark:bg-vega-cdark-900 text-default font-alpha"
|
||||||
|
>
|
||||||
<Main />
|
<Main />
|
||||||
<NextScript />
|
<NextScript />
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
export const SSRLoader = () => {
|
||||||
|
const randomDelay = () => {
|
||||||
|
return parseFloat((Math.random() * (4 - 1) + 1).toFixed(2));
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
width: '100vw',
|
||||||
|
height: '100vh',
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<style jsx>{`
|
||||||
|
@keyframes flickering {
|
||||||
|
0% {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
25% {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
26% {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`}</style>
|
||||||
|
<div style={{ width: 50, height: 50, display: 'flex', flexWrap: 'wrap' }}>
|
||||||
|
{new Array(25).fill(null).map((_, i) => {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
key={i}
|
||||||
|
style={{
|
||||||
|
width: 10,
|
||||||
|
height: 10,
|
||||||
|
animation: 'flickering 0.4s linear alternate infinite',
|
||||||
|
animationDelay: `-${randomDelay()}s`,
|
||||||
|
animationDirection: i % 2 === 0 ? 'reverse' : 'alternate',
|
||||||
|
background: 'black',
|
||||||
|
opacity: Math.random() > 0.5 ? 1 : 0,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -1,116 +0,0 @@
|
|||||||
.pre-loader {
|
|
||||||
display: flex;
|
|
||||||
width: 100%;
|
|
||||||
min-height: 100vh;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item {
|
|
||||||
width: 10px;
|
|
||||||
height: 10px;
|
|
||||||
background: #000;
|
|
||||||
}
|
|
||||||
.pre-loader .pre-loader-center {
|
|
||||||
align-items: center;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
.pre-loader .pre-loader-wrapper {
|
|
||||||
width: 50px;
|
|
||||||
height: 50px;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
@media (prefers-color-scheme: light) {
|
|
||||||
.pre-loader .loader-item {
|
|
||||||
background: #000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(0) {
|
|
||||||
animation-delay: 0ms;
|
|
||||||
animation-direction: reverse;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:first-child {
|
|
||||||
animation-delay: -50ms;
|
|
||||||
animation-direction: alternate;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(2) {
|
|
||||||
animation-delay: 0.2s;
|
|
||||||
animation-direction: reverse;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(3) {
|
|
||||||
animation-delay: -0.6s;
|
|
||||||
animation-direction: alternate;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(4) {
|
|
||||||
animation-delay: 0.4s;
|
|
||||||
animation-direction: reverse;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(5) {
|
|
||||||
animation-delay: -0.5s;
|
|
||||||
animation-direction: alternate;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(6) {
|
|
||||||
animation-delay: 0.3s;
|
|
||||||
animation-direction: reverse;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(7) {
|
|
||||||
animation-delay: -1.4s;
|
|
||||||
animation-direction: alternate;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(8) {
|
|
||||||
animation-delay: 2s;
|
|
||||||
animation-direction: reverse;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(9) {
|
|
||||||
animation-delay: -0.9s;
|
|
||||||
animation-direction: alternate;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(10) {
|
|
||||||
animation-delay: 1.5s;
|
|
||||||
animation-direction: reverse;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(11) {
|
|
||||||
animation-delay: -0.55s;
|
|
||||||
animation-direction: alternate;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(12) {
|
|
||||||
animation-delay: 1.2s;
|
|
||||||
animation-direction: reverse;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(13) {
|
|
||||||
animation-delay: -0.65s;
|
|
||||||
animation-direction: alternate;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(14) {
|
|
||||||
animation-delay: 0.7s;
|
|
||||||
animation-direction: reverse;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(15) {
|
|
||||||
animation-delay: -3.75s;
|
|
||||||
animation-direction: alternate;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item:nth-child(16) {
|
|
||||||
animation-delay: 1.6s;
|
|
||||||
animation-direction: reverse;
|
|
||||||
}
|
|
||||||
.pre-loader .loader-item {
|
|
||||||
animation: flickering 0.4s linear infinite alternate;
|
|
||||||
}
|
|
||||||
@keyframes flickering {
|
|
||||||
0% {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
25% {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
26% {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
html.dark .pre-loader .loader-item {
|
|
||||||
background: #fff;
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import { Button } from '@vegaprotocol/ui-toolkit';
|
import { Button, Splash } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useNodeSwitcherStore } from '../../hooks/use-node-switcher-store';
|
import { useNodeSwitcherStore } from '../../hooks/use-node-switcher-store';
|
||||||
|
|
||||||
export const AppFailure = ({
|
export const AppFailure = ({
|
||||||
@@ -10,17 +10,15 @@ export const AppFailure = ({
|
|||||||
error?: string | null;
|
error?: string | null;
|
||||||
}) => {
|
}) => {
|
||||||
const setNodeSwitcher = useNodeSwitcherStore((store) => store.setDialogOpen);
|
const setNodeSwitcher = useNodeSwitcherStore((store) => store.setDialogOpen);
|
||||||
const nonIdealWrapperClasses =
|
|
||||||
'h-full min-h-screen flex items-center justify-center';
|
|
||||||
return (
|
return (
|
||||||
<div className={nonIdealWrapperClasses}>
|
<Splash>
|
||||||
<div className="text-center">
|
<div className="text-center">
|
||||||
<p className="text-xl mb-4">{title}</p>
|
<p className="mb-4 text-xl">{title}</p>
|
||||||
{error && <p className="text-sm mb-8">{error}</p>}
|
{error && <p className="mb-8 text-sm">{error}</p>}
|
||||||
<Button onClick={() => setNodeSwitcher(true)}>
|
<Button onClick={() => setNodeSwitcher(true)}>
|
||||||
{t('Change node')}
|
{t('Change node')}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</Splash>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { Loader, Splash } from '@vegaprotocol/ui-toolkit';
|
||||||
|
|
||||||
|
export const AppLoader = () => {
|
||||||
|
return (
|
||||||
|
<Splash>
|
||||||
|
<Loader />
|
||||||
|
</Splash>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export { AppLoader } from './app-loader';
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
export * from './app-failure';
|
export * from './app-failure';
|
||||||
|
export * from './app-loader';
|
||||||
export * from './network-loader';
|
export * from './network-loader';
|
||||||
export * from './network-switcher';
|
export * from './network-switcher';
|
||||||
export * from './node-guard';
|
export * from './node-guard';
|
||||||
|
|||||||
@@ -30,11 +30,8 @@ export const Loader = ({ size = 'large', forceTheme }: LoaderProps) => {
|
|||||||
const generate = useMemo(() => pseudoRandom(1), []);
|
const generate = useMemo(() => pseudoRandom(1), []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div className="flex flex-col items-center" data-testid="loader">
|
||||||
className="flex flex-col items-center pre-loader-center"
|
<div className={`${wrapperClasses} flex flex-wrap`}>
|
||||||
data-testid="loader"
|
|
||||||
>
|
|
||||||
<div className={`${wrapperClasses} flex flex-wrap pre-loader-wrapper`}>
|
|
||||||
{new Array(items).fill(null).map((_, i) => {
|
{new Array(items).fill(null).map((_, i) => {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|||||||
Reference in New Issue
Block a user