Skip to content

Commit bfbda63

Browse files
committed
Merge remote-tracking branch 'benma/spinner'
2 parents 0984482 + ff34fc1 commit bfbda63

File tree

1 file changed

+36
-32
lines changed

1 file changed

+36
-32
lines changed

frontends/web/src/routes/account/account.tsx

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -218,23 +218,41 @@ export function Account({
218218
return null;
219219
}
220220

221-
const canSend = balance && balance.hasAvailable;
222-
223-
const initializingSpinnerText =
224-
(syncedAddressesCount !== undefined && syncedAddressesCount > 1) ? (
225-
'\n' + t('account.syncedAddressesCount', {
226-
count: syncedAddressesCount.toString(),
227-
defaultValue: 0,
228-
} as any)
229-
) : '';
230-
231-
const offlineErrorTextLines: string[] = [];
221+
if (status.fatalError) {
222+
return (
223+
<Spinner guideExists text={t('account.fatalError')} />
224+
);
225+
}
232226
if (status.offlineError !== null) {
227+
const offlineErrorTextLines: string[] = [];
233228
offlineErrorTextLines.push(t('account.reconnecting'));
234229
offlineErrorTextLines.push(status.offlineError);
235230
if (usesProxy) {
236231
offlineErrorTextLines.push(t('account.maybeProxyError'));
237232
}
233+
return (
234+
<Spinner guideExists text={offlineErrorTextLines.join('\n')} />
235+
);
236+
}
237+
if (!status.synced) {
238+
const text =
239+
(syncedAddressesCount !== undefined && syncedAddressesCount > 1) ? (
240+
'\n' + t('account.syncedAddressesCount', {
241+
count: syncedAddressesCount.toString(),
242+
defaultValue: 0,
243+
} as any)
244+
) : '';
245+
246+
return (
247+
<Spinner guideExists text={
248+
t('account.initializing') + text
249+
} />
250+
);
251+
}
252+
if (!hasDataLoaded) {
253+
return (
254+
<Spinner guideExists text={''} />
255+
);
238256
}
239257

240258
const exchangeBuySupported = supportedExchanges && supportedExchanges.exchanges.length > 0;
@@ -250,7 +268,7 @@ export function Account({
250268
const actionButtonsProps = {
251269
code,
252270
coinCode: account.coinCode,
253-
canSend,
271+
canSend: balance && balance.hasAvailable,
254272
exchangeBuySupported,
255273
account
256274
};
@@ -303,26 +321,12 @@ export function Account({
303321
balanceList={[balance]}
304322
/>
305323
)}
306-
{ !status.synced || offlineErrorTextLines.length || !hasDataLoaded || status.fatalError ? (
307-
<Spinner guideExists text={
308-
(status.fatalError && t('account.fatalError'))
309-
|| offlineErrorTextLines.join('\n')
310-
|| (!status.synced &&
311-
t('account.initializing')
312-
+ initializingSpinnerText
313-
)
314-
|| ''
315-
} />
316-
) : (
317-
<>
318-
{!isAccountEmpty && <Transactions
319-
accountCode={code}
320-
handleExport={exportAccount}
321-
explorerURL={account.blockExplorerTxPrefix}
322-
transactions={transactions}
323-
/> }
324-
</>
325-
) }
324+
{!isAccountEmpty && <Transactions
325+
accountCode={code}
326+
handleExport={exportAccount}
327+
explorerURL={account.blockExplorerTxPrefix}
328+
transactions={transactions}
329+
/> }
326330
</div>
327331
</div>
328332
</div>

0 commit comments

Comments
 (0)