Skip to content

Commit

Permalink
added progress bar for chain sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Erfan Shekarchi committed Apr 5, 2024
1 parent 0406249 commit 1d9e033
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions apps/box/src/screens/Settings/Pools.screen.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react';
import { RefreshControl, StyleSheet } from 'react-native';
import { RefreshControl, StyleSheet, Alert } from 'react-native';
import Reanimated from 'react-native-reanimated';
import {
FxBox,
Expand Down Expand Up @@ -81,8 +81,15 @@ export const PoolsScreen = () => {

const wrappedJoinPool = async (poolID: number) => {
try {
setRefreshing(true);
await joinPool(poolID);
if (syncProgress==0 || syncProgress > 90){
setRefreshing(true);
await joinPool(poolID);
} else {
Alert.alert(
"Please wait",
"chain needs to complete the sync before you can join a pool"
)
}
} catch (e) {
handlePoolActionErrors('Error joining pool', e.toString());
} finally {
Expand Down Expand Up @@ -176,7 +183,7 @@ export const PoolsScreen = () => {
flexDirection="row"
alignItems='center'
>
<FxText>Chain is Syncing: {syncProgress}% </FxText>
<FxText>Chain is Syncing: {Math.floor(syncProgress)}%</FxText>
<FxProgressBar
height={5}
progress={syncProgress > 0 ? syncProgress : 0}
Expand Down

0 comments on commit 1d9e033

Please sign in to comment.