LinearProgress -> Progress
This commit is contained in:
parent
34d68ccb73
commit
aabf08fd75
@ -14,7 +14,6 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import { LinearProgress } from 'material-ui';
|
|
||||||
import React, { Component, PropTypes } from 'react';
|
import React, { Component, PropTypes } from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
@ -22,7 +21,7 @@ import { connect } from 'react-redux';
|
|||||||
import { bindActionCreators } from 'redux';
|
import { bindActionCreators } from 'redux';
|
||||||
|
|
||||||
import { hideRequest } from '~/redux/providers/requestsActions';
|
import { hideRequest } from '~/redux/providers/requestsActions';
|
||||||
import { MethodDecoding, IdentityIcon, ScrollableText, ShortenedHash } from '~/ui';
|
import { MethodDecoding, IdentityIcon, Progress, ScrollableText, ShortenedHash } from '~/ui';
|
||||||
|
|
||||||
import styles from './requests.css';
|
import styles from './requests.css';
|
||||||
|
|
||||||
@ -100,7 +99,7 @@ class Requests extends Component {
|
|||||||
state.type === ERROR_STATE
|
state.type === ERROR_STATE
|
||||||
? null
|
? null
|
||||||
: (
|
: (
|
||||||
<LinearProgress
|
<Progress
|
||||||
max={ 6 }
|
max={ 6 }
|
||||||
mode={ state.type === WAITING_STATE ? 'indeterminate' : 'determinate' }
|
mode={ state.type === WAITING_STATE ? 'indeterminate' : 'determinate' }
|
||||||
value={ state.type === DONE_STATE ? request.blockHeight.toNumber() : 6 }
|
value={ state.type === DONE_STATE ? request.blockHeight.toNumber() : 6 }
|
||||||
|
@ -16,10 +16,11 @@
|
|||||||
|
|
||||||
import React, { Component, PropTypes } from 'react';
|
import React, { Component, PropTypes } from 'react';
|
||||||
import { debounce } from 'lodash';
|
import { debounce } from 'lodash';
|
||||||
import { LinearProgress } from 'material-ui';
|
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import zxcvbn from 'zxcvbn';
|
import zxcvbn from 'zxcvbn';
|
||||||
|
|
||||||
|
import Progress from '~/ui/Progress';
|
||||||
|
|
||||||
import styles from './passwordStrength.css';
|
import styles from './passwordStrength.css';
|
||||||
|
|
||||||
const BAR_STYLE = {
|
const BAR_STYLE = {
|
||||||
@ -80,9 +81,9 @@ export default class PasswordStrength extends Component {
|
|||||||
defaultMessage='password strength'
|
defaultMessage='password strength'
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<LinearProgress
|
<Progress
|
||||||
color={ color }
|
color={ color }
|
||||||
mode='determinate'
|
determinate
|
||||||
style={ BAR_STYLE }
|
style={ BAR_STYLE }
|
||||||
value={ value }
|
value={ value }
|
||||||
/>
|
/>
|
||||||
|
@ -36,25 +36,25 @@ describe('ui/Form/PasswordStrength', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('renders a linear progress', () => {
|
it('renders a linear progress', () => {
|
||||||
expect(render({ input: INPUT_A }).find('LinearProgress')).to.be.ok;
|
expect(render({ input: INPUT_A }).find('Progress')).to.be.ok;
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('compute strength', () => {
|
describe('compute strength', () => {
|
||||||
it('has low score with empty input', () => {
|
it('has low score with empty input', () => {
|
||||||
expect(
|
expect(
|
||||||
render({ input: INPUT_NULL }).find('LinearProgress').props().value
|
render({ input: INPUT_NULL }).find('Progress').props().value
|
||||||
).to.equal(20);
|
).to.equal(20);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('has medium score', () => {
|
it('has medium score', () => {
|
||||||
expect(
|
expect(
|
||||||
render({ input: INPUT_A }).find('LinearProgress').props().value
|
render({ input: INPUT_A }).find('Progress').props().value
|
||||||
).to.equal(60);
|
).to.equal(60);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('has high score', () => {
|
it('has high score', () => {
|
||||||
expect(
|
expect(
|
||||||
render({ input: INPUT_B }).find('LinearProgress').props().value
|
render({ input: INPUT_B }).find('Progress').props().value
|
||||||
).to.equal(100);
|
).to.equal(100);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
17
js/src/ui/Progress/index.js
Normal file
17
js/src/ui/Progress/index.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
|
||||||
|
// Parity is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
export default from './progress';
|
50
js/src/ui/Progress/progress.js
Normal file
50
js/src/ui/Progress/progress.js
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
|
||||||
|
// This file is part of Parity.
|
||||||
|
|
||||||
|
// Parity is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
|
||||||
|
// Parity is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import { LinearProgress } from 'material-ui';
|
||||||
|
import React, { PropTypes } from 'react';
|
||||||
|
|
||||||
|
export default function Progress ({ className, color, determinate, max, min, style, value }) {
|
||||||
|
return (
|
||||||
|
<LinearProgress
|
||||||
|
className={ className }
|
||||||
|
color={ color }
|
||||||
|
max={ max }
|
||||||
|
min={ min }
|
||||||
|
mode={
|
||||||
|
determinate
|
||||||
|
? 'determinate'
|
||||||
|
: 'indeterminate'
|
||||||
|
}
|
||||||
|
style={ style }
|
||||||
|
value={ value }
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Progress.propTypes = {
|
||||||
|
className: PropTypes.string,
|
||||||
|
color: PropTypes.string,
|
||||||
|
determinate: PropTypes.bool,
|
||||||
|
max: PropTypes.number,
|
||||||
|
min: PropTypes.number,
|
||||||
|
style: PropTypes.object,
|
||||||
|
value: PropTypes.number
|
||||||
|
};
|
||||||
|
|
||||||
|
Progress.defaultProps = {
|
||||||
|
determinate: false
|
||||||
|
};
|
@ -14,7 +14,6 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import { LinearProgress } from 'material-ui';
|
|
||||||
import { Step, Stepper, StepLabel } from 'material-ui/Stepper';
|
import { Step, Stepper, StepLabel } from 'material-ui/Stepper';
|
||||||
import React, { Component, PropTypes } from 'react';
|
import React, { Component, PropTypes } from 'react';
|
||||||
|
|
||||||
@ -23,6 +22,7 @@ import React, { Component, PropTypes } from 'react';
|
|||||||
// h3 (title) can be pulled from there. (As it stands the duplication
|
// h3 (title) can be pulled from there. (As it stands the duplication
|
||||||
// between the 2 has been removed, but as a short-term DRY only)
|
// between the 2 has been removed, but as a short-term DRY only)
|
||||||
import { Title as ContainerTitle } from '~/ui/Container';
|
import { Title as ContainerTitle } from '~/ui/Container';
|
||||||
|
import Progress from '~/ui/Progress';
|
||||||
import { nodeOrStringProptype } from '~/util/proptypes';
|
import { nodeOrStringProptype } from '~/util/proptypes';
|
||||||
|
|
||||||
import styles from './title.css';
|
import styles from './title.css';
|
||||||
@ -113,7 +113,7 @@ export default class Title extends Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={ styles.waiting }>
|
<div className={ styles.waiting }>
|
||||||
<LinearProgress />
|
<Progress />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -82,8 +82,8 @@ describe('ui/Title', () => {
|
|||||||
waiting = shallow(instance.renderWaiting());
|
waiting = shallow(instance.renderWaiting());
|
||||||
});
|
});
|
||||||
|
|
||||||
it('renders the LinearProgress', () => {
|
it('renders the Progress', () => {
|
||||||
expect(waiting.find('LinearProgress').get(0)).to.be.ok;
|
expect(waiting.find('Progress').get(0)).to.be.ok;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
import { LinearProgress } from 'material-ui';
|
|
||||||
import React, { Component, PropTypes } from 'react';
|
import React, { Component, PropTypes } from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
@ -24,7 +23,9 @@ import { txLink } from '~/3rdparty/etherscan/links';
|
|||||||
import Warning from '~/ui/Warning';
|
import Warning from '~/ui/Warning';
|
||||||
import { DEFAULT_GAS } from '~/util/constants';
|
import { DEFAULT_GAS } from '~/util/constants';
|
||||||
|
|
||||||
import ShortenedHash from '../ShortenedHash';
|
import Progress from '~/ui/Progress';
|
||||||
|
import ShortenedHash from '~/ui/ShortenedHash';
|
||||||
|
|
||||||
import styles from './txHash.css';
|
import styles from './txHash.css';
|
||||||
|
|
||||||
class TxHash extends Component {
|
class TxHash extends Component {
|
||||||
@ -180,10 +181,9 @@ class TxHash extends Component {
|
|||||||
if (!(transactionReceipt && transactionReceipt.blockNumber && transactionReceipt.blockNumber.gt(0))) {
|
if (!(transactionReceipt && transactionReceipt.blockNumber && transactionReceipt.blockNumber.gt(0))) {
|
||||||
return (
|
return (
|
||||||
<div className={ styles.confirm }>
|
<div className={ styles.confirm }>
|
||||||
<LinearProgress
|
<Progress
|
||||||
className={ styles.progressbar }
|
className={ styles.progressbar }
|
||||||
color='white'
|
color='white'
|
||||||
mode='indeterminate'
|
|
||||||
/>
|
/>
|
||||||
<div className={ styles.progressinfo }>
|
<div className={ styles.progressinfo }>
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
@ -206,13 +206,13 @@ class TxHash extends Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={ styles.confirm }>
|
<div className={ styles.confirm }>
|
||||||
<LinearProgress
|
<Progress
|
||||||
className={ styles.progressbar }
|
className={ styles.progressbar }
|
||||||
min={ 0 }
|
min={ 0 }
|
||||||
max={ maxConfirmations }
|
max={ maxConfirmations }
|
||||||
value={ value }
|
value={ value }
|
||||||
color='white'
|
color='white'
|
||||||
mode='determinate'
|
determinate
|
||||||
/>
|
/>
|
||||||
<div className={ styles.progressinfo }>
|
<div className={ styles.progressinfo }>
|
||||||
<abbr title={ `block #${blockNumber.toFormat(0)}` }>
|
<abbr title={ `block #${blockNumber.toFormat(0)}` }>
|
||||||
|
@ -114,7 +114,7 @@ describe('ui/TxHash', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('renders indeterminate progressbar', () => {
|
it('renders indeterminate progressbar', () => {
|
||||||
expect(child.find('LinearProgress[mode="indeterminate"]')).to.have.length(1);
|
expect(child.find('Progress')).to.have.length(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('renders waiting text', () => {
|
it('renders waiting text', () => {
|
||||||
@ -132,7 +132,7 @@ describe('ui/TxHash', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('renders determinate progressbar', () => {
|
it('renders determinate progressbar', () => {
|
||||||
expect(child.find('LinearProgress[mode="determinate"]')).to.have.length(1);
|
expect(child.find('Progress[determinate]')).to.have.length(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('renders confirmation text', () => {
|
it('renders confirmation text', () => {
|
||||||
|
@ -47,6 +47,7 @@ export ModalBox from './ModalBox';
|
|||||||
export muiTheme from './Theme';
|
export muiTheme from './Theme';
|
||||||
export Page from './Page';
|
export Page from './Page';
|
||||||
export Portal from './Portal';
|
export Portal from './Portal';
|
||||||
|
export Progress from './Progress';
|
||||||
export QrCode from './QrCode';
|
export QrCode from './QrCode';
|
||||||
export QrScan from './QrScan';
|
export QrScan from './QrScan';
|
||||||
export ScrollableText from './ScrollableText';
|
export ScrollableText from './ScrollableText';
|
||||||
|
@ -17,13 +17,12 @@
|
|||||||
import { isEqual } from 'lodash';
|
import { isEqual } from 'lodash';
|
||||||
import React, { Component, PropTypes } from 'react';
|
import React, { Component, PropTypes } from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import LinearProgress from 'material-ui/LinearProgress';
|
|
||||||
import { Card, CardActions, CardTitle, CardText } from 'material-ui/Card';
|
import { Card, CardActions, CardTitle, CardText } from 'material-ui/Card';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { bindActionCreators } from 'redux';
|
import { bindActionCreators } from 'redux';
|
||||||
|
|
||||||
import { newError } from '~/redux/actions';
|
import { newError } from '~/redux/actions';
|
||||||
import { Button, TypedInput } from '~/ui';
|
import { Button, Progress, TypedInput } from '~/ui';
|
||||||
import { arrayOrObjectProptype } from '~/util/proptypes';
|
import { arrayOrObjectProptype } from '~/util/proptypes';
|
||||||
import { parseAbiType } from '~/util/abi';
|
import { parseAbiType } from '~/util/abi';
|
||||||
|
|
||||||
@ -126,7 +125,7 @@ class InputQuery extends Component {
|
|||||||
|
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
return (
|
return (
|
||||||
<LinearProgress mode='indeterminate' />
|
<Progress />
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import { LinearProgress, MenuItem, IconMenu } from 'material-ui';
|
import { MenuItem, IconMenu } from 'material-ui';
|
||||||
import React, { Component, PropTypes } from 'react';
|
import React, { Component, PropTypes } from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import ReactTooltip from 'react-tooltip';
|
import ReactTooltip from 'react-tooltip';
|
||||||
@ -24,7 +24,7 @@ import { bindActionCreators } from 'redux';
|
|||||||
import { bytesToHex } from '@parity/api/util/format';
|
import { bytesToHex } from '@parity/api/util/format';
|
||||||
|
|
||||||
import { confirmOperation, revokeOperation } from '~/redux/providers/walletActions';
|
import { confirmOperation, revokeOperation } from '~/redux/providers/walletActions';
|
||||||
import { Container, InputAddress, Button, IdentityIcon } from '~/ui';
|
import { Button, Container, InputAddress, IdentityIcon, Progress } from '~/ui';
|
||||||
import TxRow from '~/ui/TxList/TxRow';
|
import TxRow from '~/ui/TxList/TxRow';
|
||||||
|
|
||||||
import styles from '../wallet.css';
|
import styles from '../wallet.css';
|
||||||
@ -319,16 +319,15 @@ class WalletConfirmation extends Component {
|
|||||||
{
|
{
|
||||||
pending
|
pending
|
||||||
? (
|
? (
|
||||||
<LinearProgress
|
<Progress
|
||||||
key={ `pending_${operation}` }
|
key={ `pending_${operation}` }
|
||||||
mode='indeterminate'
|
|
||||||
style={ style }
|
style={ style }
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
: (
|
: (
|
||||||
<LinearProgress
|
<Progress
|
||||||
key={ `unpending_${operation}` }
|
key={ `unpending_${operation}` }
|
||||||
mode='determinate'
|
determinate
|
||||||
min={ 0 }
|
min={ 0 }
|
||||||
max={ require.toNumber() }
|
max={ require.toNumber() }
|
||||||
value={ confirmedBy.length }
|
value={ confirmedBy.length }
|
||||||
|
Loading…
Reference in New Issue
Block a user