Add sync warning to top
This commit is contained in:
parent
55b0b09d6a
commit
290060e6c4
@ -17,16 +17,24 @@
|
||||
|
||||
$textColor: #ccc;
|
||||
|
||||
.status {
|
||||
align-items: center;
|
||||
.container {
|
||||
color: $textColor;
|
||||
display: flex;
|
||||
left: 0;
|
||||
padding: 0.5rem 0.75rem;
|
||||
position: fixed;
|
||||
right: 0;
|
||||
top: 0;
|
||||
z-index: 1000;
|
||||
|
||||
.status {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.warning {
|
||||
background: red;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.plugins {
|
||||
|
@ -31,6 +31,7 @@ import StatusIndicator from '@parity/ui/StatusIndicator';
|
||||
import Consensus from './Consensus';
|
||||
import AccountStore from '../ParityBar/accountStore';
|
||||
import ParityBarStore from '../ParityBar/store';
|
||||
import SyncWarning from '../SyncWarning';
|
||||
import PluginStore from './pluginStore';
|
||||
import Upgrade from './Upgrade';
|
||||
|
||||
@ -43,54 +44,57 @@ function Status ({ className = '', upgradeStore }, { api }) {
|
||||
const accountStore = AccountStore.get(api);
|
||||
|
||||
return (
|
||||
<GradientBg className={ `${styles.status} ${className}` }>
|
||||
<ClientVersion className={ styles.version } />
|
||||
<div className={ styles.upgrade }>
|
||||
<Consensus upgradeStore={ upgradeStore } />
|
||||
<Upgrade upgradeStore={ upgradeStore } />
|
||||
</div>
|
||||
<div className={ styles.plugins }>
|
||||
{
|
||||
pluginStore.components.map((Component, index) => (
|
||||
<Component key={ index } />
|
||||
))
|
||||
}
|
||||
<div className={ styles.divider } />
|
||||
<SignerPending
|
||||
className={ styles.signerPending }
|
||||
onClick={ parityBarStore.toggleOpenSigner }
|
||||
/>
|
||||
<IdentityIcon
|
||||
address={ accountStore.defaultAccount }
|
||||
button
|
||||
center
|
||||
className={ styles.defaultAccount }
|
||||
onClick={ parityBarStore.toggleOpenAccounts }
|
||||
/>
|
||||
<StatusIndicator
|
||||
className={ styles.health }
|
||||
id='application.status.health'
|
||||
/>
|
||||
<div className={ styles.divider } />
|
||||
<BlockNumber
|
||||
className={ styles.blockNumber }
|
||||
message={
|
||||
<FormattedMessage
|
||||
id='ui.blockStatus.bestBlock'
|
||||
defaultMessage=' best block'
|
||||
/>
|
||||
<GradientBg className={ className }>
|
||||
<div className={ styles.status }>
|
||||
<ClientVersion className={ styles.version } />
|
||||
<div className={ styles.upgrade }>
|
||||
<Consensus upgradeStore={ upgradeStore } />
|
||||
<Upgrade upgradeStore={ upgradeStore } />
|
||||
</div>
|
||||
<div className={ styles.plugins }>
|
||||
{
|
||||
pluginStore.components.map((Component, index) => (
|
||||
<Component key={ index } />
|
||||
))
|
||||
}
|
||||
/>
|
||||
<NetPeers
|
||||
className={ styles.peers }
|
||||
message={
|
||||
<FormattedMessage
|
||||
id='ui.netPeers.peers'
|
||||
defaultMessage=' peers'
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<NetChain className={ styles.chain } />
|
||||
<div className={ styles.divider } />
|
||||
<SignerPending
|
||||
className={ styles.signerPending }
|
||||
onClick={ parityBarStore.toggleOpenSigner }
|
||||
/>
|
||||
<IdentityIcon
|
||||
address={ accountStore.defaultAccount }
|
||||
button
|
||||
center
|
||||
className={ styles.defaultAccount }
|
||||
onClick={ parityBarStore.toggleOpenAccounts }
|
||||
/>
|
||||
<StatusIndicator
|
||||
className={ styles.health }
|
||||
id='application.status.health'
|
||||
/>
|
||||
<div className={ styles.divider } />
|
||||
<BlockNumber
|
||||
className={ styles.blockNumber }
|
||||
message={
|
||||
<FormattedMessage
|
||||
id='ui.blockStatus.bestBlock'
|
||||
defaultMessage=' best block'
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<NetPeers
|
||||
className={ styles.peers }
|
||||
message={
|
||||
<FormattedMessage
|
||||
id='ui.netPeers.peers'
|
||||
defaultMessage=' peers'
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<NetChain className={ styles.chain } />
|
||||
</div>
|
||||
<SyncWarning className={ styles.warning } />
|
||||
</div>
|
||||
</GradientBg>
|
||||
);
|
||||
|
@ -15,27 +15,6 @@
|
||||
/* along with Parity. If not; see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
.overlay {
|
||||
background: rgba(255, 255, 255, 0.75);
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
position: fixed;
|
||||
right: 0;
|
||||
top: 0;
|
||||
z-index: 10000;
|
||||
}
|
||||
|
||||
.modal {
|
||||
align-items: flex-start;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
left: 0;
|
||||
position: fixed;
|
||||
right: 0;
|
||||
top: 0;
|
||||
z-index: 10001;
|
||||
}
|
||||
|
||||
.body {
|
||||
box-shadow: rgba(0, 0, 0, 0.25) 0 14px 45px, rgba(0, 0, 0, 0.22) 0 10px 18px;
|
||||
color: rgb(208, 208, 208);
|
||||
|
@ -16,105 +16,47 @@
|
||||
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { connect } from 'react-redux';
|
||||
import store from 'store';
|
||||
|
||||
import Button from '@parity/ui/Button';
|
||||
import Checkbox from '@parity/ui/Form/Checkbox';
|
||||
import GradientBg from '@parity/ui/GradientBg';
|
||||
import StatusIndicator from '@parity/ui/StatusIndicator';
|
||||
|
||||
import styles from './syncWarning.css';
|
||||
|
||||
const LS_DONT_SHOW_AGAIN = '_parity::syncWarning::dontShowAgain';
|
||||
|
||||
export const showSyncWarning = () => {
|
||||
const dontShowAgain = store.get(LS_DONT_SHOW_AGAIN);
|
||||
|
||||
if (dontShowAgain === undefined || dontShowAgain === null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return !dontShowAgain;
|
||||
};
|
||||
|
||||
class SyncWarning extends Component {
|
||||
static propTypes = {
|
||||
className: PropTypes.string,
|
||||
isOk: PropTypes.bool.isRequired,
|
||||
health: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
state = {
|
||||
dontShowAgain: false,
|
||||
show: true
|
||||
};
|
||||
|
||||
render () {
|
||||
const { isOk, health } = this.props;
|
||||
const { dontShowAgain, show } = this.state;
|
||||
const { className, isOk, health } = this.props;
|
||||
|
||||
if (isOk || !show) {
|
||||
if (isOk) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className={ styles.overlay } />
|
||||
<div className={ styles.modal }>
|
||||
<GradientBg className={ styles.body }>
|
||||
<div className={ styles.status }>
|
||||
<StatusIndicator
|
||||
type='signal'
|
||||
id='healthWarning.indicator'
|
||||
status={ health.overall.status }
|
||||
/>
|
||||
</div>
|
||||
|
||||
{
|
||||
health.overall.message.map(message => (
|
||||
<p key={ message }>{ message }</p>
|
||||
))
|
||||
}
|
||||
|
||||
<div className={ styles.button }>
|
||||
<Checkbox
|
||||
label={
|
||||
<FormattedMessage
|
||||
id='syncWarning.dontShowAgain.label'
|
||||
defaultMessage='Do not show this warning again'
|
||||
/>
|
||||
}
|
||||
checked={ dontShowAgain }
|
||||
onClick={ this.handleCheck }
|
||||
/>
|
||||
<Button
|
||||
label={
|
||||
<FormattedMessage
|
||||
id='syncWarning.understandBtn.label'
|
||||
defaultMessage='I understand'
|
||||
/>
|
||||
}
|
||||
onClick={ this.handleAgreeClick }
|
||||
/>
|
||||
</div>
|
||||
</GradientBg>
|
||||
<div className={ className }>
|
||||
<div className={ styles.body }>
|
||||
<div className={ styles.status }>
|
||||
<StatusIndicator
|
||||
type='signal'
|
||||
id='healthWarning.indicator'
|
||||
status={ health.overall.status }
|
||||
/>
|
||||
</div>
|
||||
{
|
||||
health.overall.message.map((message) => (
|
||||
<p key={ message }>
|
||||
{ message }
|
||||
</p>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
handleCheck = () => {
|
||||
this.setState({ dontShowAgain: !this.state.dontShowAgain });
|
||||
}
|
||||
|
||||
handleAgreeClick = () => {
|
||||
if (this.state.dontShowAgain) {
|
||||
store.set(LS_DONT_SHOW_AGAIN, true);
|
||||
}
|
||||
|
||||
this.setState({ show: false });
|
||||
}
|
||||
}
|
||||
|
||||
function mapStateToProps (state) {
|
||||
|
Loading…
Reference in New Issue
Block a user