From 4b3a56048b8aadb8e4a8f1f737297dd9df6371f9 Mon Sep 17 00:00:00 2001 From: Jack Mallers Date: Sun, 6 Aug 2017 13:18:06 -0500 Subject: [PATCH] feature(peers): design peers list --- app/routes/wallet/components/Wallet.js | 28 ++++----- app/routes/wallet/components/Wallet.scss | 1 - .../components/Channels/Channels.js | 2 +- .../Channels/components/Channel/Channel.scss | 5 ++ .../components/ChannelForm/ChannelForm.js | 60 +++++++++---------- .../components/components/Peers/Peers.js | 35 +++++++++++ .../components/components/Peers/Peers.scss | 45 ++++++++++++++ .../components/Peers/components/Peer/Peer.js | 19 ++++++ .../Peers/components/Peer/Peer.scss | 34 +++++++++++ .../components/Peers/components/Peer/index.js | 3 + .../components/components/Peers/index.js | 3 + resources/check.svg | 6 ++ 12 files changed, 195 insertions(+), 46 deletions(-) create mode 100644 app/routes/wallet/components/components/Peers/Peers.js create mode 100644 app/routes/wallet/components/components/Peers/Peers.scss create mode 100644 app/routes/wallet/components/components/Peers/components/Peer/Peer.js create mode 100644 app/routes/wallet/components/components/Peers/components/Peer/Peer.scss create mode 100644 app/routes/wallet/components/components/Peers/components/Peer/index.js create mode 100644 app/routes/wallet/components/components/Peers/index.js create mode 100644 resources/check.svg diff --git a/app/routes/wallet/components/Wallet.js b/app/routes/wallet/components/Wallet.js index 64080883..1e6c5f94 100644 --- a/app/routes/wallet/components/Wallet.js +++ b/app/routes/wallet/components/Wallet.js @@ -2,6 +2,7 @@ import React, { Component } from 'react' import ReactSVG from 'react-svg' import { FaCircle } from 'react-icons/lib/fa' +import Peers from './components/peers' import Channels from './components/channels' import styles from './Wallet.scss' @@ -31,20 +32,19 @@ class Wallet extends Component {

{info.data.identity_pubkey}

-
-

Connected Peers

-
    -
-
- + +
) diff --git a/app/routes/wallet/components/Wallet.scss b/app/routes/wallet/components/Wallet.scss index f4cfb99d..a44199c9 100644 --- a/app/routes/wallet/components/Wallet.scss +++ b/app/routes/wallet/components/Wallet.scss @@ -2,7 +2,6 @@ .wallet { background: $lightgrey; - height: 100vh; } .header { diff --git a/app/routes/wallet/components/components/Channels/Channels.js b/app/routes/wallet/components/components/Channels/Channels.js index 5aa3c891..b70cc397 100644 --- a/app/routes/wallet/components/components/Channels/Channels.js +++ b/app/routes/wallet/components/components/Channels/Channels.js @@ -25,7 +25,7 @@ class Channels extends Component {

Channels

setForm(true)} > diff --git a/app/routes/wallet/components/components/Channels/components/Channel/Channel.scss b/app/routes/wallet/components/components/Channels/components/Channel/Channel.scss index c6ddce2b..56e45399 100644 --- a/app/routes/wallet/components/components/Channels/components/Channel/Channel.scss +++ b/app/routes/wallet/components/components/Channels/components/Channel/Channel.scss @@ -9,6 +9,11 @@ justify-content: space-between; border-top: 1px solid $black; cursor: pointer; + transition: all 0.25s; + + &:hover { + opacity: 0.75; + } &:first-child { border: none; diff --git a/app/routes/wallet/components/components/Channels/components/ChannelForm/ChannelForm.js b/app/routes/wallet/components/components/Channels/components/ChannelForm/ChannelForm.js index a3ec6b0a..cc7f7307 100644 --- a/app/routes/wallet/components/components/Channels/components/ChannelForm/ChannelForm.js +++ b/app/routes/wallet/components/components/Channels/components/ChannelForm/ChannelForm.js @@ -25,49 +25,49 @@ class ChannelForm extends Component { return (
setForm(false)} - parentSelector={() => document.body} - style={customStyles} - > -
-

Open a new channel

- -
- - setForm(false)} + parentSelector={() => document.body} + style={customStyles} + > +
+

Open a new channel

+ +
+ + -
-
- - +
+ + -
-
- - +
+ + -
+
-
-
- Submit -
-
-
- +
+
+ Submit +
+
+
+
) } diff --git a/app/routes/wallet/components/components/Peers/Peers.js b/app/routes/wallet/components/components/Peers/Peers.js new file mode 100644 index 00000000..a6693c59 --- /dev/null +++ b/app/routes/wallet/components/components/Peers/Peers.js @@ -0,0 +1,35 @@ +// @flow +import React, { Component } from 'react' +import { TiPlus } from 'react-icons/lib/ti' +import Peer from './components/Peer' +import styles from './Peers.scss' + +class Peers extends Component { + render() { + const { peersLoading, peers } = this.props + return ( +
+
+

