Browse Source

feature(syncing): redid sync screen

renovate/lint-staged-8.x
Jack Mallers 7 years ago
parent
commit
de4379aeca
  1. 83
      app/components/LndSyncing/LndSyncing.js
  2. 242
      app/components/LndSyncing/LndSyncing.scss
  3. 3
      app/components/LndSyncing/index.js
  4. 45
      app/components/Onboarding/Syncing.js
  5. 50
      app/components/Onboarding/Syncing.scss
  6. 7
      app/containers/Root.js
  7. 1
      app/variables.scss

83
app/components/LndSyncing/LndSyncing.js

@ -1,83 +0,0 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import styles from './LndSyncing.scss'
class LndSyncing extends Component {
constructor(props) {
super(props)
this.state = {
facts: [
{
title: 'The Lightning Network',
description: 'The Lightning Network is a second layer solution built on top of the Bitcoin block chain that attempts to increase Bitcoin\'s scalability and privacy' // eslint-disable-line max-len
},
{
title: 'Payment Channel',
description: 'A payment channel is a class of techniques designed to allow users to make multiple Bitcoin transactions without commiting all of the transactions to the Bitcoin block chain. You can think of payment channels like tubes of money' // eslint-disable-line max-len
},
{
title: 'HTLC',
description: 'Hashed TimeLock Contracts is a class of payments that use hashlocks and timelocks to require the receiver of a payment either acknowledge receiving the payment before a deadline or forfeit the ability to claim the payment. HTLCs are useful within the Lightning Network for routing payments across two or more payment channels' // eslint-disable-line max-len
},
{
title: 'Onion Routing',
description: 'Onion routing is a technique for anonymous communication over a computer network. In an onion network, messages are encapsulated in layers of encryption, analogous to layers of an onion.' // eslint-disable-line max-len
}
],
currentFact: 0
}
}
componentWillMount() {
this.props.fetchBlockHeight()
}
render() {
const { syncPercentage } = this.props
const { facts, currentFact } = this.state
const renderCurrentFact = facts[currentFact]
return (
<div className={styles.container}>
<header>
<section>
<h3>zap</h3>
</section>
<section className={`${styles.loading} hint--left`} data-hint='Syncing your Lightning Network node to the blockchain'>
<h4>{syncPercentage.toString().length > 0 && `${syncPercentage}%`}</h4>
<div className={styles.spinner} />
</section>
</header>
<div className={styles.facts}>
<div className={styles.fact}>
<h2>{renderCurrentFact.title}</h2>
<p>{renderCurrentFact.description}</p>
</div>
<ul className={styles.factButtons}>
{
facts.map((fact, index) => (
<li
className={`${styles.factButton} ${currentFact === index && styles.active}`}
key={index}
onClick={() => this.setState({ currentFact: index })}
/>
))
}
</ul>
</div>
</div>
)
}
}
LndSyncing.propTypes = {
fetchBlockHeight: PropTypes.func.isRequired,
syncPercentage: PropTypes.oneOfType([
PropTypes.number,
PropTypes.string
]).isRequired
}
export default LndSyncing

242
app/components/LndSyncing/LndSyncing.scss

