From eb27d6a0f38be424656900502052da943a11c2bf Mon Sep 17 00:00:00 2001 From: George Lima Date: Wed, 2 Jan 2019 16:18:35 -0300 Subject: [PATCH] feature: add layout styles to console view --- app/views/console.js | 58 ++++++++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 18 deletions(-) diff --git a/app/views/console.js b/app/views/console.js index 9435f5d..4b4ccfc 100644 --- a/app/views/console.js +++ b/app/views/console.js @@ -5,12 +5,37 @@ import React, { Component, Fragment } from 'react'; import { ipcRenderer } from 'electron'; import styled from 'styled-components'; import generateRandomString from '../utils/generate-random-string'; +import { TextComponent } from '../components/text'; + +import ConsoleSymbol from '../assets/images/console_zcash.svg'; const Wrapper = styled.div` max-height: 100%; overflow-y: auto; + background-color: ${props => props.theme.colors.cardBackgroundColor}; + margin-top: ${props => props.theme.layoutContentPaddingTop}; + border-radius: ${props => props.theme.boxBorderRadius}; + padding: 38px 33.5px; `; +const ConsoleText = styled(TextComponent)` + font-family: 'Source Code Pro', monospace; +`; + +const ConsoleImg = styled.img` + height: 200px; + width: auto; +`; + +const initialLog = ` + Thank you for running a Zcash node! + You're helping to strengthen the network and contributing to a social good :) + + In order to ensure you are adequately protecting your privacy when using Zcash, please see . +`; + +const breakpoints = [1, 4, 7, 10, 13]; + type Props = {}; type State = { @@ -18,22 +43,13 @@ type State = { }; export class ConsoleView extends Component { - scrollView = React.createRef(); - state = { log: '', }; componentDidMount() { ipcRenderer.on('zcashd-log', (event, message) => { - this.setState(state => ({ - log: `${state.log}\n${message}`, - })); - - if (this.scrollView && this.scrollView.current) { - // eslint-disable-next-line - this.scrollView.current.scrollTop = this.scrollView.current.scrollHeight; - } + this.setState(() => ({ log: initialLog + message })); }); } @@ -41,14 +57,20 @@ export class ConsoleView extends Component { const { log } = this.state; return ( - - {log - && log.split('\n').map(item => ( - - {item} -
-
- ))} + + {log ? ( + + + {log.split('\n').map((item, idx) => ( + + + {breakpoints.includes(idx) ?
: null} +
+ ))} +
+ ) : ( + + )}
); }