Browse Source

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

renovate/lint-staged-8.x
Jack Mallers 7 years ago
parent
commit
86f38adb77
  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> </span>
) )
} }
if (activeChannelPubkeys.includes(node.pub_key)) { if (activeChannelPubkeys.includes(node.pub_key)) {
return ( return (
<span className={`${styles.online} ${styles.inactive}`}> <span className={`${styles.online} ${styles.inactive}`}>
@ -80,7 +80,7 @@ class ContactsForm extends React.Component {
return ( return (
<span <span
className={`${styles.connect} hint--left`} 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 })} onClick={() => openChannel({ pubkey: node.pub_key, host: node.addresses[0].addr, local_amt: contactsform.contactCapacity })}
> >
Connect Connect

10
app/lnd/methods/channelController.js

@ -43,16 +43,18 @@ export function connectAndOpen(lnd, meta, event, payload) {
const call = lnd.openChannel(channelPayload, meta) const call = lnd.openChannel(channelPayload, meta)
call.on('data', data => event.sender.send('pushchannelupdated', { data })) call.on('data', data => event.sender.send('pushchannelupdated', { pubkey, data }))
call.on('error', error => event.sender.send('pushchannelerror', { error: error.toString() })) call.on('error', error => event.sender.send('pushchannelerror', { pubkey, error: error.toString() }))
}) })
.catch(err => { .catch(err => {
console.log('connectPeer err: ', err) console.log('connect peer err: ', err)
event.sender.send('pushchannelerror', { pubkey, error: err.toString() })
}) })
} }
}) })
.catch(err => { .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 - SendPayment
// TODO - DeleteAllPayments // 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) { export default function (lnd, meta, event, msg, data) {
switch (msg) { switch (msg) {
case 'info': 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) => { export const openChannel = ({ pubkey, host, local_amt, push_amt }) => (dispatch) => {
const localamt = btc.btcToSatoshis(local_amt) const localamt = btc.btcToSatoshis(local_amt)
console.log('localamt: ', localamt)
console.log('pubkey: ', pubkey)
console.log('host: ', host)
dispatch(openingChannel()) dispatch(openingChannel())
dispatch(addLoadingPubkey(pubkey)) dispatch(addLoadingPubkey(pubkey))
ipcRenderer.send('lnd', { msg: 'connectAndOpen', data: { pubkey, host, localamt } }) 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} value={searchQuery}
onChange={event => updateChannelSearchQuery(event.target.value)} onChange={event => updateChannelSearchQuery(event.target.value)}
className={`${styles.text} ${styles.input}`} className={`${styles.text} ${styles.input}`}
placeholder='Search your friends list...' placeholder='Search your contacts list...'
type='text' type='text'
id='channelSearch' id='channelSearch'
/> />
@ -153,7 +153,7 @@ class Contacts extends Component {
{ {
loadingChannelPubkeys.map(pubkey => { loadingChannelPubkeys.map(pubkey => {
console.log('pubkey: ', pubkey) console.log('pubkey: ', pubkey)
return ( return (
<LoadingContact pubkey={pubkey} /> <LoadingContact pubkey={pubkey} />
) )

2
app/variables.scss

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