Ui 2 Select component conversion (#5598)
* Remove mui/Paper from PasswordManager * Aliasses for @parity packages * Remove mui/Card from contract queries * Toggle component replacement (mui-only) * Semantic-ui toggle component * LabelComponent warpper for Toggle * Convert Selectors * Test fixes * Fix case
This commit is contained in:
parent
b1a390983b
commit
78b6de55b3
@ -23,7 +23,7 @@
|
|||||||
* element
|
* element
|
||||||
* @return {String}
|
* @return {String}
|
||||||
*/
|
*/
|
||||||
export function toString (context, value) {
|
export function parseI18NString (context, value) {
|
||||||
if (!context.intl) {
|
if (!context.intl) {
|
||||||
console.warn(`remember to add:
|
console.warn(`remember to add:
|
||||||
static contextTypes = {
|
static contextTypes = {
|
||||||
|
@ -24,7 +24,7 @@ import TextFieldUnderline from 'material-ui/TextField/TextFieldUnderline';
|
|||||||
|
|
||||||
import apiutil from '@parity/api/util';
|
import apiutil from '@parity/api/util';
|
||||||
import { nodeOrStringProptype } from '@parity/shared/util/proptypes';
|
import { nodeOrStringProptype } from '@parity/shared/util/proptypes';
|
||||||
import { toString } from '@parity/shared/util/messages';
|
import { parseI18NString } from '@parity/shared/util/messages';
|
||||||
import { validateAddress } from '@parity/shared/util/validation';
|
import { validateAddress } from '@parity/shared/util/validation';
|
||||||
|
|
||||||
import AccountCard from '~/ui/AccountCard';
|
import AccountCard from '~/ui/AccountCard';
|
||||||
@ -187,7 +187,7 @@ class AddressSelect extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const id = `addressSelect_${++currentId}`;
|
const id = `addressSelect_${++currentId}`;
|
||||||
const ilHint = toString(this.context, hint);
|
const ilHint = parseI18NString(this.context, hint);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Portal
|
<Portal
|
||||||
|
@ -17,38 +17,58 @@
|
|||||||
import React, { PropTypes } from 'react';
|
import React, { PropTypes } from 'react';
|
||||||
import { Dropdown as SemanticDropdown } from 'semantic-ui-react';
|
import { Dropdown as SemanticDropdown } from 'semantic-ui-react';
|
||||||
|
|
||||||
import LabelComponent from '../labelComponent';
|
import { parseI18NString } from '@parity/shared/util/messages';
|
||||||
|
|
||||||
|
import LabelComponent from '../LabelComponent';
|
||||||
|
|
||||||
import styles from './dropdown.css';
|
import styles from './dropdown.css';
|
||||||
|
|
||||||
|
const NAME_ID = ' ';
|
||||||
|
|
||||||
// FIXME: Currently does not display the selected icon alongside
|
// FIXME: Currently does not display the selected icon alongside
|
||||||
export default function Dropdown ({ className, disabled = false, fullWidth = true, hint, label, onChange, options, value }) {
|
export default function Dropdown ({ className, disabled = false, error, fullWidth = true, hint, label, onBlur, onChange, onKeyDown, options, text, value }, context) {
|
||||||
return (
|
return (
|
||||||
<LabelComponent label={ label }>
|
<LabelComponent label={ label }>
|
||||||
<SemanticDropdown
|
<SemanticDropdown
|
||||||
className={ `${styles.dropdown} ${className}` }
|
className={ `${styles.dropdown} ${className}` }
|
||||||
disabled={ disabled }
|
disabled={ disabled }
|
||||||
|
error={ !!error }
|
||||||
fluid={ fullWidth }
|
fluid={ fullWidth }
|
||||||
|
id={ NAME_ID }
|
||||||
|
name={ NAME_ID }
|
||||||
|
onBlur={ onBlur }
|
||||||
onChange={ onChange }
|
onChange={ onChange }
|
||||||
|
onKeyDown={ onKeyDown }
|
||||||
options={ options }
|
options={ options }
|
||||||
placeholder={ hint }
|
placeholder={ parseI18NString(context, hint) }
|
||||||
scrolling
|
scrolling
|
||||||
search
|
search
|
||||||
selection
|
selection
|
||||||
|
text={ parseI18NString(context, text) }
|
||||||
value={ value }
|
value={ value }
|
||||||
/>
|
/>
|
||||||
</LabelComponent>
|
</LabelComponent>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Dropdown.contextTypes = {
|
||||||
|
intl: PropTypes.object.isRequired
|
||||||
|
};
|
||||||
|
|
||||||
Dropdown.propTypes = {
|
Dropdown.propTypes = {
|
||||||
|
children: PropTypes.node,
|
||||||
className: PropTypes.string,
|
className: PropTypes.string,
|
||||||
disabled: PropTypes.bool, // A disabled dropdown menu or item does not allow user interaction.
|
disabled: PropTypes.bool, // A disabled dropdown menu or item does not allow user interaction.
|
||||||
|
error: PropTypes.any,
|
||||||
fullWidth: PropTypes.bool, // A dropdown can take the full width of its parent.
|
fullWidth: PropTypes.bool, // A dropdown can take the full width of its parent.
|
||||||
hint: PropTypes.string, // Placeholder text.
|
hint: PropTypes.node, // Placeholder text.
|
||||||
label: PropTypes.node,
|
label: PropTypes.node,
|
||||||
name: PropTypes.func, // Name of the hidden input which holds the value.
|
name: PropTypes.func, // Name of the hidden input which holds the value.
|
||||||
onChange: PropTypes.func, // Called when the user attempts to change the value.
|
onChange: PropTypes.func, // Called when the user attempts to change the value.
|
||||||
|
onBlur: PropTypes.func,
|
||||||
|
onKeyDown: PropTypes.func,
|
||||||
options: PropTypes.any, // Array of Dropdown.Item props e.g. `{ text: '', value: '' }`
|
options: PropTypes.any, // Array of Dropdown.Item props e.g. `{ text: '', value: '' }`
|
||||||
value: PropTypes.any // Current value. Creates a controlled component.
|
text: PropTypes.any,
|
||||||
|
value: PropTypes.any, // Current value. Creates a controlled component.
|
||||||
|
values: PropTypes.array
|
||||||
};
|
};
|
||||||
|
@ -20,7 +20,7 @@ import { noop } from 'lodash';
|
|||||||
import keycode from 'keycode';
|
import keycode from 'keycode';
|
||||||
|
|
||||||
import { nodeOrStringProptype } from '@parity/shared/util/proptypes';
|
import { nodeOrStringProptype } from '@parity/shared/util/proptypes';
|
||||||
import { toString } from '@parity/shared/util/messages';
|
import { parseI18NString } from '@parity/shared/util/messages';
|
||||||
|
|
||||||
import CopyToClipboard from '~/ui/CopyToClipboard';
|
import CopyToClipboard from '~/ui/CopyToClipboard';
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ export default class Input extends Component {
|
|||||||
? UNDERLINE_FOCUSED
|
? UNDERLINE_FOCUSED
|
||||||
: readOnly && typeof focused !== 'boolean' ? { display: 'none' } : null;
|
: readOnly && typeof focused !== 'boolean' ? { display: 'none' } : null;
|
||||||
|
|
||||||
const textValue = toString(this.context, value);
|
const textValue = parseI18NString(this.context, value);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={ styles.container } style={ style }>
|
<div className={ styles.container } style={ style }>
|
||||||
|
@ -1,101 +0,0 @@
|
|||||||
// 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 React, { Component, PropTypes } from 'react';
|
|
||||||
import { MenuItem, SelectField } from 'material-ui';
|
|
||||||
|
|
||||||
import { nodeOrStringProptype } from '@parity/shared/util/proptypes';
|
|
||||||
|
|
||||||
// TODO: duplicated in Input
|
|
||||||
const UNDERLINE_DISABLED = {
|
|
||||||
borderColor: 'rgba(255, 255, 255, 0.298039)' // 'transparent' // 'rgba(255, 255, 255, 0.298039)'
|
|
||||||
};
|
|
||||||
|
|
||||||
const UNDERLINE_NORMAL = {
|
|
||||||
borderBottom: 'solid 2px'
|
|
||||||
};
|
|
||||||
|
|
||||||
const NAME_ID = ' ';
|
|
||||||
|
|
||||||
export default class Select extends Component {
|
|
||||||
static propTypes = {
|
|
||||||
children: PropTypes.node,
|
|
||||||
className: PropTypes.string,
|
|
||||||
disabled: PropTypes.bool,
|
|
||||||
error: nodeOrStringProptype(),
|
|
||||||
hint: nodeOrStringProptype(),
|
|
||||||
label: nodeOrStringProptype(),
|
|
||||||
onBlur: PropTypes.func,
|
|
||||||
onChange: PropTypes.func,
|
|
||||||
onKeyDown: PropTypes.func,
|
|
||||||
type: PropTypes.string,
|
|
||||||
value: PropTypes.any,
|
|
||||||
values: PropTypes.array
|
|
||||||
}
|
|
||||||
|
|
||||||
render () {
|
|
||||||
const { className, disabled, error, hint, label, onBlur, onChange, onKeyDown, value } = this.props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<SelectField
|
|
||||||
autoComplete='off'
|
|
||||||
className={ className }
|
|
||||||
disabled={ disabled }
|
|
||||||
errorText={ error }
|
|
||||||
floatingLabelFixed
|
|
||||||
floatingLabelText={ label }
|
|
||||||
fullWidth
|
|
||||||
hintText={ hint }
|
|
||||||
id={ NAME_ID }
|
|
||||||
name={ NAME_ID }
|
|
||||||
onBlur={ onBlur }
|
|
||||||
onChange={ onChange }
|
|
||||||
onKeyDown={ onKeyDown }
|
|
||||||
underlineDisabledStyle={ UNDERLINE_DISABLED }
|
|
||||||
underlineStyle={ UNDERLINE_NORMAL }
|
|
||||||
value={ value }
|
|
||||||
>
|
|
||||||
{ this.renderChildren() }
|
|
||||||
</SelectField>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
renderChildren () {
|
|
||||||
const { children, values } = this.props;
|
|
||||||
|
|
||||||
if (children) {
|
|
||||||
return children;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!values) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return values.map((data, index) => {
|
|
||||||
const { name = index, value = index } = data;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<MenuItem
|
|
||||||
key={ index }
|
|
||||||
label={ name }
|
|
||||||
value={ value }
|
|
||||||
>
|
|
||||||
{ name }
|
|
||||||
</MenuItem>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -14,4 +14,4 @@
|
|||||||
// 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/>.
|
||||||
|
|
||||||
export default from './select';
|
export default from './toggle';
|
42
js/src/ui/Form/Toggle/toggle.js
Normal file
42
js/src/ui/Form/Toggle/toggle.js
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
// 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 React, { PropTypes } from 'react';
|
||||||
|
import { Radio as SemanticRadio } from 'semantic-ui-react';
|
||||||
|
|
||||||
|
import LabelComponent from '../LabelComponent';
|
||||||
|
|
||||||
|
export default function Toggle ({ className, label, onToggle, style, toggled }) {
|
||||||
|
return (
|
||||||
|
<LabelComponent label={ label }>
|
||||||
|
<SemanticRadio
|
||||||
|
checked={ toggled }
|
||||||
|
className={ className }
|
||||||
|
onChange={ onToggle }
|
||||||
|
style={ style }
|
||||||
|
toggle
|
||||||
|
/>
|
||||||
|
</LabelComponent>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Toggle.propTypes = {
|
||||||
|
className: PropTypes.string,
|
||||||
|
label: PropTypes.node,
|
||||||
|
onToggle: PropTypes.func,
|
||||||
|
style: PropTypes.object,
|
||||||
|
toggled: PropTypes.bool
|
||||||
|
};
|
@ -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 React, { Component, PropTypes } from 'react';
|
import React, { Component, PropTypes } from 'react';
|
||||||
import { MenuItem, Toggle } from 'material-ui';
|
|
||||||
import { range } from 'lodash';
|
import { range } from 'lodash';
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
|
|
||||||
@ -26,9 +25,10 @@ import { bytesToHex } from '@parity/api/util/format';
|
|||||||
import { ABI_TYPES, parseAbiType } from '@parity/shared/util/abi';
|
import { ABI_TYPES, parseAbiType } from '@parity/shared/util/abi';
|
||||||
import { nodeOrStringProptype } from '@parity/shared/util/proptypes';
|
import { nodeOrStringProptype } from '@parity/shared/util/proptypes';
|
||||||
|
|
||||||
|
import Dropdown from '~/ui/Form/Dropdown';
|
||||||
import Input from '~/ui/Form/Input';
|
import Input from '~/ui/Form/Input';
|
||||||
import InputAddressSelect from '~/ui/Form/InputAddressSelect';
|
import InputAddressSelect from '~/ui/Form/InputAddressSelect';
|
||||||
import Select from '~/ui/Form/Select';
|
import Toggle from '~/ui/Form/Toggle';
|
||||||
import { AddIcon, RemoveIcon } from '~/ui/Icons';
|
import { AddIcon, RemoveIcon } from '~/ui/Icons';
|
||||||
|
|
||||||
import styles from './typedInput.css';
|
import styles from './typedInput.css';
|
||||||
@ -366,20 +366,8 @@ export default class TypedInput extends Component {
|
|||||||
return this.renderDefault();
|
return this.renderDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
const boolitems = ['false', 'true'].map((bool) => {
|
|
||||||
return (
|
|
||||||
<MenuItem
|
|
||||||
key={ bool }
|
|
||||||
label={ bool }
|
|
||||||
value={ bool }
|
|
||||||
>
|
|
||||||
{ bool }
|
|
||||||
</MenuItem>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Select
|
<Dropdown
|
||||||
allowCopy={ allowCopy }
|
allowCopy={ allowCopy }
|
||||||
className={ className }
|
className={ className }
|
||||||
error={ error }
|
error={ error }
|
||||||
@ -391,15 +379,22 @@ export default class TypedInput extends Component {
|
|||||||
? 'true'
|
? 'true'
|
||||||
: 'false'
|
: 'false'
|
||||||
}
|
}
|
||||||
>
|
options={
|
||||||
{ boolitems }
|
['false', 'true'].map((bool) => {
|
||||||
</Select>
|
return {
|
||||||
|
key: bool,
|
||||||
|
text: bool,
|
||||||
|
value: bool
|
||||||
|
};
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
onChangeBool = (event, _index, value) => {
|
onChangeBool = (event) => {
|
||||||
// NOTE: event.target.value added for enzyme simulated event testing
|
console.log('onChangeBool', event.target);
|
||||||
this.props.onChange((value || event.target.value) === 'true');
|
this.props.onChange(event.target.value === 'true');
|
||||||
}
|
}
|
||||||
|
|
||||||
onEthTypeChange = () => {
|
onEthTypeChange = () => {
|
||||||
|
@ -23,7 +23,6 @@ import { ABI_TYPES } from '@parity/shared/util/abi';
|
|||||||
import TypedInput from './';
|
import TypedInput from './';
|
||||||
|
|
||||||
let component;
|
let component;
|
||||||
let select;
|
|
||||||
let onChange;
|
let onChange;
|
||||||
|
|
||||||
function render (props) {
|
function render (props) {
|
||||||
@ -34,7 +33,6 @@ function render (props) {
|
|||||||
onChange={ onChange }
|
onChange={ onChange }
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
select = component.find('Select');
|
|
||||||
|
|
||||||
return component;
|
return component;
|
||||||
}
|
}
|
||||||
@ -48,23 +46,5 @@ describe('ui/Form/TypedInput', () => {
|
|||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(component).to.be.ok;
|
expect(component).to.be.ok;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('calls onChange when value changes', () => {
|
|
||||||
select.shallow().simulate('change', { target: { value: 'true' } });
|
|
||||||
|
|
||||||
expect(onChange).to.have.been.called;
|
|
||||||
});
|
|
||||||
|
|
||||||
it("calls onChange(true) when value changes to 'true'", () => {
|
|
||||||
select.shallow().simulate('change', { target: { value: 'true' } });
|
|
||||||
|
|
||||||
expect(onChange).to.have.been.calledWith(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("calls onChange(false) when value changes to 'false'", () => {
|
|
||||||
select.shallow().simulate('change', { target: { value: 'false' } });
|
|
||||||
|
|
||||||
expect(onChange).to.have.been.calledWith(false);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -29,7 +29,7 @@ export InputInline from './InputInline';
|
|||||||
export InputTime from './InputTime';
|
export InputTime from './InputTime';
|
||||||
export Label from './Label';
|
export Label from './Label';
|
||||||
export RadioButtons from './RadioButtons';
|
export RadioButtons from './RadioButtons';
|
||||||
export Select from './Select';
|
export Toggle from './Toggle';
|
||||||
export TypedInput from './TypedInput';
|
export TypedInput from './TypedInput';
|
||||||
export VaultSelect from './VaultSelect';
|
export VaultSelect from './VaultSelect';
|
||||||
|
|
||||||
|
@ -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 { MenuItem } from 'material-ui';
|
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
@ -22,7 +21,7 @@ import { FormattedMessage } from 'react-intl';
|
|||||||
import { LocaleStore } from '~/i18n';
|
import { LocaleStore } from '~/i18n';
|
||||||
import { FeaturesStore, FEATURES } from '../Features';
|
import { FeaturesStore, FEATURES } from '../Features';
|
||||||
|
|
||||||
import Select from '../Form/Select';
|
import Dropdown from '../Form/Dropdown';
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export default class LanguageSelector extends Component {
|
export default class LanguageSelector extends Component {
|
||||||
@ -35,7 +34,7 @@ export default class LanguageSelector extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Select
|
<Dropdown
|
||||||
hint={
|
hint={
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='settings.parity.languages.hint'
|
id='settings.parity.languages.hint'
|
||||||
@ -50,28 +49,20 @@ export default class LanguageSelector extends Component {
|
|||||||
}
|
}
|
||||||
value={ this.store.locale }
|
value={ this.store.locale }
|
||||||
onChange={ this.onChange }
|
onChange={ this.onChange }
|
||||||
>
|
options={
|
||||||
{ this.renderOptions() }
|
this.store.locales.map((locale) => {
|
||||||
</Select>
|
return {
|
||||||
|
key: locale,
|
||||||
|
value: locale,
|
||||||
|
text: locale,
|
||||||
|
content: <FormattedMessage id={ `languages.${locale}` } />
|
||||||
|
};
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderOptions () {
|
|
||||||
return this.store.locales.map((locale) => {
|
|
||||||
const label = <FormattedMessage id={ `languages.${locale}` } />;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<MenuItem
|
|
||||||
key={ locale }
|
|
||||||
value={ locale }
|
|
||||||
label={ label }
|
|
||||||
>
|
|
||||||
{ label }
|
|
||||||
</MenuItem>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
onChange = (event, index, locale) => {
|
onChange = (event, index, locale) => {
|
||||||
this.store.setLocale(locale || event.target.value);
|
this.store.setLocale(locale || event.target.value);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ describe('LanguageSelector', () => {
|
|||||||
sinon.stub(localeStore, 'setLocale');
|
sinon.stub(localeStore, 'setLocale');
|
||||||
|
|
||||||
render();
|
render();
|
||||||
select = component.find('Select');
|
select = component.find('Dropdown');
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@ -58,7 +58,7 @@ describe('LanguageSelector', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('has locale items', () => {
|
it('has locale items', () => {
|
||||||
expect(select.find('MenuItem').length > 0).to.be.true;
|
expect(select.props().options.length > 0).to.be.true;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('calls localeStore.setLocale when changed', () => {
|
it('calls localeStore.setLocale when changed', () => {
|
||||||
|
@ -33,7 +33,7 @@ export DappIcon from './DappIcon';
|
|||||||
export DappLink from './DappLink';
|
export DappLink from './DappLink';
|
||||||
export Errors from './Errors';
|
export Errors from './Errors';
|
||||||
export Features, { FEATURES, FeaturesStore } from './Features';
|
export Features, { FEATURES, FeaturesStore } from './Features';
|
||||||
export Form, { AddressSelect, Checkbox, DappUrlInput, Dropdown, FileSelect, FormWrap, Input, InputAddress, InputAddressSelect, InputChip, InputDate, InputInline, InputTime, Label, RadioButtons, Select, TypedInput, VaultSelect } from './Form';
|
export Form, { AddressSelect, Checkbox, DappUrlInput, Dropdown, FileSelect, FormWrap, Input, InputAddress, InputAddressSelect, InputChip, InputDate, InputInline, InputTime, Label, RadioButtons, Toggle, TypedInput, VaultSelect } from './Form';
|
||||||
export GasPriceEditor from './GasPriceEditor';
|
export GasPriceEditor from './GasPriceEditor';
|
||||||
export GasPriceSelector from './GasPriceSelector';
|
export GasPriceSelector from './GasPriceSelector';
|
||||||
export IconCache from './IconCache';
|
export IconCache from './IconCache';
|
||||||
|
@ -62,13 +62,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.message {
|
.message {
|
||||||
|
border: 1px solid #ddd;
|
||||||
margin-top: 1rem;
|
margin-top: 1rem;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 2.5rem;
|
height: 2.5rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 2.5rem;
|
line-height: 2.5rem;
|
||||||
transition: height 350ms 0 !important;
|
transition: height 350ms 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hideMessage {
|
.hideMessage {
|
||||||
|
@ -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 Paper from 'material-ui/Paper';
|
|
||||||
import { Menu, Segment } from 'semantic-ui-react';
|
import { Menu, Segment } from 'semantic-ui-react';
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import React, { Component, PropTypes } from 'react';
|
import React, { Component, PropTypes } from 'react';
|
||||||
@ -89,17 +88,16 @@ class PasswordManager extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Paper
|
<div
|
||||||
className={ `${styles.message}` }
|
className={ styles.message }
|
||||||
style={
|
style={
|
||||||
infoMessage.success
|
infoMessage.success
|
||||||
? MSG_SUCCESS_STYLE
|
? MSG_SUCCESS_STYLE
|
||||||
: MSG_FAILURE_STYLE
|
: MSG_FAILURE_STYLE
|
||||||
}
|
}
|
||||||
zDepth={ 1 }
|
|
||||||
>
|
>
|
||||||
{ infoMessage.value }
|
{ infoMessage.value }
|
||||||
</Paper>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,10 +17,9 @@
|
|||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
import React, { Component, PropTypes } from 'react';
|
import React, { Component, PropTypes } from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { MenuItem } from 'material-ui';
|
|
||||||
import { isEqual } from 'lodash';
|
import { isEqual } from 'lodash';
|
||||||
|
|
||||||
import { Select } from '~/ui/Form';
|
import { Dropdown } from '~/ui/Form';
|
||||||
import TokenImage from '~/ui/TokenImage';
|
import TokenImage from '~/ui/TokenImage';
|
||||||
|
|
||||||
import styles from '../transfer.css';
|
import styles from '../transfer.css';
|
||||||
@ -89,15 +88,12 @@ class TokenSelect extends Component {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return {
|
||||||
<MenuItem
|
key: tokenId,
|
||||||
key={ tokenId }
|
text: label,
|
||||||
value={ token.id }
|
value: token.id,
|
||||||
label={ label }
|
content: label
|
||||||
>
|
};
|
||||||
{ label }
|
|
||||||
</MenuItem>
|
|
||||||
);
|
|
||||||
})
|
})
|
||||||
.filter((node) => node);
|
.filter((node) => node);
|
||||||
|
|
||||||
@ -109,15 +105,14 @@ class TokenSelect extends Component {
|
|||||||
const { items } = this.state;
|
const { items } = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Select
|
<Dropdown
|
||||||
className={ styles.tokenSelect }
|
className={ styles.tokenSelect }
|
||||||
label='type of token transfer'
|
label='type of token transfer'
|
||||||
hint='type of token to transfer'
|
hint='type of token to transfer'
|
||||||
value={ value }
|
value={ value }
|
||||||
onChange={ onChange }
|
onChange={ onChange }
|
||||||
>
|
options={ items }
|
||||||
{ items }
|
/>
|
||||||
</Select>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,11 +14,10 @@
|
|||||||
// 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 { MenuItem } 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 { AddressSelect, Checkbox, Form, Input, Select, TypedInput } from '~/ui';
|
import { AddressSelect, Checkbox, Dropdown, Form, Input, TypedInput } from '~/ui';
|
||||||
|
|
||||||
import styles from '../executeContract.css';
|
import styles from '../executeContract.css';
|
||||||
|
|
||||||
@ -123,16 +122,15 @@ export default class DetailsStep extends Component {
|
|||||||
.filter((func) => !func.constant)
|
.filter((func) => !func.constant)
|
||||||
.sort((a, b) => (a.name || '').localeCompare(b.name || ''))
|
.sort((a, b) => (a.name || '').localeCompare(b.name || ''))
|
||||||
.map((func) => {
|
.map((func) => {
|
||||||
const params = (func.abi.inputs || [])
|
const params = (func.abi.inputs || []).map((input, index) => {
|
||||||
.map((input, index) => {
|
return (
|
||||||
return (
|
<span key={ input.name }>
|
||||||
<span key={ input.name }>
|
<span>{ index ? ', ' : '' }</span>
|
||||||
<span>{ index ? ', ' : '' }</span>
|
<span className={ styles.paramname }>{ input.name }: </span>
|
||||||
<span className={ styles.paramname }>{ input.name }: </span>
|
<span>{ input.type }</span>
|
||||||
<span>{ input.type }</span>
|
</span>
|
||||||
</span>
|
);
|
||||||
);
|
});
|
||||||
});
|
|
||||||
const name = (
|
const name = (
|
||||||
<div>
|
<div>
|
||||||
<span>{ func.name }</span>
|
<span>{ func.name }</span>
|
||||||
@ -142,19 +140,16 @@ export default class DetailsStep extends Component {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return {
|
||||||
<MenuItem
|
key: func.signature,
|
||||||
key={ func.signature }
|
text: func.name || '()',
|
||||||
value={ func.signature }
|
value: func.signature,
|
||||||
label={ func.name || '()' }
|
content: name
|
||||||
>
|
};
|
||||||
{ name }
|
|
||||||
</MenuItem>
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Select
|
<Dropdown
|
||||||
error={ funcError }
|
error={ funcError }
|
||||||
hint={
|
hint={
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
@ -170,9 +165,8 @@ export default class DetailsStep extends Component {
|
|||||||
}
|
}
|
||||||
onChange={ this.onFuncChange }
|
onChange={ this.onFuncChange }
|
||||||
value={ func.signature }
|
value={ func.signature }
|
||||||
>
|
options={ functions }
|
||||||
{ functions }
|
/>
|
||||||
</Select>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
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 { 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';
|
||||||
|
|
||||||
@ -25,7 +24,7 @@ import { newError } from '@parity/shared/redux/actions';
|
|||||||
import { arrayOrObjectProptype } from '@parity/shared/util/proptypes';
|
import { arrayOrObjectProptype } from '@parity/shared/util/proptypes';
|
||||||
import { parseAbiType } from '@parity/shared/util/abi';
|
import { parseAbiType } from '@parity/shared/util/abi';
|
||||||
|
|
||||||
import { Button, Progress, TypedInput } from '~/ui';
|
import { Button, Container, Progress, TypedInput } from '~/ui';
|
||||||
|
|
||||||
import styles from './queries.css';
|
import styles from './queries.css';
|
||||||
|
|
||||||
@ -79,13 +78,10 @@ class InputQuery extends Component {
|
|||||||
const { name, className } = this.props;
|
const { name, className } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className={ className }>
|
<Container className={ className }>
|
||||||
<CardTitle
|
<h3>{ name }</h3>
|
||||||
className={ styles.methodTitle }
|
|
||||||
title={ name }
|
|
||||||
/>
|
|
||||||
{ this.renderContent() }
|
{ this.renderContent() }
|
||||||
</Card>
|
</Container>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,13 +94,13 @@ class InputQuery extends Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<CardText className={ styles.methodContent }>
|
<div className={ styles.methodContent }>
|
||||||
<div className={ styles.methodResults }>
|
<div className={ styles.methodResults }>
|
||||||
{ this.renderResults() }
|
{ this.renderResults() }
|
||||||
</div>
|
</div>
|
||||||
{ inputsFields }
|
{ inputsFields }
|
||||||
</CardText>
|
</div>
|
||||||
<CardActions>
|
<div className={ styles.methodActions }>
|
||||||
<Button
|
<Button
|
||||||
label={
|
label={
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
@ -115,7 +111,7 @@ class InputQuery extends Component {
|
|||||||
disabled={ !isValid }
|
disabled={ !isValid }
|
||||||
onClick={ this.onClick }
|
onClick={ this.onClick }
|
||||||
/>
|
/>
|
||||||
</CardActions>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,10 @@
|
|||||||
padding-bottom: 8px !important;
|
padding-bottom: 8px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.methodActions {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
.methodResults {
|
.methodResults {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
import React, { Component, PropTypes } from 'react';
|
import React, { Component, PropTypes } from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import { Card, CardTitle, CardText } from 'material-ui/Card';
|
|
||||||
|
|
||||||
import InputQuery from './inputQuery';
|
import InputQuery from './inputQuery';
|
||||||
import { Container, TypedInput } from '~/ui';
|
import { Container, TypedInput } from '~/ui';
|
||||||
@ -120,21 +119,18 @@ export default class Queries extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={ styles.container } key={ fn.signature }>
|
<div
|
||||||
<Card className={ styles.method }>
|
className={ styles.container }
|
||||||
<CardTitle
|
key={ fn.signature }
|
||||||
className={ styles.methodTitle }
|
>
|
||||||
title={ fn.name }
|
<Container className={ styles.method }>
|
||||||
/>
|
<h3>{ fn.name }</h3>
|
||||||
<CardText
|
<div className={ styles.methodContent }>
|
||||||
className={ styles.methodContent }
|
|
||||||
>
|
|
||||||
{
|
{
|
||||||
abi.outputs
|
abi.outputs.map((output, index) => this.renderValue(values[index], output, index))
|
||||||
.map((output, index) => this.renderValue(values[index], output, index))
|
|
||||||
}
|
}
|
||||||
</CardText>
|
</div>
|
||||||
</Card>
|
</Container>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -17,12 +17,11 @@
|
|||||||
import React, { PropTypes, Component } from 'react';
|
import React, { PropTypes, Component } from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import { MenuItem, Toggle } from 'material-ui';
|
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { throttle } from 'lodash';
|
import { throttle } from 'lodash';
|
||||||
|
|
||||||
import { Actionbar, ActionbarExport, ActionbarImport, Button, Input, Loading, Page, Select } from '~/ui';
|
import { Actionbar, ActionbarExport, ActionbarImport, Button, Dropdown, Input, Loading, Page, Toggle } from '~/ui';
|
||||||
import { CancelIcon, ListIcon, SaveIcon, SendIcon, SettingsIcon } from '~/ui/Icons';
|
import { CancelIcon, ListIcon, SaveIcon, SendIcon, SettingsIcon } from '~/ui/Icons';
|
||||||
import Editor from '~/ui/Editor';
|
import Editor from '~/ui/Editor';
|
||||||
|
|
||||||
@ -405,27 +404,9 @@ class ContractDevelop extends Component {
|
|||||||
renderSolidityVersions () {
|
renderSolidityVersions () {
|
||||||
const { builds, selectedBuild } = this.store;
|
const { builds, selectedBuild } = this.store;
|
||||||
|
|
||||||
const buildsList = builds.map((build, index) => (
|
|
||||||
<MenuItem
|
|
||||||
key={ index }
|
|
||||||
value={ index }
|
|
||||||
label={ build.release ? build.version : build.longVersion }
|
|
||||||
>
|
|
||||||
{
|
|
||||||
build.release
|
|
||||||
? (
|
|
||||||
<span className={ styles.big }>
|
|
||||||
{ build.version }
|
|
||||||
</span>
|
|
||||||
)
|
|
||||||
: build.longVersion
|
|
||||||
}
|
|
||||||
</MenuItem>
|
|
||||||
));
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Select
|
<Dropdown
|
||||||
label={
|
label={
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='writeContract.title.selectSolidity'
|
id='writeContract.title.selectSolidity'
|
||||||
@ -434,9 +415,24 @@ class ContractDevelop extends Component {
|
|||||||
}
|
}
|
||||||
value={ selectedBuild }
|
value={ selectedBuild }
|
||||||
onChange={ this.store.handleSelectBuild }
|
onChange={ this.store.handleSelectBuild }
|
||||||
>
|
options={
|
||||||
{ buildsList }
|
builds.map((build, index) => {
|
||||||
</Select>
|
return {
|
||||||
|
key: index,
|
||||||
|
text: build.release ? build.version : build.longVersion,
|
||||||
|
value: index,
|
||||||
|
content:
|
||||||
|
build.release
|
||||||
|
? (
|
||||||
|
<span className={ styles.big }>
|
||||||
|
{ build.version }
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
: build.longVersion
|
||||||
|
};
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -546,19 +542,9 @@ class ContractDevelop extends Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const contractsList = contractKeys.map((name, index) => (
|
|
||||||
<MenuItem
|
|
||||||
key={ index }
|
|
||||||
value={ index }
|
|
||||||
label={ name }
|
|
||||||
>
|
|
||||||
{ name }
|
|
||||||
</MenuItem>
|
|
||||||
));
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={ styles.compilation }>
|
<div className={ styles.compilation }>
|
||||||
<Select
|
<Dropdown
|
||||||
label={
|
label={
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='writeContract.title.contract'
|
id='writeContract.title.contract'
|
||||||
@ -567,9 +553,16 @@ class ContractDevelop extends Component {
|
|||||||
}
|
}
|
||||||
value={ contractIndex }
|
value={ contractIndex }
|
||||||
onChange={ this.store.handleSelectContract }
|
onChange={ this.store.handleSelectContract }
|
||||||
>
|
options={
|
||||||
{ contractsList }
|
contractKeys.map((name, index) => {
|
||||||
</Select>
|
return {
|
||||||
|
key: index,
|
||||||
|
value: index,
|
||||||
|
text: name
|
||||||
|
};
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
{ this.renderContract(contract) }
|
{ this.renderContract(contract) }
|
||||||
<h4 className={ styles.messagesHeader }>
|
<h4 className={ styles.messagesHeader }>
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
|
@ -16,12 +16,11 @@
|
|||||||
|
|
||||||
import React, { Component, PropTypes } from 'react';
|
import React, { Component, PropTypes } from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import { MenuItem } from 'material-ui';
|
|
||||||
|
|
||||||
import { parseAbiType } from '@parity/shared/util/abi';
|
import { parseAbiType } from '@parity/shared/util/abi';
|
||||||
import { validateAbi } from '@parity/shared/util/validation';
|
import { validateAbi } from '@parity/shared/util/validation';
|
||||||
|
|
||||||
import { AddressSelect, Checkbox, Form, Input, Select } from '~/ui';
|
import { AddressSelect, Checkbox, Dropdown, Form, Input } from '~/ui';
|
||||||
|
|
||||||
const CHECK_STYLE = {
|
const CHECK_STYLE = {
|
||||||
marginTop: '1em'
|
marginTop: '1em'
|
||||||
@ -269,20 +268,9 @@ export default class DetailsStep extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { selectedContractIndex } = this.state;
|
const { selectedContractIndex } = this.state;
|
||||||
const contractsItems = Object
|
|
||||||
.keys(contracts)
|
|
||||||
.map((name, index) => (
|
|
||||||
<MenuItem
|
|
||||||
key={ index }
|
|
||||||
label={ name }
|
|
||||||
value={ index }
|
|
||||||
>
|
|
||||||
{ name }
|
|
||||||
</MenuItem>
|
|
||||||
));
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Select
|
<Dropdown
|
||||||
label={
|
label={
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='deployContract.details.contract.label'
|
id='deployContract.details.contract.label'
|
||||||
@ -291,9 +279,18 @@ export default class DetailsStep extends Component {
|
|||||||
}
|
}
|
||||||
onChange={ this.onContractChange }
|
onChange={ this.onContractChange }
|
||||||
value={ selectedContractIndex }
|
value={ selectedContractIndex }
|
||||||
>
|
options={
|
||||||
{ contractsItems }
|
Object
|
||||||
</Select>
|
.keys(contracts)
|
||||||
|
.map((name, index) => {
|
||||||
|
return {
|
||||||
|
key: index,
|
||||||
|
text: name,
|
||||||
|
value: index
|
||||||
|
};
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,12 +14,12 @@
|
|||||||
// 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 { Dropdown, Menu } from 'semantic-ui-react';
|
import { Menu } from 'semantic-ui-react';
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import React, { Component, PropTypes } from 'react';
|
import React, { Component, PropTypes } from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
import { Select, Container, LanguageSelector } from '~/ui';
|
import { Container, Dropdown, LanguageSelector } from '~/ui';
|
||||||
import Features, { FeaturesStore, FEATURES } from '~/ui/Features';
|
import Features, { FeaturesStore, FEATURES } from '~/ui/Features';
|
||||||
|
|
||||||
import Store, { LOGLEVEL_OPTIONS } from './store';
|
import Store, { LOGLEVEL_OPTIONS } from './store';
|
||||||
@ -68,16 +68,12 @@ export default class Node extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderItem (name, func, label) {
|
renderItem (name, func, label) {
|
||||||
return (
|
return {
|
||||||
<Dropdown.Item
|
key: name,
|
||||||
key={ name }
|
text: name,
|
||||||
content={ label }
|
value: name,
|
||||||
name={ name }
|
content: label
|
||||||
onClick={ func }
|
};
|
||||||
>
|
|
||||||
{ label }
|
|
||||||
</Dropdown.Item>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
renderLogsConfig () {
|
renderLogsConfig () {
|
||||||
@ -118,7 +114,7 @@ export default class Node extends Component {
|
|||||||
return (
|
return (
|
||||||
<div key={ key }>
|
<div key={ key }>
|
||||||
<p>{ desc }</p>
|
<p>{ desc }</p>
|
||||||
<Select
|
<Dropdown
|
||||||
onChange={ onChange }
|
onChange={ onChange }
|
||||||
value={ level }
|
value={ level }
|
||||||
values={ LOGLEVEL_OPTIONS }
|
values={ LOGLEVEL_OPTIONS }
|
||||||
@ -145,42 +141,33 @@ export default class Node extends Component {
|
|||||||
<Dropdown
|
<Dropdown
|
||||||
item
|
item
|
||||||
text={ mode }
|
text={ mode }
|
||||||
>
|
options={ [
|
||||||
<Dropdown.Menu>
|
this.renderItem('active', this.onChangeMode, (
|
||||||
{
|
<FormattedMessage
|
||||||
this.renderItem('active', this.onChangeMode, (
|
id='settings.parity.modes.mode_active'
|
||||||
<FormattedMessage
|
defaultMessage='Continuously sync'
|
||||||
id='settings.parity.modes.mode_active'
|
/>
|
||||||
defaultMessage='Continuously sync'
|
)),
|
||||||
/>
|
this.renderItem('passive', this.onChangeMode, (
|
||||||
))
|
<FormattedMessage
|
||||||
}
|
id='settings.parity.modes.mode_passive'
|
||||||
{
|
defaultMessage='Sync on intervals'
|
||||||
this.renderItem('passive', this.onChangeMode, (
|
/>
|
||||||
<FormattedMessage
|
)),
|
||||||
id='settings.parity.modes.mode_passive'
|
this.renderItem('dark', this.onChangeMode, (
|
||||||
defaultMessage='Sync on intervals'
|
<FormattedMessage
|
||||||
/>
|
id='settings.parity.modes.mode_dark'
|
||||||
))
|
defaultMessage='Sync when RPC is active'
|
||||||
}
|
/>
|
||||||
{
|
)),
|
||||||
this.renderItem('dark', this.onChangeMode, (
|
this.renderItem('offline', this.onChangeMode, (
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='settings.parity.modes.mode_dark'
|
id='settings.parity.modes.mode_offline'
|
||||||
defaultMessage='Sync when RPC is active'
|
defaultMessage='No Syncing'
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
}
|
] }
|
||||||
{
|
/>
|
||||||
this.renderItem('offline', this.onChangeMode, (
|
|
||||||
<FormattedMessage
|
|
||||||
id='settings.parity.modes.mode_offline'
|
|
||||||
defaultMessage='No Syncing'
|
|
||||||
/>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</Dropdown.Menu>
|
|
||||||
</Dropdown>
|
|
||||||
</Menu>
|
</Menu>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@ -200,74 +187,59 @@ export default class Node extends Component {
|
|||||||
id='parityChainSelect'
|
id='parityChainSelect'
|
||||||
value={ chain }
|
value={ chain }
|
||||||
>
|
>
|
||||||
<Dropdown item text={ chain }>
|
<Dropdown
|
||||||
<Dropdown.Menu>
|
text={ chain }
|
||||||
{
|
options={ [
|
||||||
this.renderItem('foundation', this.onChangeChain, (
|
this.renderItem('foundation', this.onChangeChain, (
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='settings.parity.chains.chain_foundation'
|
id='settings.parity.chains.chain_foundation'
|
||||||
defaultMessage='Ethereum Foundation'
|
defaultMessage='Ethereum Foundation'
|
||||||
/>
|
/>
|
||||||
))
|
)),
|
||||||
}
|
this.renderItem('kovan', this.onChangeChain, (
|
||||||
{
|
<FormattedMessage
|
||||||
this.renderItem('kovan', this.onChangeChain, (
|
id='settings.parity.chains.chain_kovan'
|
||||||
<FormattedMessage
|
defaultMessage='Kovan test network'
|
||||||
id='settings.parity.chains.chain_kovan'
|
/>
|
||||||
defaultMessage='Kovan test network'
|
)),
|
||||||
/>
|
this.renderItem('olympic', this.onChangeChain, (
|
||||||
))
|
<FormattedMessage
|
||||||
}
|
id='settings.parity.chains.chain_olympic'
|
||||||
{
|
defaultMessage='Olympic test network'
|
||||||
this.renderItem('olympic', this.onChangeChain, (
|
/>
|
||||||
<FormattedMessage
|
)),
|
||||||
id='settings.parity.chains.chain_olympic'
|
this.renderItem('morden', this.onChangeChain, (
|
||||||
defaultMessage='Olympic test network'
|
<FormattedMessage
|
||||||
/>
|
id='settings.parity.chains.cmorden_kovan'
|
||||||
))
|
defaultMessage='Morden (Classic) test network'
|
||||||
}
|
/>
|
||||||
{
|
)),
|
||||||
this.renderItem('morden', this.onChangeChain, (
|
this.renderItem('ropsten', this.onChangeChain, (
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='settings.parity.chains.cmorden_kovan'
|
id='settings.parity.chains.chain_ropsten'
|
||||||
defaultMessage='Morden (Classic) test network'
|
defaultMessage='Ropsten test network'
|
||||||
/>
|
/>
|
||||||
))
|
)),
|
||||||
}
|
this.renderItem('classic', this.onChangeChain, (
|
||||||
{
|
<FormattedMessage
|
||||||
this.renderItem('ropsten', this.onChangeChain, (
|
id='settings.parity.chains.chain_classic'
|
||||||
<FormattedMessage
|
defaultMessage='Ethereum Classic network'
|
||||||
id='settings.parity.chains.chain_ropsten'
|
/>
|
||||||
defaultMessage='Ropsten test network'
|
)),
|
||||||
/>
|
this.renderItem('expanse', this.onChangeChain, (
|
||||||
))
|
<FormattedMessage
|
||||||
}
|
id='settings.parity.chains.chain_expanse'
|
||||||
{
|
defaultMessage='Expanse network'
|
||||||
this.renderItem('classic', this.onChangeChain, (
|
/>
|
||||||
<FormattedMessage
|
)),
|
||||||
id='settings.parity.chains.chain_classic'
|
this.renderItem('dev', this.onChangeChain, (
|
||||||
defaultMessage='Ethereum Classic network'
|
<FormattedMessage
|
||||||
/>
|
id='settings.parity.chains.chain_dev'
|
||||||
))
|
defaultMessage='Local development chain'
|
||||||
}
|
/>
|
||||||
{
|
))
|
||||||
this.renderItem('expanse', this.onChangeChain, (
|
] }
|
||||||
<FormattedMessage
|
/>
|
||||||
id='settings.parity.chains.chain_expanse'
|
|
||||||
defaultMessage='Expanse network'
|
|
||||||
/>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
{
|
|
||||||
this.renderItem('dev', this.onChangeChain, (
|
|
||||||
<FormattedMessage
|
|
||||||
id='settings.parity.chains.chain_dev'
|
|
||||||
defaultMessage='Local development chain'
|
|
||||||
/>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</Dropdown.Menu>
|
|
||||||
</Dropdown>
|
|
||||||
</Menu>
|
</Menu>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -147,6 +147,8 @@ module.exports = {
|
|||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'~': path.resolve(__dirname, '../src'),
|
'~': path.resolve(__dirname, '../src'),
|
||||||
|
'@parity/wordlist': path.resolve(__dirname, '../node_modules/@parity/wordlist'),
|
||||||
|
'@parity': path.resolve(__dirname, '../src'),
|
||||||
'secp256k1': path.resolve(__dirname, '../node_modules/secp256k1/js'),
|
'secp256k1': path.resolve(__dirname, '../node_modules/secp256k1/js'),
|
||||||
'keythereum': path.resolve(__dirname, '../node_modules/keythereum/dist/keythereum')
|
'keythereum': path.resolve(__dirname, '../node_modules/keythereum/dist/keythereum')
|
||||||
},
|
},
|
||||||
|
@ -44,6 +44,8 @@ module.exports = {
|
|||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'~': path.resolve(__dirname, '../src'),
|
'~': path.resolve(__dirname, '../src'),
|
||||||
|
'@parity/wordlist': path.resolve(__dirname, '../node_modules/@parity/wordlist'),
|
||||||
|
'@parity': path.resolve(__dirname, '../src'),
|
||||||
'secp256k1': path.resolve(__dirname, '../node_modules/secp256k1/js'),
|
'secp256k1': path.resolve(__dirname, '../node_modules/secp256k1/js'),
|
||||||
'keythereum': path.resolve(__dirname, '../node_modules/keythereum/dist/keythereum')
|
'keythereum': path.resolve(__dirname, '../node_modules/keythereum/dist/keythereum')
|
||||||
}
|
}
|
||||||
|
@ -77,6 +77,8 @@ module.exports = {
|
|||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'~': path.resolve(__dirname, '../src'),
|
'~': path.resolve(__dirname, '../src'),
|
||||||
|
'@parity/wordlist': path.resolve(__dirname, '../node_modules/@parity/wordlist'),
|
||||||
|
'@parity': path.resolve(__dirname, '../src'),
|
||||||
'secp256k1': path.resolve(__dirname, '../node_modules/secp256k1/js'),
|
'secp256k1': path.resolve(__dirname, '../node_modules/secp256k1/js'),
|
||||||
'keythereum': path.resolve(__dirname, '../node_modules/keythereum/dist/keythereum')
|
'keythereum': path.resolve(__dirname, '../node_modules/keythereum/dist/keythereum')
|
||||||
},
|
},
|
||||||
|
@ -20,7 +20,9 @@ module.exports = {
|
|||||||
context: path.join(__dirname, '../src'),
|
context: path.join(__dirname, '../src'),
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'~': path.resolve(__dirname, '../src')
|
'~': path.resolve(__dirname, '../src'),
|
||||||
|
'@parity/wordlist': path.resolve(__dirname, '../node_modules/@parity/wordlist'),
|
||||||
|
'@parity': path.resolve(__dirname, '../src')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user