Skip to content

Commit

Permalink
feature: fix balance failed "retry" load state (#2027)
Browse files Browse the repository at this point in the history
* Fixes translation typo and refactors FailedPanel.jsx

* lint

* snapshots

* Revert testing changes to balancesActions.js

* revert changes to AssetBalancesPanel/index.js
  • Loading branch information
comountainclimber authored Nov 29, 2020
1 parent 6c040f4 commit 6befd56
Show file tree
Hide file tree
Showing 22 changed files with 69 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ exports[`Sidebar renders without crashing 1`] = `
"nodeSelectSelectAutomatically": "Select automatically",
"nodeSelectionInstructions": "If you’re experiencing performance issues, try selecting a custom node below",
"nothingToSeeHere": "Nothing to see here!",
"notifications.failure.blockchainInfoFailure": "Failed to retrieve blockchain information.",
"notifications.success.accountSaved": "Account saved!",
"notifications.success.receivedBlockchainInfo": "Received latest blockchain information.",
"notifications.success.updatedWalletName": "Succesfully updated wallet name.",
"notificiations.failure.blockchainInfoFailure": "Failed to retrieve blockchain information.",
"numberofTransactionsPending": "{transferCount, number} {transferCount, plural, one {Transfer} other {Transfers}} pending",
"previousStep": "Previous Step",
"print": "Print",
Expand Down Expand Up @@ -825,10 +825,10 @@ exports[`Sidebar renders without crashing 1`] = `
"nodeSelectSelectAutomatically": "Select automatically",
"nodeSelectionInstructions": "If you’re experiencing performance issues, try selecting a custom node below",
"nothingToSeeHere": "Nothing to see here!",
"notifications.failure.blockchainInfoFailure": "Failed to retrieve blockchain information.",
"notifications.success.accountSaved": "Account saved!",
"notifications.success.receivedBlockchainInfo": "Received latest blockchain information.",
"notifications.success.updatedWalletName": "Succesfully updated wallet name.",
"notificiations.failure.blockchainInfoFailure": "Failed to retrieve blockchain information.",
"numberofTransactionsPending": "{transferCount, number} {transferCount, plural, one {Transfer} other {Transfers}} pending",
"previousStep": "Previous Step",
"print": "Print",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ exports[`NetworkSwitch renders without crashing 1`] = `
"nodeSelectSelectAutomatically": "Select automatically",
"nodeSelectionInstructions": "If you’re experiencing performance issues, try selecting a custom node below",
"nothingToSeeHere": "Nothing to see here!",
"notifications.failure.blockchainInfoFailure": "Failed to retrieve blockchain information.",
"notifications.success.accountSaved": "Account saved!",
"notifications.success.receivedBlockchainInfo": "Received latest blockchain information.",
"notifications.success.updatedWalletName": "Succesfully updated wallet name.",
"notificiations.failure.blockchainInfoFailure": "Failed to retrieve blockchain information.",
"numberofTransactionsPending": "{transferCount, number} {transferCount, plural, one {Transfer} other {Transfers}} pending",
"previousStep": "Previous Step",
"print": "Print",
Expand Down
2 changes: 1 addition & 1 deletion __tests__/components/__snapshots__/News.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ exports[`News renders without crashing 1`] = `
"nodeSelectSelectAutomatically": "Select automatically",
"nodeSelectionInstructions": "If you’re experiencing performance issues, try selecting a custom node below",
"nothingToSeeHere": "Nothing to see here!",
"notifications.failure.blockchainInfoFailure": "Failed to retrieve blockchain information.",
"notifications.success.accountSaved": "Account saved!",
"notifications.success.receivedBlockchainInfo": "Received latest blockchain information.",
"notifications.success.updatedWalletName": "Succesfully updated wallet name.",
"notificiations.failure.blockchainInfoFailure": "Failed to retrieve blockchain information.",
"numberofTransactionsPending": "{transferCount, number} {transferCount, plural, one {Transfer} other {Transfers}} pending",
"previousStep": "Previous Step",
"print": "Print",
Expand Down
2 changes: 1 addition & 1 deletion __tests__/components/__snapshots__/Settings.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ exports[`Settings renders without crashing 1`] = `
"nodeSelectSelectAutomatically": "Select automatically",
"nodeSelectionInstructions": "If you’re experiencing performance issues, try selecting a custom node below",
"nothingToSeeHere": "Nothing to see here!",
"notifications.failure.blockchainInfoFailure": "Failed to retrieve blockchain information.",
"notifications.success.accountSaved": "Account saved!",
"notifications.success.receivedBlockchainInfo": "Received latest blockchain information.",
"notifications.success.updatedWalletName": "Succesfully updated wallet name.",
"notificiations.failure.blockchainInfoFailure": "Failed to retrieve blockchain information.",
"numberofTransactionsPending": "{transferCount, number} {transferCount, plural, one {Transfer} other {Transfers}} pending",
"previousStep": "Previous Step",
"print": "Print",
Expand Down
2 changes: 1 addition & 1 deletion __tests__/components/__snapshots__/Sidebar.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ exports[`Sidebar renders without crashing 1`] = `
"nodeSelectSelectAutomatically": "Select automatically",
"nodeSelectionInstructions": "If you’re experiencing performance issues, try selecting a custom node below",
"nothingToSeeHere": "Nothing to see here!",
"notifications.failure.blockchainInfoFailure": "Failed to retrieve blockchain information.",
"notifications.success.accountSaved": "Account saved!",
"notifications.success.receivedBlockchainInfo": "Received latest blockchain information.",
"notifications.success.updatedWalletName": "Succesfully updated wallet name.",
"notificiations.failure.blockchainInfoFailure": "Failed to retrieve blockchain information.",
"numberofTransactionsPending": "{transferCount, number} {transferCount, plural, one {Transfer} other {Transfers}} pending",
"previousStep": "Previous Step",
"print": "Print",
Expand Down
36 changes: 25 additions & 11 deletions app/components/FailedPanel/FailedPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,49 @@ import { Link } from 'react-router-dom'
import Panel from '../Panel'
import styles from './FailedPanel.scss'
import { ROUTES } from '../../core/constants'
import Loader from '../Loader'

type Props = {
className: ?string,
title: ?string,
onRetry: ?Function,
loading: boolean,
}

export default class LoadingPanel extends React.Component<Props> {
static defaultProps = {
title: 'Failed',
onRetry: null,
loading: false,
}

render() {
const { loading, className } = this.props

return (
<Panel
className={classNames(styles.loadingPanel, this.props.className)}
contentClassName={styles.content}
className={className}
contentClassName={classNames([
styles.content,
{ [styles.loadingContent]: loading },
])}
renderHeader={this.renderHeader}
>
Failed to load. {this.renderRetry()} or{' '}
<Link
to={{
pathname: ROUTES.NODE_SELECT,
}}
className={styles.settingsDonations}
>
select a different node.
</Link>
{loading ? (
<Loader />
) : (
<React.Fragment>
Failed to load. {this.renderRetry()} or{' '}
<Link
to={{
pathname: ROUTES.NODE_SELECT,
}}
className={styles.settingsDonations}
>
select a different node.
</Link>
</React.Fragment>
)}
</Panel>
)
}
Expand Down
12 changes: 7 additions & 5 deletions app/components/FailedPanel/FailedPanel.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.failedPanel {
.content {
text-align: center;
vertical-align: middle;
}
.loadingContent {
text-align: center;
vertical-align: middle;
position: relative;
min-height: 100px;
text-align: center;
vertical-align: middle;
}
18 changes: 17 additions & 1 deletion app/components/FailedPanel/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
export { default } from './FailedPanel'
// @flow
import { compose } from 'recompose'

import FailedPanel from './FailedPanel'
import balancesActions from '../../actions/balancesActions'
import withLoadingProp from '../../hocs/withLoadingProp'
import withFailureNotification from '../../hocs/withFailureNotification'

export default compose(
withLoadingProp(balancesActions),
withFailureNotification(
balancesActions,
'notifications.failure.blockchainInfoFailure',
{},
true,
),
)(FailedPanel)
2 changes: 1 addition & 1 deletion app/containers/Receive/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export default compose(
),
withFailureNotification(
balancesActions,
'notificiations.failure.blockchainInfoFailure',
'notifications.failure.blockchainInfoFailure',
{},
true,
),
Expand Down
2 changes: 1 addition & 1 deletion app/containers/Send/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default compose(
),
withFailureNotification(
balancesActions,
'notificiations.failure.blockchainInfoFailure',
'notifications.failure.blockchainInfoFailure',
{},
true,
),
Expand Down
2 changes: 1 addition & 1 deletion app/containers/TransactionHistory/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default compose(
),
withFailureNotification(
balancesActions,
'notificiations.failure.blockchainInfoFailure',
'notifications.failure.blockchainInfoFailure',
{},
true,
),
Expand Down
2 changes: 1 addition & 1 deletion app/translations/arabic.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const NOTIFICATIONS = {
'تلقي أحدث معلومات blockchain.',
'notifications.success.accountSaved': 'تم حفظ الحساب!',
'notifications.success.updatedWalletName': 'تم تحديث اسم المحفظة بنجاح.',
'notificiations.failure.blockchainInfoFailure':
'notifications.failure.blockchainInfoFailure':
'فشل في استعادة معلومات blockchain.',
}

Expand Down
2 changes: 1 addition & 1 deletion app/translations/chinese.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const NOTIFICATIONS = {
'notifications.success.receivedBlockchainInfo': '收到最新的区块链信息。',
'notifications.success.accountSaved': '帐户已保存!',
'notifications.success.updatedWalletName': '成功更新了钱包名称.',
'notificiations.failure.blockchainInfoFailure': '检索区块链信息失败。',
'notifications.failure.blockchainInfoFailure': '检索区块链信息失败。',
}

const AUTH = {
Expand Down
2 changes: 1 addition & 1 deletion app/translations/english.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const NOTIFICATIONS = {
'Received latest blockchain information.',
'notifications.success.accountSaved': 'Account saved!',
'notifications.success.updatedWalletName': 'Succesfully updated wallet name.',
'notificiations.failure.blockchainInfoFailure':
'notifications.failure.blockchainInfoFailure':
'Failed to retrieve blockchain information.',
}

Expand Down
2 changes: 1 addition & 1 deletion app/translations/french.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ const NOTIFICATIONS = {
'notifications.success.accountSaved': 'Compte enregistré!',
'notifications.success.updatedWalletName':
'Nom du portefeuille mis à jour avec succès.',
'notificiations.failure.blockchainInfoFailure':
'notifications.failure.blockchainInfoFailure':
'Échec de la récupération des informations de la chaîne de blocs.',
}

Expand Down
2 changes: 1 addition & 1 deletion app/translations/german.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const NOTIFICATIONS = {
'notifications.success.accountSaved': 'Konto gespeichert!',
'notifications.success.updatedWalletName':
'Erfolgreich aktualisierter Brieftaschenname.',
'notificiations.failure.blockchainInfoFailure':
'notifications.failure.blockchainInfoFailure':
'Fehler beim Abrufen der Blockchain-Informationen.',
}

Expand Down
2 changes: 1 addition & 1 deletion app/translations/italian.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const NOTIFICATIONS = {
'notifications.success.accountSaved': 'Account salvato!',
'notifications.success.updatedWalletName':
'Nome del portafoglio aggiornato con successo.',
'notificiations.failure.blockchainInfoFailure':
'notifications.failure.blockchainInfoFailure':
'Impossibile recuperare le informazioni sulla blockchain.',
}

Expand Down
2 changes: 1 addition & 1 deletion app/translations/korean.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const NOTIFICATIONS = {
'notifications.success.accountSaved': '계정이 저장되었습니다!',
'notifications.success.updatedWalletName':
'지갑 이름이 성공적으로 업데이트되었습니다.',
'notificiations.failure.blockchainInfoFailure':
'notifications.failure.blockchainInfoFailure':
'블록 체인 정보를 검색하지 못했습니다.',
}

Expand Down
2 changes: 1 addition & 1 deletion app/translations/portuguese.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ const NOTIFICATIONS = {
'notifications.success.accountSaved': 'Conta salva!',
'notifications.success.updatedWalletName':
'Nome do portfólio atualizado com sucesso.',
'notificiations.failure.blockchainInfoFailure':
'notifications.failure.blockchainInfoFailure':
'Falha ao recuperar as informações da blockchain.',
}

Expand Down
2 changes: 1 addition & 1 deletion app/translations/russian.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const NOTIFICATIONS = {
'notifications.success.accountSaved': 'Аккаунт сохранен!',
'notifications.success.updatedWalletName':
'Название кошелька успешно обновлено.',
'notificiations.failure.blockchainInfoFailure':
'notifications.failure.blockchainInfoFailure':
'В процессе получения информации о блокчейне произошла ошибка.',
}

Expand Down
2 changes: 1 addition & 1 deletion app/translations/turkish.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const NOTIFICATIONS = {
'notifications.success.accountSaved': 'Hesap kaydedildi!',
'notifications.success.updatedWalletName':
'Cüzdan adı başarıyla güncellendi.',
'notificiations.failure.blockchainInfoFailure':
'notifications.failure.blockchainInfoFailure':
'Blockchain bilgileri alınamadı.',
}

Expand Down
2 changes: 1 addition & 1 deletion app/translations/vietnamese.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ const NOTIFICATIONS = {
'Nhận được thông tin blockchain mới nhất.',
'notifications.success.accountSaved': 'Tài khoản đã được lưu!',
'notifications.success.updatedWalletName': 'Tên ví được cập nhật thành công.',
'notificiations.failure.blockchainInfoFailure':
'notifications.failure.blockchainInfoFailure':
'Không thể truy xuất thông tin blockchain.',
}

Expand Down

0 comments on commit 6befd56

Please sign in to comment.