Browse Source

fix(lint/tests): fix lint and test errors

renovate/lint-staged-8.x
Jack Mallers 7 years ago
parent
commit
63707b0b40
  1. 53
      app/components/Contacts/Network.js
  2. 30
      app/components/Contacts/SuggestedNodes.js
  3. 1
      app/routes/app/components/App.js
  4. 1
      app/routes/app/containers/AppContainer.js
  5. 25
      test/reducers/__snapshots__/channels.spec.js.snap

53
app/components/Contacts/Network.js

@ -54,8 +54,6 @@ class Network extends Component {
suggestedNodesProps
} = this.props
console.log('currentChannels: ', currentChannels)
const refreshClicked = () => {
// turn the spinner on
this.setState({ refreshing: true })
@ -143,28 +141,28 @@ class Network extends Component {
</header>
<div className={styles.channels}>
{
!loadingChannelPubkeys.length && !currentChannels.length &&
<SuggestedNodes {...suggestedNodesProps} />
}
{
loadingChannelPubkeys.length > 0 || currentChannels.length > 0 &&
<header className={styles.listHeader}>
<section>
<h2 onClick={toggleFilterPulldown} className={styles.filterTitle}>
{filter.name} <span className={filterPulldown && styles.pulldown}><FaAngleDown /></span>
</h2>
<ul className={`${styles.filters} ${filterPulldown && styles.active}`}>
{
nonActiveFilters.map(f => (
<li key={f.key} onClick={() => changeFilter(f)}>
{f.name}
</li>
))
}
</ul>
</section>
{
!loadingChannelPubkeys.length && !currentChannels.length &&
<SuggestedNodes {...suggestedNodesProps} />
}
{
(loadingChannelPubkeys.length > 0 || currentChannels.length) > 0 &&
<header className={styles.listHeader}>
<section>
<h2 onClick={toggleFilterPulldown} className={styles.filterTitle}>
{filter.name} <span className={filterPulldown && styles.pulldown}><FaAngleDown /></span>
</h2>
<ul className={`${styles.filters} ${filterPulldown && styles.active}`}>
{
nonActiveFilters.map(f => (
<li key={f.key} onClick={() => changeFilter(f)}>
{f.name}
</li>
))
}
</ul>
</section>
<section className={styles.refreshContainer}>
<span className={styles.refresh} onClick={refreshClicked} ref={(ref) => { this.repeat = ref }}>
{
@ -175,8 +173,8 @@ class Network extends Component {
}
</span>
</section>
</header>
}
</header>
}
<ul className={filterPulldown && styles.fade}>
{
@ -276,7 +274,7 @@ class Network extends Component {
</ul>
</div>
{
loadingChannelPubkeys.length > 0 || currentChannels.length > 0 &&
(loadingChannelPubkeys.length > 0 || currentChannels.length) > 0 &&
<footer className={styles.search}>
<label htmlFor='search' className={`${styles.label} ${styles.input}`}>
<Isvg src={search} />
@ -305,6 +303,7 @@ Network.propTypes = {
balance: PropTypes.object.isRequired,
currentTicker: PropTypes.object.isRequired,
ticker: PropTypes.object.isRequired,
suggestedNodesProps: PropTypes.object.isRequired,
fetchChannels: PropTypes.func.isRequired,
openContactsForm: PropTypes.func.isRequired,

30
app/components/Contacts/SuggestedNodes.js

@ -2,7 +2,12 @@ import React from 'react'
import PropTypes from 'prop-types'
import styles from './SuggestedNodes.scss'
const SuggestedNodes = ({ suggestedNodesLoading, suggestedNodes, setNode, openSubmitChannelForm }) => {
const SuggestedNodes = ({
suggestedNodesLoading,
suggestedNodes,
setNode,
openSubmitChannelForm
}) => {
const nodeClicked = (n) => {
// set the node public key for the submit form
setNode({ pub_key: n.pubkey, addresses: [{ addr: n.host }] })
@ -22,23 +27,22 @@ const SuggestedNodes = ({ suggestedNodesLoading, suggestedNodes, setNode, openSu
return (
<div className={styles.container}>
<header>
Hmmm, looks like you don't have any channels yet. Here are some suggested nodes to open a channel with to get started
{'Hmmm, looks like you don\'t have any channels yet. Here are some suggested nodes to open a channel with to get started'}
</header>
<ul className={styles.suggestedNodes}>
{
suggestedNodes.map(node => (
<li key={node.pubkey}>
<section>
<span>{node.nickname}</span>
<span>{`${node.pubkey.substring(0, 30)}...`}</span>
</section>
<section>
<span onClick={() => nodeClicked(node)}>Connect</span>
</section>
</li>
)
)
<li key={node.pubkey}>
<section>
<span>{node.nickname}</span>
<span>{`${node.pubkey.substring(0, 30)}...`}</span>
</section>
<section>
<span onClick={() => nodeClicked(node)}>Connect</span>
</section>
</li>
))
}
</ul>
</div>

1
app/routes/app/components/App.js

@ -129,6 +129,7 @@ App.propTypes = {
fetchChannels: PropTypes.func.isRequired,
fetchBalance: PropTypes.func.isRequired,
fetchDescribeNetwork: PropTypes.func.isRequired,
fetchSuggestedNodes: PropTypes.func.isRequired,
children: PropTypes.object.isRequired
}

1
app/routes/app/containers/AppContainer.js

@ -137,7 +137,6 @@ const mapDispatchToProps = {
}
const mapStateToProps = state => ({
info: state.info,
activity: state.activity,
lnd: state.lnd,

25
test/reducers/__snapshots__/channels.spec.js.snap

@ -54,6 +54,11 @@ Object {
},
"searchQuery": "",
"selectedChannel": null,
"suggestedNodes": Object {
"mainnet": Array [],
"testnet": Array [],
},
"suggestedNodesLoading": false,
"viewType": 0,
}
`;
@ -112,6 +117,11 @@ Object {
},
"searchQuery": "",
"selectedChannel": null,
"suggestedNodes": Object {
"mainnet": Array [],
"testnet": Array [],
},
"suggestedNodesLoading": false,
"viewType": 0,
}
`;
@ -171,6 +181,11 @@ Object {
],
"searchQuery": "",
"selectedChannel": null,
"suggestedNodes": Object {
"mainnet": Array [],
"testnet": Array [],
},
"suggestedNodesLoading": false,
"viewType": 0,
}
`;
@ -229,6 +244,11 @@ Object {
},
"searchQuery": "",
"selectedChannel": null,
"suggestedNodes": Object {
"mainnet": Array [],
"testnet": Array [],
},
"suggestedNodesLoading": false,
"viewType": 0,
}
`;
@ -287,6 +307,11 @@ Object {
},
"searchQuery": "",
"selectedChannel": null,
"suggestedNodes": Object {
"mainnet": Array [],
"testnet": Array [],
},
"suggestedNodesLoading": false,
"viewType": 0,
}
`;

Loading…
Cancel
Save