@ -1,242 +0,0 @@
@import '../../variables.scss';
.container {
height: 100vh;
background: $secondary;
header {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: top;
padding: 100px;
}
h3 {
font-size: 50px;
color: $white;
}
.loading {
text-align: center;
position: relative;
.spinner, h1 {
display: inline-block;
vertical-align: top;
}
h4 {
position: absolute;
min-width: 100px;
top: calc(50% - 5px);
left: calc(50% - 48px);
color: $main;
font-size: 10px;
}
h1 {
color: $main;
line-height: 50px;
margin-left: 20px;
}
}
.facts {
color: $white;
.fact {
transition: all 0.25s;
width: 50%;
margin: 0 auto;
text-align: center;
line-height: 1.5;
letter-spacing: 1.1px;
height: 250px;
h2 {
font-size: 50px;
margin-bottom: 10px;
}
p {
margin-bottom: 20px;
}
}
}
.factButtons {
text-align: center;
}
.factButton {
cursor: pointer;
display: inline-block;
width: 15px;
height: 15px;
background: $white;
opacity: 0.5;
border-radius: 50%;
margin: 0 5px;
&:hover {
opacity: 0.75;
}
&.active {
opacity: 1;
}
}
}
.aliasForm {
width: 50%;
margin: 0 auto;
h1 {
text-align: center;
font-size: 32px;
color: $white;
}
p {
color: $darkgrey;
text-align: center;
margin-top: 20px;
font-weight: 100;
}
.inputContainer {
text-align: center;
margin-top: 50px;
}
.input {
padding: 20px;
font-size: 18px;
color: $darkestgrey;
background: lighten($black, 15%);
border: none;
outline: 0;
-webkit-appearance: none;
font-weight: 200;
width: calc(100% - 20px);
}
.submit {
background: $main;
color: $white;
font-size: 18px;
cursor: pointer;
width: 10%;
margin: 50px auto 0 auto;
padding: 20px 60px;
opacity: 0.5;
}
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
background: darken($secondary, 5%);
white-space: nowrap;
section {
display: inline-block;
vertical-align: top;
width: 50%;
white-space: normal;
padding: 30px 0;
h2 {
color: $white;
font-size: 22px;
letter-spacing: 1.2px;
font-weight: bold;
margin-bottom: 20px;
padding: 0 30px;
}
p {
color: $white;
padding: 0 30px;
line-height: 1.5;
}
}
.address {
display: flex;
flex-direction: row;
font-family: 'Roboto';
font-size: 14px;
font-weight: 200;
background: lighten($black, 15%);
color: $darkestgrey;
width: 75%;
margin: 0 auto;
span {
padding: 20px;
}
span:nth-child(1) {
flex: 9;
overflow-x: scroll;
font-size: 14px;
}
span:nth-child(2) {
background: $darkestgrey;
color: $white;
cursor: pointer;
transition: all 0.25s;
&:hover {
background: $darkestgrey;
}
}
}
}
.spinner {
border: 1px solid rgba(235, 184, 100, 0.1);
border-left-color: rgba(235, 184, 100, 0.4);
-webkit-border-radius: 999px;
-moz-border-radius: 999px;
border-radius: 999px;
}
.spinner {
margin: 0 auto;
height: 50px;
width: 50px;
-webkit-animation: animation-rotate 1000ms linear infinite;
-moz-animation: animation-rotate 1000ms linear infinite;
-o-animation: animation-rotate 1000ms linear infinite;
animation: animation-rotate 1000ms linear infinite;
}
@-webkit-keyframes animation-rotate {
100% {
-webkit-transform: rotate(360deg);
}
}
@-moz-keyframes animation-rotate {
100% {
-moz-transform: rotate(360deg);
}
}
@-o-keyframes animation-rotate {
100% {
-o-transform: rotate(360deg);
}
}
@keyframes animation-rotate {
100% {
transform: rotate(360deg);
}
}

3
app/components/LndSyncing/index.js

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

45
app/components/Onboarding/Syncing.js

@ -0,0 +1,45 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import Isvg from 'react-inlinesvg'
import zapLogo from 'icons/zap_logo.svg'
import styles from './Syncing.scss'
class Syncing extends Component {
componentWillMount() {
this.props.fetchBlockHeight()
}
render() {
const { syncPercentage } = this.props
return (
<div className={styles.container}>
<div className={styles.titleBar} />
<div className={styles.content}>
<header>
<Isvg className={styles.bitcoinLogo} src={zapLogo} />
</header>
<section className={styles.progressContainer}>
<h1>Syncing to the blockchain...</h1>
<div className={styles.progressBar}>
<div className={styles.progress} style={{ width: syncPercentage }} />
</div>
<h4>{syncPercentage.toString().length > 0 && `${syncPercentage}%`}</h4>
</section>
</div>
</div>
)
}
}
Syncing.propTypes = {
fetchBlockHeight: PropTypes.func.isRequired,
syncPercentage: PropTypes.oneOfType([
PropTypes.number,
PropTypes.string
]).isRequired
}
export default Syncing

50
app/components/Onboarding/Syncing.scss

@ -0,0 +1,50 @@
@import '../../variables.scss';
.container {
position: relative;
height: 100vh;
background: $spaceblue;
}
.titleBar {
background: $spacegrey;
height: 20px;
-webkit-user-select: none;
-webkit-app-region: drag;
}
.content {
padding: 20px 40px;
}
.progressContainer {
color: $white;
text-align: center;
margin-top: 20%;
h1 {
margin-bottom: 20px;
}
.progressBar {
width: 75%;
max-width: 700px;
margin: 0 auto;
height: 10px;
border-radius: 5px;
background: $spaceborder;
}
.progress {
background: $gold;
background: #DEA326;
height: 10px;
border-radius: 5px;
transition: all 0.25s;
}
h4 {
color: $gold;
margin-top: 10px;
}
}

7
app/containers/Root.js

@ -5,7 +5,7 @@ import { ConnectedRouter } from 'react-router-redux'
import PropTypes from 'prop-types'
import LoadingBolt from '../components/LoadingBolt'
import LndSyncing from '../components/LndSyncing'
import Syncing from '../components/Onboarding/Syncing'
import { fetchBlockHeight, lndSelectors } from '../reducers/lnd'
import { newAddress } from '../reducers/address'
import Routes from '../routes'
@ -32,9 +32,10 @@ const Root = ({
address
}) => {
// If we are syncing show the syncing screen
if (lnd.syncing) {
// if (lnd.syncing) {
if (true) {
return (
<LndSyncing
<Syncing
newAddress={newAddress}
fetchBlockHeight={fetchBlockHeight}
syncPercentage={syncPercentage}

1
app/variables.scss

@ -13,6 +13,7 @@ $spacegrey: #222E2B;
$spaceblue: #252832;
$spaceborder: #404040;
$gold: #DEA326;
$green: #0bb634;
$terminalgreen: #00FF00;
$red: #FF556A;

Loading…
Cancel
Save