Browse Source
Merge pull request #1767 from gre/allow-to-keep-sync-for-disruption-warnings
Allow to flag disabled currencies so they still keep in sync
gre-patch-1
Gaëtan Renaudeau
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
14 additions and
4 deletions
-
src/bridge/BridgeSyncContext.js
-
src/components/CurrenciesStatusBanner.js
-
src/components/CurrencyDownStatusAlert.js
-
src/reducers/currenciesStatus.js
|
|
@ -77,7 +77,8 @@ class Provider extends Component<BridgeSyncProviderOwnProps, Sync> { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if (currencyDownStatusLocal(this.props.currenciesStatus, account.currency)) { |
|
|
|
const downStatus = currencyDownStatusLocal(this.props.currenciesStatus, account.currency) |
|
|
|
if (downStatus && !downStatus.keepSync) { |
|
|
|
next() |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
@ -116,7 +116,11 @@ class BannerItem extends PureComponent<{ |
|
|
|
render() { |
|
|
|
const { item, t } = this.props |
|
|
|
return ( |
|
|
|
<Box relative key={item.id} style={styles.banner}> |
|
|
|
<Box |
|
|
|
relative |
|
|
|
key={item.id} |
|
|
|
style={{ ...styles.banner, ...(item.warning ? styles.warning : null) }} |
|
|
|
> |
|
|
|
<CloseIcon onClick={this.dismiss} /> |
|
|
|
<Box horizontal flow={2}> |
|
|
|
<IconTriangleWarning height={16} width={16} color="white" /> |
|
|
@ -159,6 +163,9 @@ const styles = { |
|
|
|
left: 32, |
|
|
|
bottom: 32, |
|
|
|
}, |
|
|
|
warning: { |
|
|
|
background: colors.orange, |
|
|
|
}, |
|
|
|
banner: { |
|
|
|
background: colors.alertRed, |
|
|
|
overflow: 'hidden', |
|
|
|
|
|
@ -28,7 +28,7 @@ const CurrencyDownBox = styled(Box).attrs({ |
|
|
|
py: 2, |
|
|
|
mb: 4, |
|
|
|
})` |
|
|
|
background-color: ${p => p.theme.colors.alertRed}; |
|
|
|
background-color: ${p => (p.warning ? p.theme.colors.orange : p.theme.colors.alertRed)}; |
|
|
|
` |
|
|
|
|
|
|
|
const Link = styled.span` |
|
|
@ -48,7 +48,7 @@ class CurrencyDownStatusAlert extends PureComponent<Props> { |
|
|
|
const { status, t } = this.props |
|
|
|
if (!status) return null |
|
|
|
return ( |
|
|
|
<CurrencyDownBox> |
|
|
|
<CurrencyDownBox warning={!!status.warning}> |
|
|
|
<Box mr={2}> |
|
|
|
<IconTriangleWarning height={16} width={16} /> |
|
|
|
</Box> |
|
|
|
|
|
@ -15,6 +15,8 @@ export type CurrencyStatus = { |
|
|
|
message: string, |
|
|
|
link: string, |
|
|
|
nonce: number, |
|
|
|
warning?: boolean, // display as a warning
|
|
|
|
keepSync?: boolean, // even if something is happening, make live still stay in sync
|
|
|
|
} |
|
|
|
|
|
|
|
export type CurrenciesStatusState = CurrencyStatus[] |
|
|
|