diff --git a/apps/static/src/assets/preloader.css b/apps/static/src/assets/preloader.css deleted file mode 100644 index fae2f38fd..000000000 --- a/apps/static/src/assets/preloader.css +++ /dev/null @@ -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; -} diff --git a/apps/static/src/preloader.scss b/apps/static/src/preloader.scss deleted file mode 100644 index b19dc6c59..000000000 --- a/apps/static/src/preloader.scss +++ /dev/null @@ -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; - } - } -} diff --git a/apps/trading/components/app-loader/app-loader.tsx b/apps/trading/components/bootstrapper/bootstrapper.tsx similarity index 90% rename from apps/trading/components/app-loader/app-loader.tsx rename to apps/trading/components/bootstrapper/bootstrapper.tsx index d2bc94930..fa30e4f2b 100644 --- a/apps/trading/components/app-loader/app-loader.tsx +++ b/apps/trading/components/bootstrapper/bootstrapper.tsx @@ -1,6 +1,7 @@ import type { InMemoryCacheConfig } from '@apollo/client'; import { AppFailure, + AppLoader, DocsLinks, NetworkLoader, NodeGuard, @@ -9,15 +10,10 @@ import { import { t } from '@vegaprotocol/i18n'; import { MaintenancePage } from '@vegaprotocol/ui-toolkit'; import { VegaWalletProvider } from '@vegaprotocol/wallet'; -import dynamic from 'next/dynamic'; import type { ReactNode } from 'react'; import { Web3Provider } from './web3-provider'; -export const DynamicLoader = dynamic(() => import('../preloader/preloader'), { - loading: () => <>Loading..., -}); - -export const AppLoader = ({ children }: { children: ReactNode }) => { +export const Bootstrapper = ({ children }: { children: ReactNode }) => { const { error, VEGA_URL, @@ -47,13 +43,13 @@ export const AppLoader = ({ children }: { children: ReactNode }) => { return ( } + skeleton={} failure={ } > } + skeleton={} failure={} > diff --git a/apps/trading/components/app-loader/index.tsx b/apps/trading/components/bootstrapper/index.tsx similarity index 50% rename from apps/trading/components/app-loader/index.tsx rename to apps/trading/components/bootstrapper/index.tsx index 2a7420559..cbff6382a 100644 --- a/apps/trading/components/app-loader/index.tsx +++ b/apps/trading/components/bootstrapper/index.tsx @@ -1,2 +1,2 @@ -export * from './app-loader'; +export * from './bootstrapper'; export * from './web3-provider'; diff --git a/apps/trading/components/app-loader/web3-provider.tsx b/apps/trading/components/bootstrapper/web3-provider.tsx similarity index 100% rename from apps/trading/components/app-loader/web3-provider.tsx rename to apps/trading/components/bootstrapper/web3-provider.tsx diff --git a/apps/trading/components/preloader/preloader.tsx b/apps/trading/components/preloader/preloader.tsx deleted file mode 100644 index f5d366057..000000000 --- a/apps/trading/components/preloader/preloader.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { Loader } from '@vegaprotocol/ui-toolkit'; - -export const Preloader = () => { - return ( - <> - -
- -
- - ); -}; - -export default Preloader; diff --git a/apps/trading/pages/_app.page.tsx b/apps/trading/pages/_app.page.tsx index 27b3cddfb..e70c099ca 100644 --- a/apps/trading/pages/_app.page.tsx +++ b/apps/trading/pages/_app.page.tsx @@ -36,7 +36,7 @@ import { useSearchParams, } from 'react-router-dom'; 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 { activeOrdersProvider } from '@vegaprotocol/orders'; 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 { Telemetry } from '../components/telemetry'; import { Routes as AppRoutes } from '../lib/links'; +import { SSRLoader } from './ssr-loader'; 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 // relies on presence of document object if (status === 'default') { - return ; + return ; } return ( - + - + ); diff --git a/apps/trading/pages/_document.page.tsx b/apps/trading/pages/_document.page.tsx index b58ef8d04..2e36d11fb 100644 --- a/apps/trading/pages/_document.page.tsx +++ b/apps/trading/pages/_document.page.tsx @@ -22,14 +22,17 @@ export default function Document() { - {/* eslint-disable-next-line @next/next/no-css-tags */} - - {/* scripts */}