lint: fix react/destructuring-assignment rule
This commit is contained in:
parent
16ad414a85
commit
fa3e734d78
|
@ -43,7 +43,6 @@
|
|||
"ignoreTrailingComments": true
|
||||
}
|
||||
],
|
||||
"consistent-return": 0,
|
||||
"react/destructuring-assignment": 0
|
||||
"consistent-return": 0
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,22 +68,25 @@ export class DropdownComponent extends Component<Props, State> {
|
|||
};
|
||||
|
||||
render() {
|
||||
const { isOpen } = this.state;
|
||||
const { label, options, renderTrigger } = this.props;
|
||||
|
||||
return (
|
||||
<PopoverWithStyle
|
||||
isOpen={this.state.isOpen}
|
||||
isOpen={isOpen}
|
||||
preferPlace='below'
|
||||
enterExitTransitionDurationMs={0}
|
||||
body={[
|
||||
<ClickOutside onClickOutside={() => this.setState(() => ({ isOpen: false }))}>
|
||||
<MenuWrapper>
|
||||
{this.props.label && (
|
||||
{label && (
|
||||
<MenuItem disabled>
|
||||
<TextComponent value={this.props.label} isBold />
|
||||
<TextComponent value={label} isBold />
|
||||
</MenuItem>
|
||||
)}
|
||||
{this.props.options.map(({ label, onClick }) => (
|
||||
{options.map(({ label: optionLabel, onClick }) => (
|
||||
<MenuItem onClick={onClick}>
|
||||
<TextComponent value={label} />
|
||||
<TextComponent value={optionLabel} />
|
||||
</MenuItem>
|
||||
))}
|
||||
</MenuWrapper>
|
||||
|
@ -91,7 +94,7 @@ export class DropdownComponent extends Component<Props, State> {
|
|||
]}
|
||||
tipSize={7}
|
||||
>
|
||||
{this.props.renderTrigger(() => this.setState(state => ({ isOpen: !state.isOpen })), this.state.isOpen)}
|
||||
{renderTrigger(() => this.setState(state => ({ isOpen: !state.isOpen })), isOpen)}
|
||||
</PopoverWithStyle>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -44,7 +44,9 @@ export const withDaemonStatusCheck = <PassedProps: {}>(
|
|||
};
|
||||
|
||||
render() {
|
||||
if (this.state.isRunning) {
|
||||
const { isRunning } = this.state;
|
||||
|
||||
if (isRunning) {
|
||||
return <WrappedComponent {...this.props} {...this.state} />;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,10 +24,12 @@ export class ConsoleView extends Component<Props, State> {
|
|||
}
|
||||
|
||||
render() {
|
||||
const { log } = this.state;
|
||||
|
||||
return (
|
||||
<div className='dashboard'>
|
||||
{this.state.log
|
||||
&& this.state.log.split('\n').map(item => (
|
||||
{log
|
||||
&& log.split('\n').map(item => (
|
||||
<Fragment key={`${item.slice(0, 10)}`}>
|
||||
{item}
|
||||
<br />
|
||||
|
|
|
@ -1,24 +1,9 @@
|
|||
// @flow
|
||||
|
||||
import React, { Fragment } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import React from 'react';
|
||||
|
||||
import { WalletSummaryComponent } from '../components/wallet-summary';
|
||||
import { withDaemonStatusCheck } from '../components/with-daemon-status-check';
|
||||
import { TextComponent } from '../components/text';
|
||||
|
||||
const Title = styled(TextComponent)`
|
||||
font-size: 1.5em;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
`;
|
||||
|
||||
const Divider = styled.div`
|
||||
width: 100%;
|
||||
background-color: ${props => props.theme.colors.text};
|
||||
height: 1px;
|
||||
opacity: 0.1;
|
||||
`;
|
||||
|
||||
type Props = {
|
||||
getSummary: () => void,
|
||||
|
@ -33,30 +18,31 @@ type Props = {
|
|||
|
||||
export class Dashboard extends React.Component<Props> {
|
||||
componentDidMount() {
|
||||
/* eslint-disable-next-line */
|
||||
this.props.getSummary();
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.props.error) {
|
||||
return this.props.error;
|
||||
const {
|
||||
error, isLoading, total, shielded, transparent, dollarValue, addresses,
|
||||
} = this.props;
|
||||
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='dashboard'>
|
||||
{this.props.isLoading ? (
|
||||
{isLoading ? (
|
||||
'Loading'
|
||||
) : (
|
||||
<Fragment>
|
||||
<Title value='Dashboard' />
|
||||
<Divider />
|
||||
<WalletSummaryComponent
|
||||
total={this.props.total}
|
||||
shielded={this.props.shielded}
|
||||
transparent={this.props.transparent}
|
||||
dollarValue={this.props.dollarValue}
|
||||
addresses={this.props.addresses}
|
||||
/>
|
||||
</Fragment>
|
||||
<WalletSummaryComponent
|
||||
total={total}
|
||||
shielded={shielded}
|
||||
transparent={transparent}
|
||||
dollarValue={dollarValue}
|
||||
addresses={addresses}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue