-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(visualizator-be): Add loading screen & other loaders
- Loading branch information
1 parent
ce80e4b
commit db8e088
Showing
19 changed files
with
742 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,13 @@ | |
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Polkadot visualization</title> | ||
<title>XCM Visualizator</title> | ||
<link rel="preconnect" href="https://fonts.googleapis.com" /> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> | ||
<link | ||
href="https://fonts.googleapis.com/css2?family=Anek+Devanagari:[email protected]&display=swap" | ||
rel="stylesheet" | ||
/> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
apps/visualizator-fe/src/components/CssLoader/CssLoader.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
.loader { | ||
font-size: 28px; | ||
color: #dbfafd; | ||
width: 1em; | ||
height: 1em; | ||
box-sizing: border-box; | ||
background-color: currentcolor; | ||
position: relative; | ||
border-radius: 50%; | ||
transform: rotateX(-60deg) perspective(1000px); | ||
} | ||
.loader:before, | ||
.loader:after { | ||
content: ''; | ||
display: block; | ||
position: absolute; | ||
box-sizing: border-box; | ||
top: 0; | ||
left: 0; | ||
width: inherit; | ||
height: inherit; | ||
border-radius: inherit; | ||
animation: flowerFlow 1s ease-out infinite; | ||
} | ||
.loader:after { | ||
animation-delay: 0.4s; | ||
} | ||
|
||
@keyframes flowerFlow { | ||
0% { | ||
opacity: 1; | ||
transform: rotate(0deg); | ||
box-shadow: | ||
0 0 0 -0.5em currentcolor, | ||
0 0 0 -0.5em currentcolor, | ||
0 0 0 -0.5em currentcolor, | ||
0 0 0 -0.5em currentcolor, | ||
0 0 0 -0.5em currentcolor, | ||
0 0 0 -0.5em currentcolor, | ||
0 0 0 -0.5em currentcolor, | ||
0 0 0 -0.5em currentcolor; | ||
} | ||
100% { | ||
opacity: 0; | ||
transform: rotate(180deg); | ||
box-shadow: | ||
-1em -1em 0 -0.35em currentcolor, | ||
0 -1.5em 0 -0.35em currentcolor, | ||
1em -1em 0 -0.35em currentcolor, | ||
-1.5em 0 0 -0.35em currentcolor, | ||
1.5em -0 0 -0.35em currentcolor, | ||
-1em 1em 0 -0.35em currentcolor, | ||
0 1.5em 0 -0.35em currentcolor, | ||
1em 1em 0 -0.35em currentcolor; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { Box } from '@mantine/core'; | ||
import classes from './CssLoader.module.css'; | ||
|
||
export const CssLoader = () => <Box className={classes.loader} component="span" />; |
60 changes: 60 additions & 0 deletions
60
apps/visualizator-fe/src/components/LoadingScreen/LoadingScreen.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { LoadingOverlay } from '@mantine/core'; | ||
import StarsBackground from '../StarsBackground/StarsBackground'; | ||
import LogoLoader from '../LogoLoader/LogoLoader'; | ||
import { FC, useEffect, useState } from 'react'; | ||
import { | ||
NetworkStatus, | ||
UseApolloNetworkStatusOptions | ||
} from 'react-apollo-network-status/dist/src/useApolloNetworkStatus'; | ||
|
||
type Props = { | ||
useApolloNetworkStatus: (options?: UseApolloNetworkStatusOptions | undefined) => NetworkStatus; | ||
}; | ||
|
||
const LoadingScreen: FC<Props> = ({ useApolloNetworkStatus }) => { | ||
const status = useApolloNetworkStatus(); | ||
const [initialLoad, setInitialLoad] = useState(true); | ||
const [loading, setLoading] = useState(true); | ||
|
||
useEffect(() => { | ||
let timeout: NodeJS.Timeout; | ||
if (initialLoad) { | ||
timeout = setTimeout(() => { | ||
if (status.numPendingQueries === 0) { | ||
setLoading(false); | ||
setInitialLoad(false); | ||
} else { | ||
const interval = setInterval(() => { | ||
if (status.numPendingQueries === 0) { | ||
setLoading(false); | ||
setInitialLoad(false); | ||
clearInterval(interval); | ||
} | ||
}, 500); | ||
} | ||
}, 1000); | ||
|
||
return () => { | ||
clearTimeout(timeout); | ||
clearInterval(timeout); | ||
}; | ||
} | ||
}, [initialLoad, status.numPendingQueries]); | ||
|
||
return ( | ||
<LoadingOverlay | ||
visible={loading} | ||
zIndex={1000} | ||
overlayProps={{ | ||
backgroundOpacity: 1, | ||
color: '#000', | ||
children: <StarsBackground /> | ||
}} | ||
loaderProps={{ | ||
children: <LogoLoader /> | ||
}} | ||
/> | ||
); | ||
}; | ||
|
||
export default LoadingScreen; |
14 changes: 14 additions & 0 deletions
14
apps/visualizator-fe/src/components/LogoLoader/LogoLoader.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.logoTitle { | ||
font-family: 'Anek Devanagari', sans-serif; | ||
font-optical-sizing: auto; | ||
font-weight: 600; | ||
letter-spacing: 5px; | ||
font-style: normal; | ||
font-variation-settings: 'wdth' 100; | ||
color: #dbfafd; | ||
font-size: 24px; | ||
} | ||
|
||
.xcmText { | ||
margin-bottom: -6px; | ||
} |
Oops, something went wrong.