13 changed files with 354 additions and 18 deletions
@ -0,0 +1,50 @@ |
|||
import { callApi } from '../api' |
|||
// ------------------------------------
|
|||
// Constants
|
|||
// ------------------------------------
|
|||
export const GET_CHANNELS = 'GET_CHANNELS' |
|||
export const RECEIVE_CHANNELS = 'RECEIVE_CHANNELS' |
|||
|
|||
// ------------------------------------
|
|||
// Actions
|
|||
// ------------------------------------
|
|||
export function getChannels() { |
|||
return { |
|||
type: GET_CHANNELS |
|||
} |
|||
} |
|||
|
|||
export function receiveChannels({ channels }) { |
|||
return { |
|||
type: RECEIVE_CHANNELS, |
|||
channels |
|||
} |
|||
} |
|||
|
|||
export const fetchChannels = () => async (dispatch) => { |
|||
dispatch(getChannels()) |
|||
const channels = await callApi('channels') |
|||
dispatch(receiveChannels(channels.data)) |
|||
} |
|||
|
|||
// ------------------------------------
|
|||
// Action Handlers
|
|||
// ------------------------------------
|
|||
const ACTION_HANDLERS = { |
|||
[GET_CHANNELS]: (state) => ({ ...state, channelsLoading: true }), |
|||
[RECEIVE_CHANNELS]: (state, { channels }) => ({ ...state, channelsLoading: false, channels }) |
|||
} |
|||
|
|||
// ------------------------------------
|
|||
// Reducer
|
|||
// ------------------------------------
|
|||
const initialState = { |
|||
channelsLoading: false, |
|||
channels: [] |
|||
} |
|||
|
|||
export default function channelsReducer(state = initialState, action) { |
|||
const handler = ACTION_HANDLERS[action.type] |
|||
|
|||
return handler ? handler(state, action) : state |
|||
} |
@ -0,0 +1,112 @@ |
|||
@import '../../../variables.scss'; |
|||
|
|||
.wallet { |
|||
background: $lightgrey; |
|||
height: 100vh; |
|||
} |
|||
|
|||
.header { |
|||
background: $white; |
|||
padding: 80px 30px; |
|||
text-align: center; |
|||
border-bottom: 1px solid $darkgrey; |
|||
|
|||
svg { |
|||
width: 100px; |
|||
height: 100px; |
|||
} |
|||
|
|||
h1 { |
|||
color: $black; |
|||
font-size: 20px; |
|||
margin: 20px 0; |
|||
} |
|||
} |
|||
|
|||
.walletData { |
|||
padding: 60px 40px; |
|||
|
|||
.peers, .channels { |
|||
width: 75%; |
|||
margin: 50px auto; |
|||
|
|||
h3 { |
|||
text-transform: uppercase; |
|||
color: $darkestgrey; |
|||
letter-spacing: 1.6px; |
|||
font-size: 14px; |
|||
font-weight: 400; |
|||
margin-bottom: 10px; |
|||
} |
|||
} |
|||
} |
|||
|
|||
.channel { |
|||
position: relative; |
|||
background: $white; |
|||
padding: 10px; |
|||
display: flex; |
|||
flex-direction: row; |
|||
justify-content: space-between; |
|||
|
|||
.left, .right { |
|||
padding: 0 10px; |
|||
margin-bottom: 5; |
|||
|
|||
section { |
|||
margin-bottom: 20px; |
|||
|
|||
span { |
|||
text-transform: uppercase; |
|||
letter-spacing: 1.6px; |
|||
color: $black; |
|||
font-size: 10px; |
|||
font-weight: bold; |
|||
} |
|||
|
|||
h2 { |
|||
font-size: 30px; |
|||
padding: 5px 0; |
|||
color: $main; |
|||
} |
|||
|
|||
h4 { |
|||
margin-top: 5px; |
|||
} |
|||
} |
|||
} |
|||
|
|||
.left { |
|||
flex: 7; |
|||
border-right: 1px solid $grey; |
|||
} |
|||
|
|||
.right { |
|||
flex: 3; |
|||
|
|||
.capacity { |
|||
text-align: center; |
|||
border-bottom: 1px solid $grey; |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
.balances { |
|||
display: flex; |
|||
justify-content: space-between; |
|||
|
|||
section { |
|||
flex: 5; |
|||
text-align: center; |
|||
|
|||
h4 { |
|||
color: $main; |
|||
font-size: 20px; |
|||
} |
|||
|
|||
&:first-child { |
|||
border-right: 1px solid $grey; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
@ -1,8 +1,19 @@ |
|||
import { connect } from 'react-redux' |
|||
import { fetchInfo } from '../../../reducers/info' |
|||
import { fetchPeers } from '../../../reducers/peers' |
|||
import { fetchChannels } from '../../../reducers/channels' |
|||
import Wallet from '../components/Wallet' |
|||
|
|||
const mapDispatchToProps = {} |
|||
const mapDispatchToProps = { |
|||
fetchInfo, |
|||
fetchPeers, |
|||
fetchChannels |
|||
} |
|||
|
|||
const mapStateToProps = (state) => ({}) |
|||
const mapStateToProps = (state) => ({ |
|||
info: state.info, |
|||
peers: state.peers, |
|||
channels: state.channels |
|||
}) |
|||
|
|||
export default connect(mapStateToProps, mapDispatchToProps)(Wallet) |
Loading…
Reference in new issue