Skip to content

Commit

Permalink
added redux notification on unreachable error
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiewang committed Nov 12, 2017
1 parent 0e7ec3d commit 1646392
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 35 deletions.
44 changes: 22 additions & 22 deletions common/components/BalanceSidebar/AccountInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,28 +91,28 @@ export default class AccountInfo extends React.Component<Props, State> {
</div>

{(!!blockExplorer || !!tokenExplorer) && (
<div className="AccountInfo-section">
<h5 className="AccountInfo-section-header">
{translate('sidebar_TransHistory')}
</h5>
<ul className="AccountInfo-list">
{!!blockExplorer && (
<li className="AccountInfo-list-item">
<a href={blockExplorer.address(address)} target="_blank">
{`${network.name} (${blockExplorer.name})`}
</a>
</li>
)}
{!!tokenExplorer && (
<li className="AccountInfo-list-item">
<a href={tokenExplorer.address(address)} target="_blank">
{`Tokens (${tokenExplorer.name})`}
</a>
</li>
)}
</ul>
</div>
)}
<div className="AccountInfo-section">
<h5 className="AccountInfo-section-header">
{translate('sidebar_TransHistory')}
</h5>
<ul className="AccountInfo-list">
{!!blockExplorer && (
<li className="AccountInfo-list-item">
<a href={blockExplorer.address(address)} target="_blank">
{`${network.name} (${blockExplorer.name})`}
</a>
</li>
)}
{!!tokenExplorer && (
<li className="AccountInfo-list-item">
<a href={tokenExplorer.address(address)} target="_blank">
{`Tokens (${tokenExplorer.name})`}
</a>
</li>
)}
</ul>
</div>
)}
</div>
);
}
Expand Down
45 changes: 32 additions & 13 deletions common/containers/Tabs/Swap/components/CurrencySwap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,20 @@ export default class CurrencySwap extends Component<
minAmount = toFixedIfLarger(REPMin, 3);
break;
default:
console.warn('Something went terribly wrong!');
if (this.state.showedMinMaxError) {
this.setState(
{
showedMinMaxError: true
},
() => {
this.props.showNotification(
'danger',
"Couldn't get match currency kind. Something went terribly wrong",
10000
);
}
);
}
}
return { minAmount, maxAmount };
};
Expand Down Expand Up @@ -237,19 +250,22 @@ export default class CurrencySwap extends Component<
<div className="CurrencySwap-input-group">
<span className="CurrencySwap-error-message">{originErr}</span>
<input
className={`CurrencySwap-input form-control ${String(
originAmount
) !== '' && this.isMinMaxValid(originAmount, originKind)
? 'is-valid'
: 'is-invalid'}`}
className={`CurrencySwap-input form-control ${
String(originAmount) !== '' &&
this.isMinMaxValid(originAmount, originKind)
? 'is-valid'
: 'is-invalid'
}`}
type="number"
placeholder="Amount"
value={originAmount || originAmount === 0 ? originAmount : ''}
onChange={this.onChangeOriginAmount}
/>
<div className="CurrencySwap-dropdown">
<OriginKindDropDown
ariaLabel={`change origin kind. current origin kind ${originKind}`}
ariaLabel={`change origin kind. current origin kind ${
originKind
}`}
options={originKindOptions}
value={originKind}
onChange={this.props.originKindSwap}
Expand All @@ -264,11 +280,12 @@ export default class CurrencySwap extends Component<
{destinationErr}
</span>
<input
className={`CurrencySwap-input form-control ${String(
destinationAmount
) !== '' && this.isMinMaxValid(originAmount, originKind)
? 'is-valid'
: 'is-invalid'}`}
className={`CurrencySwap-input form-control ${
String(destinationAmount) !== '' &&
this.isMinMaxValid(originAmount, originKind)
? 'is-valid'
: 'is-invalid'
}`}
type="number"
placeholder="Amount"
value={
Expand All @@ -280,7 +297,9 @@ export default class CurrencySwap extends Component<
/>
<div className="CurrencySwap-dropdown">
<DestinationKindDropDown
ariaLabel={`change destination kind. current destination kind ${destinationKind}`}
ariaLabel={`change destination kind. current destination kind ${
destinationKind
}`}
options={destinationKindOptions}
value={destinationKind}
onChange={this.props.destinationKindSwap}
Expand Down

0 comments on commit 1646392

Please sign in to comment.