Peers

+
+ +
+
+
    + { + !peersLoading && peers.length ? + peers.map(peer => ) + : + 'Loading...' + } +
+
+ ) + } +} + + +export default Peers \ No newline at end of file diff --git a/app/routes/wallet/components/components/Peers/Peers.scss b/app/routes/wallet/components/components/Peers/Peers.scss new file mode 100644 index 00000000..140014b3 --- /dev/null +++ b/app/routes/wallet/components/components/Peers/Peers.scss @@ -0,0 +1,45 @@ +@import '../../../../../variables.scss'; + +.peers { + width: 75%; + margin: 50px auto; + + .header { + margin-bottom: 10px; + + h3, .connectPeer { + display: inline-block; + } + + h3 { + text-align: left; + } + + .connectPeer { + float: right; + cursor: pointer; + + svg { + padding: 3px; + border-radius: 50%; + border: 1px solid $main; + color: $main; + transition: all 0.25s; + + &:hover { + border-color: darken($main, 10%); + color: darken($main, 10%); + } + } + } + } + + h3 { + text-transform: uppercase; + color: $darkestgrey; + letter-spacing: 1.6px; + font-size: 14px; + font-weight: 400; + margin-bottom: 10px; + } +} \ No newline at end of file diff --git a/app/routes/wallet/components/components/Peers/components/Peer/Peer.js b/app/routes/wallet/components/components/Peers/components/Peer/Peer.js new file mode 100644 index 00000000..b6f6aea5 --- /dev/null +++ b/app/routes/wallet/components/components/Peers/components/Peer/Peer.js @@ -0,0 +1,19 @@ +// @flow +import React, { Component } from 'react' +import styles from './Peer.scss' + +class Peer extends Component { + render() { + const { peer } = this.props + console.log('peer: ', peer) + return ( +
  • +

    {peer.address}

    +

    {peer.pub_key}

    +
  • + ) + } +} + + +export default Peer \ No newline at end of file diff --git a/app/routes/wallet/components/components/Peers/components/Peer/Peer.scss b/app/routes/wallet/components/components/Peers/components/Peer/Peer.scss new file mode 100644 index 00000000..7c00390d --- /dev/null +++ b/app/routes/wallet/components/components/Peers/components/Peer/Peer.scss @@ -0,0 +1,34 @@ +@import '../../../../../../../variables.scss'; + +.peer { + position: relative; + background: $white; + padding: 10px; + border-top: 1px solid $grey; + cursor: pointer; + transition: all 0.25s; + + &:hover { + opacity: 0.75; + } + + &:first-child { + border: none; + } + + h4, h1 { + margin: 10px 0; + } + + h4 { + font-size: 14px; + font-weight: bold; + color: $black; + } + + h1 { + font-size: 18px; + font-weight: 200; + color: $main; + } +} \ No newline at end of file diff --git a/app/routes/wallet/components/components/Peers/components/Peer/index.js b/app/routes/wallet/components/components/Peers/components/Peer/index.js new file mode 100644 index 00000000..43235535 --- /dev/null +++ b/app/routes/wallet/components/components/Peers/components/Peer/index.js @@ -0,0 +1,3 @@ +import Peer from './Peer' + +export default Peer \ No newline at end of file diff --git a/app/routes/wallet/components/components/Peers/index.js b/app/routes/wallet/components/components/Peers/index.js new file mode 100644 index 00000000..0508d80c --- /dev/null +++ b/app/routes/wallet/components/components/Peers/index.js @@ -0,0 +1,3 @@ +import Peers from './Peers' + +export default Peers \ No newline at end of file diff --git a/resources/check.svg b/resources/check.svg new file mode 100644 index 00000000..4630a65e --- /dev/null +++ b/resources/check.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file