Browse Source

feature(help): help videos

renovate/lint-staged-8.x
Jack Mallers 7 years ago
parent
commit
7bfecd9764
  1. 43
      app/components/LndSyncing/LndSyncing.js
  2. 2
      app/components/LndSyncing/LndSyncing.scss
  3. 6
      app/containers/Root.js
  4. 2
      app/main.dev.js
  5. 8
      app/reducers/lnd.js
  6. 43
      app/routes/help/components/Help.js
  7. 2
      app/routes/help/components/Help.scss
  8. 2
      package.json

43
app/components/LndSyncing/LndSyncing.js

@ -1,5 +1,7 @@
import React, { Component } from 'react' import React, { Component } from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import copy from 'copy-to-clipboard'
import { showNotification } from 'notifications'
import { FaCopy } from 'react-icons/lib/fa' import { FaCopy } from 'react-icons/lib/fa'
import styles from './LndSyncing.scss' import styles from './LndSyncing.scss'
@ -31,25 +33,37 @@ class LndSyncing extends Component {
} }
componentWillMount() { componentWillMount() {
const { fetchBlockHeight, newAddress } = this.props this.props.fetchBlockHeight()
}
componentDidUpdate(prevProps) {
const { grpcStarted, newAddress } = this.props
fetchBlockHeight() if (!prevProps.grpcStarted && grpcStarted) {
newAddress('np2wkh') newAddress('np2wkh')
} }
}
render() { render() {
const { syncPercentage, address: { address } } = this.props const { syncPercentage, address: { addressLoading, address } } = this.props
const { facts, currentFact } = this.state const { facts, currentFact } = this.state
const renderCurrentFact = facts[currentFact] const renderCurrentFact = facts[currentFact]
const copyOnClick = () => {
if (!address) { return }
copy(address)
showNotification('Noice', 'Successfully copied to clipboard')
}
return ( return (
<div className={styles.container}> <div className={styles.container}>
<header> <header>
<section> <section>
<h3>zap</h3> <h3>zap</h3>
</section> </section>
<section className={styles.loading}> <section className={`${styles.loading} hint--left`} data-hint='Syncing your Lightning Network node to the blockchain'>
<h4>{syncPercentage}%</h4> <h4>{syncPercentage.toString().length > 0 && `${syncPercentage}%`}</h4>
<div className={styles.spinner} /> <div className={styles.spinner} />
</section> </section>
</header> </header>
@ -79,8 +93,15 @@ class LndSyncing extends Component {
</section> </section>
<section> <section>
<div className={styles.address}> <div className={styles.address}>
<span>{address}</span> <span>
<span className='hint--left' data-hint='Copy Address'> {
addressLoading ?
'Loading...'
:
address
}
</span>
<span className='hint--left' data-hint='Copy Address' onClick={copyOnClick}>
<FaCopy /> <FaCopy />
</span> </span>
</div> </div>
@ -94,8 +115,12 @@ class LndSyncing extends Component {
LndSyncing.propTypes = { LndSyncing.propTypes = {
newAddress: PropTypes.func.isRequired, newAddress: PropTypes.func.isRequired,
fetchBlockHeight: PropTypes.func.isRequired, fetchBlockHeight: PropTypes.func.isRequired,
syncPercentage: PropTypes.number.isRequired, syncPercentage: PropTypes.oneOfType([
address: PropTypes.object.isRequired PropTypes.number,
PropTypes.string
]).isRequired,
address: PropTypes.object.isRequired,
grpcStarted: PropTypes.bool.isRequired
} }
export default LndSyncing export default LndSyncing

2
app/components/LndSyncing/LndSyncing.scss

@ -183,7 +183,7 @@
span:nth-child(1) { span:nth-child(1) {
flex: 9; flex: 9;
overflow-x: scroll; overflow-x: scroll;
font-size: 18px; font-size: 14px;
} }
span:nth-child(2) { span:nth-child(2) {

6
app/containers/Root.js

@ -39,6 +39,7 @@ const Root = ({
fetchBlockHeight={fetchBlockHeight} fetchBlockHeight={fetchBlockHeight}
syncPercentage={syncPercentage} syncPercentage={syncPercentage}
address={address} address={address}
grpcStarted={lnd.grpcStarted}
/> />
) )
} }
@ -61,7 +62,10 @@ Root.propTypes = {
lnd: PropTypes.object.isRequired, lnd: PropTypes.object.isRequired,
fetchBlockHeight: PropTypes.func.isRequired, fetchBlockHeight: PropTypes.func.isRequired,
newAddress: PropTypes.func.isRequired, newAddress: PropTypes.func.isRequired,
syncPercentage: PropTypes.number.isRequired, syncPercentage: PropTypes.oneOfType([
PropTypes.number,
PropTypes.string
]).isRequired,
address: PropTypes.object.isRequired address: PropTypes.object.isRequired
} }

2
app/main.dev.js

@ -133,7 +133,7 @@ const startLnd = () => {
[ [
'--bitcoin.active', '--bitcoin.active',
'--bitcoin.testnet', '--bitcoin.testnet',
'--neutrino.active', '--bitcoin.node=neutrino',
'--neutrino.connect=btcd0.lightning.computer:18333', '--neutrino.connect=btcd0.lightning.computer:18333',
'--autopilot.active', '--autopilot.active',
'--debuglevel=debug', '--debuglevel=debug',

8
app/reducers/lnd.js

@ -122,7 +122,13 @@ const lndBlockHeightSelector = state => state.lnd.lndBlockHeight
lndSelectors.syncPercentage = createSelector( lndSelectors.syncPercentage = createSelector(
blockHeightSelector, blockHeightSelector,
lndBlockHeightSelector, lndBlockHeightSelector,
(blockHeight, lndBlockHeight) => (Math.floor((lndBlockHeight / blockHeight) * 100)) (blockHeight, lndBlockHeight) => {
const percentage = Math.floor((lndBlockHeight / blockHeight) * 100)
if (percentage === Infinity) { return '' }
return percentage
}
) )
export { lndSelectors } export { lndSelectors }

43
app/routes/help/components/Help.js

@ -13,39 +13,38 @@ class Help extends Component {
this.state = { this.state = {
videos: [ videos: [
{ {
id: 'GYIHrd7e-n0', id: '8kZq6eec49A',
title: 'Joyner Lucas - Mask Off Remix (Mask On)' title: 'Syncing and Depositing - Zap Lightning Network Wallet Tutorial (Video 1)'
}, },
{ {
id: 'ZFy7RdZWwj8', id: 'xSiTH63fOQM',
title: 'Joyner Lucas - Bank Account (Remix)' title: 'Adding a contact - Zap Lightning Network Wallet Tutorial (Video 2)'
}, },
{ {
id: 'DlFmfxACvig', id: 'c0SLmywYDHU',
title: 'Lil Skies - Nowadays ft. Landon Cube (Dir. by @_ColeBennett_)' title: 'Making a Lightning Network payment - Zap Lightning Network Wallet Tutorial (Video 3)'
}, },
{ {
id: 'XbZ0OXmXw38', id: 'Xrx2TiiF90Q',
title: 'Dave - Wanna Know ft. Drake (Audio)' title: 'Receive Lightning Network payment - Zap Lightning Network Wallet Tutorial (Video 4)'
}, },
{ {
id: 'sRrcogH7F_I', id: 'YfxukBHnwUM',
title: 'Bryson Tiller - How About Now (Freestyle)' title: 'Network Map - Zap Lightning Network Wallet Tutorial (Video 5)'
}, },
{ {
id: 'j6Np8vCO0hQ', id: 'NORklrrYzOg',
title: 'Young Pappy - Killa (Official Music Video)' title: 'Using an explorer to add Zap contacts - Zap Lightning Network Wallet Tutorial (Video 6)'
},
{
id: 'PjqKPHZJgF0',
title: 'Lil Wayne - Family Feud feat. Drake (Official Audio) | Dedication 6'
} }
] ],
searchQuery: ''
} }
} }
render() { render() {
const { videos } = this.state const { videos, searchQuery } = this.state
const filteredVideos = videos.filter(video => video.title.includes(searchQuery))
return ( return (
<div className={styles.helpContainer}> <div className={styles.helpContainer}>
<header className={styles.header}> <header className={styles.header}>
@ -57,8 +56,8 @@ class Help extends Component {
<MdSearch /> <MdSearch />
</label> </label>
<input <input
value={''} value={searchQuery}
onChange={event => console.log('gang')} onChange={event => this.setState({ searchQuery: event.target.value })}
className={`${styles.text} ${styles.input}`} className={`${styles.text} ${styles.input}`}
placeholder='Search the video library...' placeholder='Search the video library...'
type='text' type='text'
@ -68,8 +67,7 @@ class Help extends Component {
<ul className={styles.videos}> <ul className={styles.videos}>
{ {
videos.map((video, index) => { filteredVideos.map((video, index) =>
return (
<li key={index}> <li key={index}>
<iframe <iframe
src={`https://www.youtube.com/embed/${video.id}`} src={`https://www.youtube.com/embed/${video.id}`}
@ -80,7 +78,6 @@ class Help extends Component {
</section> </section>
</li> </li>
) )
})
} }
</ul> </ul>
</div> </div>

2
app/routes/help/components/Help.scss

@ -83,6 +83,8 @@
background: $darkgrey; background: $darkgrey;
cursor: pointer; cursor: pointer;
transition: all 0.25s; transition: all 0.25s;
text-align: left;
line-height: 1.5;
} }
} }
} }

2
package.json

@ -38,7 +38,7 @@
"npm": ">=5.0.0" "npm": ">=5.0.0"
}, },
"build": { "build": {
"productName": "ZapDesktop", "productName": "Zap",
"appId": "org.develar.ZapDesktop", "appId": "org.develar.ZapDesktop",
"files": [ "files": [
"dist/", "dist/",

Loading…
Cancel
Save