File tree Expand file tree Collapse file tree 3 files changed +34
-2
lines changed
Expand file tree Collapse file tree 3 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -15,8 +15,11 @@ export default function Group() {
1515 const [ filteredCommitments , setFilteredCommitments ] = useState < string [ ] > ( [ ] )
1616 const [ filteredProofs , setFilteredProofs ] = useState < any [ ] > ( [ ] )
1717
18+ const [ loading , setLoading ] = useState ( false )
19+
1820 useEffect ( ( ) => {
1921 const fetchData = async ( ) => {
22+ setLoading ( true )
2023 const subgraph = new SemaphoreSubgraph ( network )
2124
2225 const groupInfo = await subgraph . getGroup ( groupId , {
@@ -28,6 +31,7 @@ export default function Group() {
2831
2932 setFilteredCommitments ( groupInfo . members || [ ] )
3033 setFilteredProofs ( groupInfo . validatedProofs || [ ] )
34+ setLoading ( false )
3135 }
3236
3337 fetchData ( )
@@ -59,7 +63,11 @@ export default function Group() {
5963 [ group ]
6064 )
6165
62- return (
66+ return loading ? (
67+ < div className = "flex justify-center items-center h-screen" >
68+ < div className = "loader" />
69+ </ div >
70+ ) : (
6371 group && (
6472 < div className = "mx-auto max-w-7xl px-4 lg:px-8 pt-20" >
6573 < div className = "flex justify-center flex-col pb-10 font-[family-name:var(--font-geist-sans)]" >
Original file line number Diff line number Diff line change @@ -13,8 +13,11 @@ export default function Network() {
1313 const [ allGroups , setAllGroups ] = useState < GroupResponse [ ] > ( [ ] )
1414 const [ filteredGroups , setFilteredGroups ] = useState < GroupResponse [ ] > ( [ ] )
1515
16+ const [ loading , setLoading ] = useState ( false )
17+
1618 useEffect ( ( ) => {
1719 const fetchData = async ( ) => {
20+ setLoading ( true )
1821 const subgraph = new SemaphoreSubgraph ( network )
1922
2023 const groups = await subgraph . getGroups ( {
@@ -24,6 +27,7 @@ export default function Network() {
2427
2528 setAllGroups ( groups )
2629 setFilteredGroups ( groups . slice ( ) )
30+ setLoading ( false )
2731 }
2832
2933 fetchData ( )
@@ -38,7 +42,11 @@ export default function Network() {
3842 [ allGroups ]
3943 )
4044
41- return (
45+ return loading ? (
46+ < div className = "flex justify-center items-center h-screen" >
47+ < div className = "loader" />
48+ </ div >
49+ ) : (
4250 allGroups && (
4351 < div className = "mx-auto max-w-7xl px-4 lg:px-8 pt-20" >
4452 < SearchBar className = "mb-6" placeholder = "Group ID" onChange = { filterGroups } />
Original file line number Diff line number Diff line change @@ -25,3 +25,19 @@ body {
2525 text-wrap : balance;
2626 }
2727}
28+
29+ .loader {
30+ width : 25px ;
31+ height : 25px ;
32+ border-radius : 50% ;
33+ border-top : 2px solid # 3555df ;
34+ border-right : 2px solid transparent;
35+ animation : spin 1s linear infinite;
36+ z-index : 20 ;
37+ }
38+
39+ @keyframes spin {
40+ to {
41+ transform : rotate (360deg );
42+ }
43+ }
You can’t perform that action at this time.
0 commit comments