Browse Source

fix(lint): fix linting errors

renovate/lint-staged-8.x
Jack Mallers 7 years ago
parent
commit
3d9ee73d02
  1. 18
      app/components/ChannelForm/ChannelForm.js
  2. 7
      app/components/ChannelForm/Footer.js
  3. 55
      app/components/ChannelForm/StepFour.js
  4. 10
      app/components/ChannelForm/StepOne.js
  5. 17
      app/components/ChannelForm/StepThree.js
  6. 17
      app/components/ChannelForm/StepTwo.js
  7. 2
      app/components/ChannelForm/index.js
  8. 5
      app/components/Channels/CardChannel.js
  9. 2
      app/components/Channels/Channel.js
  10. 1
      app/components/CryptoIcon/CryptoIcon.js
  11. 6
      app/reducers/channelform.js
  12. 6
      app/reducers/channels.js
  13. 63
      app/routes/channels/components/Channels.js
  14. 2
      app/routes/channels/containers/ChannelsContainer.js
  15. BIN
      resources/bin/linux/lnd
  16. BIN
      resources/bin/win32/lnd.exe
  17. 3
      test/components/Nav.spec.js

18
app/components/ChannelForm/ChannelForm.js

@ -39,7 +39,7 @@ const ChannelForm = ({
return <StepFour node_key={channelform.node_key} local_amt={channelform.local_amt} push_amt={channelform.push_amt} />
}
}
return (
<ReactModal
isOpen={channelform.isOpen}
@ -56,7 +56,7 @@ const ChannelForm = ({
<header className={styles.header}>
<h3>{channelFormHeader}</h3>
<div className={styles.progress} style={{ width: `${channelFormProgress}%` }}></div>
<div className={styles.progress} style={{ width: `${channelFormProgress}%` }} />
</header>
<div className={styles.content}>
@ -73,6 +73,18 @@ const ChannelForm = ({
)
}
ChannelForm.propTypes = {}
ChannelForm.propTypes = {
channelform: PropTypes.object.isRequired,
openChannel: PropTypes.func.isRequired,
closeChannelForm: PropTypes.func.isRequired,
changeStep: PropTypes.func.isRequired,
setNodeKey: PropTypes.func.isRequired,
setLocalAmount: PropTypes.func.isRequired,
setPushAmount: PropTypes.func.isRequired,
channelFormHeader: PropTypes.string.isRequired,
channelFormProgress: PropTypes.number.isRequired,
stepTwoIsValid: PropTypes.bool.isRequired,
peers: PropTypes.array.isRequired
}
export default ChannelForm

7
app/components/ChannelForm/Footer.js

@ -1,16 +1,15 @@
import React from 'react'
import PropTypes from 'prop-types'
import { FaArrowLeft, FaArrowRight, FaCheck } from 'react-icons/lib/fa'
import styles from './Footer.scss'
const Footer = ({ step, changeStep, stepTwoIsValid, submit }) => {
if ( step === 1 ) { return null }
if (step === 1) { return null }
// See if the next button on step 2 should be active
const nextIsInactive = step === 2 && !stepTwoIsValid
// Function that's called when the user clicks "next" in the form
const nextFunc = () => {
const nextFunc = () => {
if (nextIsInactive) { return }
changeStep(step + 1)

55
app/components/ChannelForm/StepFour.js

@ -1,34 +1,37 @@
import React, { Component } from 'react'
import React from 'react'
import PropTypes from 'prop-types'
import CurrencyIcon from 'components/CurrencyIcon'
import styles from './StepFour.scss'
class StepFour extends Component {
render() {
const { node_key, local_amt, push_amt } = this.props
const StepFour = ({ node_key, local_amt, push_amt }) => (
<div className={styles.container}>
<div className={styles.nodekey}>
<h4>Peer</h4>
<h2>{node_key}</h2>
</div>
return (
<div className={styles.container}>
<div className={styles.nodekey}>
<h4>Peer</h4>
<h2>{node_key}</h2>
</div>
<div className={styles.amounts}>
<div className={styles.localamt}>
<h4>Local Amount</h4>
<h3>{local_amt}</h3>
</div>
<div className={styles.pushamt}>
<h4>Push Amount</h4>
<h3>{push_amt}</h3>
</div>
</div>
<div className={styles.amounts}>
<div className={styles.localamt}>
<h4>Local Amount</h4>
<h3>{local_amt}</h3>
</div>
)
}
}
<div className={styles.pushamt}>
<h4>Push Amount</h4>
<h3>{push_amt}</h3>
</div>
</div>
</div>
)
StepFour.propTypes = {}
StepFour.propTypes = {
node_key: PropTypes.string.isRequired,
local_amt: PropTypes.oneOfType([
PropTypes.number,
PropTypes.string
]),
push_amt: PropTypes.oneOfType([
PropTypes.number,
PropTypes.string
])
}
export default StepFour

10
app/components/ChannelForm/StepOne.js

@ -30,7 +30,7 @@ class StepOne extends Component {
render() {
const { peers, searchQuery } = this.state
return (
<div>
<div className={styles.search}>
@ -59,13 +59,17 @@ class StepOne extends Component {
<h1>{peer.pub_key}</h1>
</li>
)
)}
)}
</ul>
</div>
)
}
}
StepOne.propTypes = {}
StepOne.propTypes = {
peers: PropTypes.array.isRequired,
setNodeKey: PropTypes.func.isRequired,
changeStep: PropTypes.func.isRequired
}
export default StepOne

17
app/components/ChannelForm/StepThree.js

@ -11,7 +11,11 @@ class StepThree extends Component {
<div className={styles.container}>
<div className={styles.explainer}>
<h2>Push Amount</h2>
<p>The push amount is the amount of bitcoin (if any at all) you'd like to "push" to the other side of the channel when it opens. This amount will be set on the remote side of the channel as part of the initial commitment state.</p>
<p>
The push amount is the amount of bitcoin (if any at all) you&apos;d like
to &quot;push&quot; to the other side of the channel when it opens.
This amount will be set on the remote side of the channel as part of the initial commitment state.
</p>
</div>
<form>
@ -19,11 +23,10 @@ class StepThree extends Component {
<CurrencyIcon currency={'btc'} crypto={'btc'} />
</label>
<input
autoFocus
type='number'
min='0'
max='0.16'
ref={input => this.input = input}
ref={input => (this.input = input)}
size=''
value={push_amt}
onChange={event => setPushAmount(event.target.value)}
@ -36,6 +39,12 @@ class StepThree extends Component {
}
}
StepThree.propTypes = {}
StepThree.propTypes = {
push_amt: PropTypes.oneOfType([
PropTypes.number,
PropTypes.string
]).isRequired,
setPushAmount: PropTypes.func.isRequired
}
export default StepThree

17
app/components/ChannelForm/StepTwo.js

@ -1,6 +1,5 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import AutosizeInput from 'react-input-autosize'
import CurrencyIcon from 'components/CurrencyIcon'
import styles from './StepTwo.scss'
@ -12,7 +11,10 @@ class StepTwo extends Component {
<div className={styles.container}>
<div className={styles.explainer}>
<h2>Local Amount</h2>
<p>Local amount is the amount of bitcoin that you would like to commit to the channel. This is the amount that will be sent in an on-chain transaction to open your Lightning channel.</p>
<p>
Local amount is the amount of bitcoin that you would like to commit to the channel.
This is the amount that will be sent in an on-chain transaction to open your Lightning channel.
</p>
</div>
<form>
@ -20,11 +22,10 @@ class StepTwo extends Component {
<CurrencyIcon currency={'btc'} crypto={'btc'} />
</label>
<input
autoFocus
type='number'
min='0'
max='0.16'
ref={input => this.input = input}
ref={input => (this.input = input)}
size=''
value={local_amt}
onChange={event => setLocalAmount(event.target.value)}
@ -37,6 +38,12 @@ class StepTwo extends Component {
}
}
StepTwo.propTypes = {}
StepTwo.propTypes = {
local_amt: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number
]).isRequired,
setLocalAmount: PropTypes.func.isRequired
}
export default StepTwo

2
app/components/ChannelForm/index.js

@ -1,3 +1,3 @@
import ChannelForm from './ChannelForm'
export default ChannelForm
export default ChannelForm

5
app/components/Channels/CardChannel.js

@ -1,16 +1,15 @@
import React from 'react'
import PropTypes from 'prop-types'
import { btc } from 'utils'
import styles from './CardChannel.scss'
const CardChannel = ({ channel }) => (
<li className={styles.channel}>
CardChannel
{channel.chan_id}
</li>
)
CardChannel.propTypes = {
channel: PropTypes.object.isRequired
}
export default CardChannel

2
app/components/Channels/Channel.js

@ -9,7 +9,7 @@ const Channel = ({ ticker, channel, setChannel, currentTicker }) => (
<header>
<span className={styles.status}>Open</span>
{
channel.active ?
channel.active ?
<span className={styles.active}>
<FaCircle />
<i>Active</i>

1
app/components/CryptoIcon/CryptoIcon.js

@ -1,7 +1,6 @@
import React from 'react'
import PropTypes from 'prop-types'
import path from 'path'
import { FaBitcoin } from 'react-icons/lib/fa'
import Isvg from 'react-inlinesvg'
const CryptoIcon = ({ currency, styles }) => {

6
app/reducers/channelform.js

@ -78,11 +78,11 @@ export function resetChannelForm() {
const ACTION_HANDLERS = {
[OPEN_CHANNEL_FORM]: state => ({ ...state, isOpen: true }),
[CLOSE_CHANNEL_FORM]: state => ({ ...state, isOpen: false }),
[SET_NODE_KEY]: (state, { node_key }) => ({ ...state, node_key }),
[SET_LOCAL_AMOUNT]: (state, { local_amt }) => ({ ...state, local_amt }),
[SET_PUSH_AMOUNT]: (state, { push_amt }) => ({ ...state, push_amt }),
[CHANGE_STEP]: (state, { step }) => ({ ...state, step }),
[RESET_CHANNEL_FORM]: () => (initialState)
@ -94,7 +94,7 @@ const channelFormLocalAmountSelector = state => state.channelform.local_amt
channelFormSelectors.channelFormHeader = createSelector(
channelFormStepSelector,
step => {
(step) => {
switch (step) {
case 1:
return 'Step 1: Select a peer'

6
app/reducers/channels.js

@ -199,9 +199,9 @@ const ACTION_HANDLERS = {
[OPENING_FAILURE]: state => ({ ...state, openingChannel: false }),
[CLOSING_CHANNEL]: state => ({ ...state, closingChannel: true }),
[UPDATE_SEARCH_QUERY]: (state, { searchQuery }) => ({ ...state, searchQuery }),
[SET_VIEW_TYPE]: (state, { viewType }) => ({ ...state, viewType })
}
@ -225,7 +225,7 @@ channelsSelectors.allChannels = createSelector(
pendingForceClosedChannelsSelector,
channelSearchQuerySelector,
(channels, pendingOpenChannels, pendingClosedChannels, pendingForcedClosedChannels, searchQuery) => (
[...channels, ...pendingOpenChannels, ...pendingClosedChannels, ...pendingForcedClosedChannels].filter(channel =>
[...channels, ...pendingOpenChannels, ...pendingClosedChannels, ...pendingForcedClosedChannels].filter(channel =>
channel.remote_pubkey.includes(searchQuery) || channel.channel_point.includes(searchQuery)
)
)

63
app/routes/channels/components/Channels.js

@ -13,25 +13,19 @@ import styles from './Channels.scss'
class Channels extends Component {
componentWillMount() {
const { fetchChannels, fetchPeers } = this.props
fetchChannels()
fetchPeers()
}
render() {
const {
channels: { channels, searchQuery, viewType },
channels: { searchQuery, viewType },
allChannels,
updateChannelSearchQuery,
setViewType,
closeChannelForm,
openChannelForm,
channelform,
channelFormHeader,
channelFormProgress,
peers: { peers },
openChannelForm,
ticker,
currentTicker,
@ -61,7 +55,7 @@ class Channels extends Component {
<span className={viewType === 0 && styles.active} onClick={() => setViewType(0)}>
<FaAlignJustify />
</span>
<span className={viewType === 1 && styles.active} onClick={() => setViewType(1)}>
<span className={viewType === 1 && styles.active}>
<FaThLarge />
</span>
</div>
@ -74,26 +68,22 @@ class Channels extends Component {
<div className={styles.channels}>
<ul className={viewType === 1 && styles.cardsContainer}>
{ viewType === 0 && allChannels.map((channel, index) => {
return (
<Channel
key={index}
ticker={ticker}
channel={channel}
setChannel={() => console.log('hi')}
currentTicker={currentTicker}
/>
)
})
}
{ viewType === 1 && allChannels.map((channel, index) => {
return (
<CardChannel key={index}>
{ viewType === 0 && allChannels.map((channel, index) => (
<Channel
key={index}
ticker={ticker}
channel={channel}
setChannel={() => console.log('hi')}
currentTicker={currentTicker}
/>
))
}
{ viewType === 1 && allChannels.map((channel, index) => (
<CardChannel key={index} channel={channel}>
card channel
</CardChannel>
)
})
}
</CardChannel>
))
}
</ul>
</div>
</div>
@ -102,7 +92,20 @@ class Channels extends Component {
}
Channels.propTypes = {
fetchChannels: PropTypes.func.isRequired,
fetchPeers: PropTypes.func.isRequired,
channels: PropTypes.object.isRequired,
allChannels: PropTypes.array.isRequired,
updateChannelSearchQuery: PropTypes.func.isRequired,
setViewType: PropTypes.func.isRequired,
openChannelForm: PropTypes.func.isRequired,
ticker: PropTypes.object.isRequired,
currentTicker: PropTypes.object.isRequired,
channelFormProps: PropTypes.object.isRequired
}
export default Channels

2
app/routes/channels/containers/ChannelsContainer.js

@ -31,7 +31,7 @@ const mapDispatchToProps = {
openChannel,
updateChannelSearchQuery,
setViewType,
openChannelForm,
closeChannelForm,
setNodeKey,

BIN
resources/bin/linux/lnd

Binary file not shown.

BIN
resources/bin/win32/lnd.exe

Binary file not shown.

3
test/components/Nav.spec.js

@ -1,9 +1,6 @@
import React from 'react'
import { shallow } from 'enzyme'
import ReactSVG from 'react-svg'
import { NavLink } from 'react-router-dom'
import { MdAccountBalanceWallet } from 'react-icons/lib/md'
import { FaClockO, FaDollar } from 'react-icons/lib/fa'
import Nav from 'components/Nav'
const defaultProps = {

Loading…
Cancel
Save