Browse Source

fix(contacts): small bug fixes with contacts error and UI

renovate/lint-staged-8.x
Jack Mallers 7 years ago
parent
commit
75673ca5a9
  1. 4
      app/components/Contacts/ContactsForm.js
  2. 10
      app/lnd/methods/channelController.js
  3. 5
      app/lnd/methods/index.js
  4. 5
      app/reducers/channels.js
  5. 4
      app/routes/contacts/components/Contacts.js
  6. 2
      app/variables.scss

4
app/components/Contacts/ContactsForm.js

@ -44,7 +44,7 @@ class ContactsForm extends React.Component {
</span>
)
}
if (activeChannelPubkeys.includes(node.pub_key)) {
return (
<span className={`${styles.online} ${styles.inactive}`}>
@ -80,7 +80,7 @@ class ContactsForm extends React.Component {
return (
<span
className={`${styles.connect} hint--left`}
data-hint='Connect with 0.1 BTC'
data-hint={`Connect with ${contactsform.contactCapacity} BTC`}
onClick={() => openChannel({ pubkey: node.pub_key, host: node.addresses[0].addr, local_amt: contactsform.contactCapacity })}
>
Connect

10
app/lnd/methods/channelController.js

@ -43,16 +43,18 @@ export function connectAndOpen(lnd, meta, event, payload) {
const call = lnd.openChannel(channelPayload, meta)
call.on('data', data => event.sender.send('pushchannelupdated', { data }))
call.on('error', error => event.sender.send('pushchannelerror', { error: error.toString() }))
call.on('data', data => event.sender.send('pushchannelupdated', { pubkey, data }))
call.on('error', error => event.sender.send('pushchannelerror', { pubkey, error: error.toString() }))
})
.catch(err => {
console.log('connectPeer err: ', err)
console.log('connect peer err: ', err)
event.sender.send('pushchannelerror', { pubkey, error: err.toString() })
})
}
})
.catch(err => {
console.log('listPeers err', err)
console.log('list peer err: ', err)
event.sender.send('pushchannelerror', { pubkey, error: err.toString() })
})
})
}

5
app/lnd/methods/index.js

@ -18,11 +18,6 @@ import * as networkController from './networkController'
// TODO - SendPayment
// TODO - DeleteAllPayments
// const metadata = new grpc.Metadata()
// var macaroonHex = fs.readFileSync('~/Library/Application Support/Lnd/admin.macaroon').toString('hex')
// metadata.add('macaroon', macaroonHex)
export default function (lnd, meta, event, msg, data) {
switch (msg) {
case 'info':

5
app/reducers/channels.js

@ -121,8 +121,13 @@ export const receiveChannels = (event, { channels, pendingChannels }) => dispatc
export const openChannel = ({ pubkey, host, local_amt, push_amt }) => (dispatch) => {
const localamt = btc.btcToSatoshis(local_amt)
console.log('localamt: ', localamt)
console.log('pubkey: ', pubkey)
console.log('host: ', host)
dispatch(openingChannel())
dispatch(addLoadingPubkey(pubkey))
ipcRenderer.send('lnd', { msg: 'connectAndOpen', data: { pubkey, host, localamt } })
}

4
app/routes/contacts/components/Contacts.js

@ -116,7 +116,7 @@ class Contacts extends Component {
value={searchQuery}
onChange={event => updateChannelSearchQuery(event.target.value)}
className={`${styles.text} ${styles.input}`}
placeholder='Search your friends list...'
placeholder='Search your contacts list...'
type='text'
id='channelSearch'
/>
@ -153,7 +153,7 @@ class Contacts extends Component {
{
loadingChannelPubkeys.map(pubkey => {
console.log('pubkey: ', pubkey)
return (
<LoadingContact pubkey={pubkey} />
)

2
app/variables.scss

@ -12,7 +12,7 @@ $bluegrey: #555459;
$green: #0bb634;
$terminalgreen: #00FF00;
$red: #ff0b00;
$red: #FF556A;
$blue: #007bb6;
$orange: #FF8A65;
$curve: cubic-bezier(0.650, 0.000, 0.450, 1.000);
Loading…
Cancel
Save