|
1 | 1 | import { StatusBar } from "expo-status-bar";
|
2 | 2 | import {
|
3 | 3 | ActivityIndicator,
|
| 4 | + Button, |
4 | 5 | ScrollView,
|
5 | 6 | StyleSheet,
|
6 | 7 | Text,
|
@@ -33,6 +34,9 @@ export default function Balances() {
|
33 | 34 | refetchInterval: 1000,
|
34 | 35 | });
|
35 | 36 |
|
| 37 | + const pauseSyncing = facade.pauseSyncing.useMutation(); |
| 38 | + const resumeSyncing = facade.resumeSyncing.useMutation(); |
| 39 | + |
36 | 40 | useEffect(() => {
|
37 | 41 | if (getAccountResult.data) {
|
38 | 42 | setAccount(getAccountResult.data.name);
|
@@ -78,11 +82,32 @@ export default function Balances() {
|
78 | 82 | {getWalletStatusResult.data &&
|
79 | 83 | getWalletStatusResult.data.status === "SCANNING" && (
|
80 | 84 | // TODO: Only show this if the wallet is behind a certain number of blocks to avoid flickering
|
81 |
| - <> |
| 85 | + <View style={{ backgroundColor: "#eee" }}> |
82 | 86 | <Text>{`Blocks Scanned: ${getAccountResult.data?.head?.sequence ?? "--"} / ${getWalletStatusResult.data.latestKnownBlock}`}</Text>
|
83 | 87 | <Text>Your balances may currently be inaccurate.</Text>
|
84 | 88 | <Text>Learn More</Text>
|
85 |
| - </> |
| 89 | + <Button |
| 90 | + onPress={async () => { |
| 91 | + await pauseSyncing.mutateAsync(undefined); |
| 92 | + }} |
| 93 | + title="Pause" |
| 94 | + /> |
| 95 | + </View> |
| 96 | + )} |
| 97 | + {getWalletStatusResult.data && |
| 98 | + getWalletStatusResult.data.status !== "SCANNING" && ( |
| 99 | + // TODO: Once scanning starts automatically, this should only show in the "PAUSED" state. |
| 100 | + <View style={{ backgroundColor: "#eee" }}> |
| 101 | + <Text>{`Scanning Paused: ${getAccountResult.data?.head?.sequence ?? "--"} / ${getWalletStatusResult.data.latestKnownBlock}`}</Text> |
| 102 | + <Text>Your balances may currently be inaccurate.</Text> |
| 103 | + <Text>Learn More</Text> |
| 104 | + <Button |
| 105 | + onPress={async () => { |
| 106 | + await resumeSyncing.mutateAsync(undefined); |
| 107 | + }} |
| 108 | + title="Resume" |
| 109 | + /> |
| 110 | + </View> |
86 | 111 | )}
|
87 | 112 | <View style={{ display: "flex", flexDirection: "row" }}>
|
88 | 113 | <LinkButton href="/send/" title="Send" />
|
|
0 commit comments