Jack Mallers
7 years ago
10 changed files with 184 additions and 28 deletions
@ -0,0 +1,14 @@ |
|||
import React from 'react' |
|||
import styles from './LndSyncing.scss' |
|||
|
|||
const LndSyncing = ({ lines }) => ( |
|||
<div className={styles.container}> |
|||
<h3>zap</h3> |
|||
<div className={styles.loading}> |
|||
<div className={styles.spinner}></div> |
|||
<h1>syncing your lightning node to the blockchain</h1> |
|||
</div> |
|||
</div> |
|||
) |
|||
|
|||
export default LndSyncing |
@ -0,0 +1,61 @@ |
|||
@import '../../variables.scss'; |
|||
|
|||
.container { |
|||
height: 100vh; |
|||
padding: 100px; |
|||
|
|||
h3 { |
|||
font-size: 50px; |
|||
} |
|||
|
|||
.loading { |
|||
text-align: center; |
|||
margin-top: 100px; |
|||
|
|||
h1 { |
|||
margin-top: 25px; |
|||
} |
|||
} |
|||
} |
|||
|
|||
.spinner { |
|||
border: 1px solid rgba(0, 0, 0, 0.1); |
|||
border-left-color: rgba(0, 0, 0, 0.4); |
|||
-webkit-border-radius: 999px; |
|||
-moz-border-radius: 999px; |
|||
border-radius: 999px; |
|||
} |
|||
|
|||
.spinner { |
|||
margin: 0 auto; |
|||
height: 100px; |
|||
width: 100px; |
|||
-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); |
|||
} |
|||
} |
@ -0,0 +1,3 @@ |
|||
import LndSyncing from './LndSyncing' |
|||
|
|||
export default LndSyncing |
@ -0,0 +1,54 @@ |
|||
import { fetchTicker } from './ticker' |
|||
import { fetchBalance } from './balance' |
|||
import { fetchInfo } from './info' |
|||
// ------------------------------------
|
|||
// Constants
|
|||
// ------------------------------------
|
|||
export const START_SYNCING = 'START_SYNCING' |
|||
export const STOP_SYNCING = 'STOP_SYNCING' |
|||
|
|||
export const RECEIVE_LINE = 'RECEIVE_LINE' |
|||
|
|||
// ------------------------------------
|
|||
// Actions
|
|||
// ------------------------------------
|
|||
|
|||
// Receive IPC event for LND starting its syncing process
|
|||
export const lndSyncing = () => dispatch => dispatch({ type: START_SYNCING }) |
|||
|
|||
// Receive IPC event for LND stoping sync
|
|||
export const lndSynced = () => dispatch => { |
|||
// Fetch data now that we know LND is synced
|
|||
fetchTicker() |
|||
fetchBalance() |
|||
fetchInfo() |
|||
|
|||
dispatch({ type: STOP_SYNCING }) |
|||
} |
|||
|
|||
// Receive IPC event for LND streaming a line
|
|||
export const lndStdout = (event, line) => dispatch => dispatch({ type: RECEIVE_LINE, line }) |
|||
|
|||
// ------------------------------------
|
|||
// Action Handlers
|
|||
// ------------------------------------
|
|||
const ACTION_HANDLERS = { |
|||
[START_SYNCING]: state => ({ ...state, syncing: true }), |
|||
[STOP_SYNCING]: state => ({ ...state, syncing: false }), |
|||
|
|||
[RECEIVE_LINE]: (state, { line }) => ({ ...state, lines: [...state.lines, line] }), |
|||
} |
|||
|
|||
// ------------------------------------
|
|||
// Reducer
|
|||
// ------------------------------------
|
|||
const initialState = { |
|||
syncing: false, |
|||
lines: [] |
|||
} |
|||
|
|||
export default function lndReducer(state = initialState, action) { |
|||
const handler = ACTION_HANDLERS[action.type] |
|||
|
|||
return handler ? handler(state, action) : state |
|||
} |
@ -1 +1,11 @@ |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Loading…
Reference in new issue