Browse Source

Merge pull request #89 from LN-Zap/fix/activity-modals

Fix/activity modals
renovate/lint-staged-8.x
JimmyMow 7 years ago
committed by GitHub
parent
commit
ae44096627
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      .gitignore
  2. 48
      app/routes/activity/components/components/Modal/Invoice/Invoice.js
  3. 79
      app/routes/activity/components/components/Modal/Invoice/Invoice.scss
  4. 13
      app/routes/activity/components/components/Modal/Modal.js
  5. 13
      app/routes/activity/components/components/Modal/Modal.scss
  6. 33
      app/routes/activity/components/components/Modal/Payment/Payment.js
  7. 48
      app/routes/activity/components/components/Modal/Payment/Payment.scss
  8. 54
      app/routes/activity/components/components/Modal/Transaction/Transaction.js
  9. 53
      app/routes/activity/components/components/Modal/Transaction/Transaction.scss

3
.gitignore

@ -50,3 +50,6 @@ main.js.map
.idea .idea
npm-debug.log.* npm-debug.log.*
# lnd binary
resources/bin/*

48
app/routes/activity/components/components/Modal/Invoice/Invoice.js

@ -7,6 +7,7 @@ import 'moment-timezone'
import QRCode from 'qrcode.react' import QRCode from 'qrcode.react'
import { MdCheck } from 'react-icons/lib/md' import { MdCheck } from 'react-icons/lib/md'
import { FaCircle } from 'react-icons/lib/fa'
import CurrencyIcon from 'components/CurrencyIcon' import CurrencyIcon from 'components/CurrencyIcon'
import { btc } from 'utils' import { btc } from 'utils'
@ -16,20 +17,33 @@ import styles from './Invoice.scss'
const Invoice = ({ invoice, ticker, currentTicker }) => ( const Invoice = ({ invoice, ticker, currentTicker }) => (
<div className={styles.container}> <div className={styles.container}>
<h3>{invoice.memo}</h3> <div className={styles.settled}>
<h1> {
<CurrencyIcon currency={ticker.currency} crypto={ticker.crypto} styles={{ verticalAlign: 'top' }} /> !invoice.settled &&
<span className={styles.value}> <p>
{ <FaCircle />
ticker.currency === 'usd' ? <span>Not Paid</span>
btc.satoshisToUsd(invoice.value, currentTicker.price_usd) </p>
: }
btc.satoshisToBtc(invoice.value) </div>
} <header>
</span> <h3>{invoice.memo}</h3>
</h1> <h1>
<span className={styles.value}>
{
ticker.currency === 'usd' ?
btc.satoshisToUsd(invoice.value, currentTicker.price_usd)
:
btc.satoshisToBtc(invoice.value)
}
</span>
<i>BTC</i>
</h1>
</header>
<div className={styles.qrcode}> <div className={styles.qrcode}>
<QRCode value={invoice.payment_request} size={200} /> <QRCode value={invoice.payment_request} size={150} />
</div>
<div className={styles.input}>
<input <input
readOnly readOnly
className={styles.paymentRequest} className={styles.paymentRequest}
@ -37,14 +51,6 @@ const Invoice = ({ invoice, ticker, currentTicker }) => (
defaultValue={invoice.payment_request} defaultValue={invoice.payment_request}
/> />
</div> </div>
<div className={styles.settled}>
{
invoice.settled ?
<p><MdCheck style={{ verticalAlign: 'top' }} /> Paid</p>
:
<p>Not Paid</p>
}
</div>
<p className={styles.date}> <p className={styles.date}>
Created on Created on
<Moment format='MMM Do'>{invoice.creation_date * 1000}</Moment> <Moment format='MMM Do'>{invoice.creation_date * 1000}</Moment>

79
app/routes/activity/components/components/Modal/Invoice/Invoice.scss

@ -1,72 +1,75 @@
@import '../../../../../../variables.scss'; @import '../../../../../../variables.scss';
.container { .container {
padding: 40px; .settled {
position: absolute;
top: 0;
padding: 10px 0 10px 40px;
color: $darkestgrey;
svg {
line-height: 20px;
font-size: 10px;
vertical-align: middle;
}
span {
font-size: 12px;
margin-left: 5px;
}
}
header {
background: $lightgrey;
padding-bottom: 20px;
}
h3 { h3 {
font-size: 24px; font-size: 20px;
color: $black; color: $black;
font-weight: bold; font-weight: bold;
text-align: center; padding: 10px 40px;
margin-bottom: 10px;
} }
h1 { h1 {
text-align: center;
color: $main; color: $main;
margin: 20px 20px 60px 0; padding: 10px 40px;
svg { .value {
font-size: 30px; font-size: 30px;
vertical-align: top;
} }
span svg[data-icon='ltc'] { i {
width: 30px; margin-left: 2px;
height: 30px;
vertical-align: top; vertical-align: top;
g {
transform: scale(1.75) translate(-5px, -5px);
}
}
.value {
font-size: 60px;
} }
} }
.qrcode { .qrcode {
text-align: center; text-align: center;
margin-top: 40px;
}
.input {
padding: 10px 40px;
.paymentRequest { .paymentRequest {
text-align: center; text-align: center;
font-size: 0.5vw; font-size: 12px;
margin-top: 20px; padding: 15px;
padding: 5px;
border-radius: 5px;
background: $lightgrey; background: $lightgrey;
border: 1px solid $darkgrey; border: 1px solid transparent;
display: block; display: block;
width: 100%; width: 90%;
} margin: 20px auto 0 auto;
}
.settled {
text-align: center;
color: $main;
text-transform: uppercase;
font-size: 20px;
margin: 30px 0;
font-weight: bold;
svg {
line-height: 20px;
} }
} }
.date { .date {
text-align: center; text-align: center;
padding-bottom: 40px;
margin-top: 20px;
time { time {
margin-left: 3px; margin-left: 3px;

13
app/routes/activity/components/components/Modal/Modal.js

@ -6,6 +6,10 @@ import Transaction from './Transaction'
import Payment from './Payment' import Payment from './Payment'
import Invoice from './Invoice' import Invoice from './Invoice'
import { MdClose } from 'react-icons/lib/md'
import styles from './Modal.scss'
const Modal = ({ modalType, modalProps, hideActivityModal, ticker, currentTicker }) => { const Modal = ({ modalType, modalProps, hideActivityModal, ticker, currentTicker }) => {
const MODAL_COMPONENTS = { const MODAL_COMPONENTS = {
TRANSACTION: Transaction, TRANSACTION: Transaction,
@ -23,7 +27,9 @@ const Modal = ({ modalType, modalProps, hideActivityModal, ticker, currentTicker
right: '0', right: '0',
bottom: 'auto', bottom: 'auto',
width: '40%', width: '40%',
margin: '50px auto' margin: '50px auto',
borderRadius: 'none',
padding: '0'
} }
} }
@ -41,6 +47,11 @@ const Modal = ({ modalType, modalProps, hideActivityModal, ticker, currentTicker
parentSelector={() => document.body} parentSelector={() => document.body}
style={customStyles} style={customStyles}
> >
<div className={styles.closeContainer}>
<span onClick={() => hideActivityModal()}>
<MdClose />
</span>
</div>
<SpecificModal {...modalProps} ticker={ticker} currentTicker={currentTicker} /> <SpecificModal {...modalProps} ticker={ticker} currentTicker={currentTicker} />
</ReactModal> </ReactModal>
) )

13
app/routes/activity/components/components/Modal/Modal.scss

@ -0,0 +1,13 @@
@import '../../../../../variables.scss';
.closeContainer {
background: $lightgrey;
text-align: right;
padding: 10px;
span {
color: $darkestgrey;
font-size: 20px;
cursor: pointer;
}
}

33
app/routes/activity/components/components/Modal/Payment/Payment.js

@ -12,21 +12,30 @@ import styles from './Payment.scss'
const Payment = ({ payment, ticker, currentTicker }) => ( const Payment = ({ payment, ticker, currentTicker }) => (
<div className={styles.container}> <div className={styles.container}>
<h3>{payment.payment_hash}</h3> <header>
<h1> <div className={styles.title}>
<CurrencyIcon currency={ticker.currency} crypto={ticker.crypto} styles={{ verticalAlign: 'top' }} /> <h2>Sent</h2>
<span className={styles.value}> <h1>
{ <span className={styles.value}>
ticker.currency === 'usd' ? {
btc.satoshisToUsd(payment.value, currentTicker.price_usd) ticker.currency === 'usd' ?
: btc.satoshisToUsd(payment.value, currentTicker.price_usd)
btc.satoshisToBtc(payment.value) :
} btc.satoshisToBtc(payment.value)
</span> }
</h1> </span>
<i>
BTC
</i>
</h1>
</div>
<h3>{payment.payment_hash}</h3>
</header>
<dl> <dl>
<dt>Fee</dt> <dt>Fee</dt>
<dd>{payment.fee}</dd> <dd>{payment.fee}</dd>
<dt>Hops</dt>
<dd>{payment.path.length}</dd>
<dt>Date</dt> <dt>Date</dt>
<dd> <dd>
<Moment format='MMM Do'>{payment.creation_date * 1000}</Moment> <Moment format='MMM Do'>{payment.creation_date * 1000}</Moment>

48
app/routes/activity/components/components/Modal/Payment/Payment.scss

@ -1,38 +1,44 @@
@import '../../../../../../variables.scss'; @import '../../../../../../variables.scss';
.container { .container {
padding: 40px; header {
padding: 5px 40px 20px 40px;
background: $lightgrey;
.title {
display: flex;
flex-direction: row;
margin-bottom: 30px;
h2 {
text-transform: uppercase;
font-size: 24px;
margin-right: 10px;
}
}
}
h1 { h1 {
text-align: center;
color: $main; color: $main;
margin: 60px 30px 60px 0;
svg { .value {
font-size: 30px; font-size: 24px;
vertical-align: top;
} }
span svg[data-icon='ltc'] { i {
width: 30px; margin-left: 2px;
height: 30px;
vertical-align: top; vertical-align: top;
g {
transform: scale(1.75) translate(-5px, -5px);
}
}
.value {
font-size: 80px;
} }
} }
h3 { h3 {
font-size: 14px; font-size: 14px;
text-align: center; text-align: center;
color: $black; color: $darkestgrey;
font-weight: bold; }
dl {
padding: 40px 40px 40px 40px;
} }
dt { dt {
@ -48,8 +54,8 @@
dd { dd {
text-align: right; text-align: right;
font-weight: 400; font-weight: 400;
padding: 19px 0; padding: 30px 0 10px 0;
margin-left: 0; margin-left: 0;
border-top: 1px solid $darkgrey; border-bottom: 1px solid $darkgrey;
} }
} }

54
app/routes/activity/components/components/Modal/Transaction/Transaction.js

@ -1,3 +1,4 @@
import { shell } from 'electron'
import React from 'react' import React from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
@ -12,31 +13,42 @@ import styles from './Transaction.scss'
const Transaction = ({ transaction, ticker, currentTicker }) => ( const Transaction = ({ transaction, ticker, currentTicker }) => (
<div className={styles.container}> <div className={styles.container}>
<h2> <header>
{ <div className={styles.title}>
transaction.amount < 0 ? <h2>
'Sent' {
: transaction.amount < 0 ?
'Received' 'Sent'
} :
</h2> 'Received'
<h3>{transaction.tx_hash}</h3> }
<h1> </h2>
<CurrencyIcon currency={ticker.currency} crypto={ticker.crypto} styles={{ verticalAlign: 'top' }} /> <h1>
<span className={styles.value}> <span className={styles.value}>
{ {
ticker.currency === 'usd' ? ticker.currency === 'usd' ?
btc.satoshisToUsd(transaction.amount, currentTicker.price_usd) btc.satoshisToUsd(transaction.amount, currentTicker.price_usd)
: :
btc.satoshisToBtc(transaction.amount) btc.satoshisToBtc(transaction.amount)
} }
</span> </span>
</h1> <i>BTC</i>
</h1>
</div>
<h3 onClick={() => shell.openExternal(`https://testnet.smartbit.com.au/tx/${transaction.tx_hash}`)}>{transaction.tx_hash}</h3>
</header>
<dl> <dl>
<dt>Confirmations</dt> <dt>Confirmations</dt>
<dd>{transaction.num_confirmations}</dd> <dd>{transaction.num_confirmations}</dd>
<dt>Fee</dt> <dt>Fee</dt>
<dd>{transaction.total_fees}</dd> <dd>
{
ticker.currency === 'usd' ?
btc.satoshisToUsd(transaction.total_fees)
:
btc.satoshisToBtc(transaction.total_fees)
}
</dd>
<dt>Date</dt> <dt>Date</dt>
<dd> <dd>
<Moment format='MMM Do'>{transaction.time_stamp * 1000}</Moment> <Moment format='MMM Do'>{transaction.time_stamp * 1000}</Moment>

53
app/routes/activity/components/components/Modal/Transaction/Transaction.scss

@ -1,48 +1,57 @@
@import '../../../../../../variables.scss'; @import '../../../../../../variables.scss';
.container { .container {
padding: 40px; header {
padding: 5px 40px 20px 40px;
background: $lightgrey;
.title {
display: flex;
flex-direction: row;
h2 {
text-transform: uppercase;
}
}
}
h1 { h1 {
text-align: center; text-align: center;
color: $main; color: $main;
margin: 60px 30px 60px 0;
svg { .value {
font-size: 30px; font-size: 24px;
vertical-align: top;
} }
span svg[data-icon='ltc'] { i {
width: 30px; margin-left: 2px;
height: 30px;
vertical-align: top; vertical-align: top;
g {
transform: scale(1.75) translate(-5px, -5px);
}
}
.value {
font-size: 75px;
} }
} }
h3 { h3 {
font-size: 14px; font-size: 14px;
text-align: center; text-align: center;
color: $black; color: $darkestgrey;
font-weight: bold; cursor: pointer;
&:hover {
text-decoration: underline;
}
} }
h2 { h2 {
text-align: center; text-align: center;
margin-right: 10px;
margin-bottom: 30px; margin-bottom: 30px;
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 1.5px;
font-size: 24px; font-size: 24px;
} }
dl {
padding: 40px 40px 40px 40px;
}
dt { dt {
text-align: left; text-align: left;
float: left; float: left;
@ -56,8 +65,8 @@
dd { dd {
text-align: right; text-align: right;
font-weight: 400; font-weight: 400;
padding: 19px 0; padding: 30px 0 10px 0;
margin-left: 0; margin-left: 0;
border-top: 1px solid $darkgrey; border-bottom: 1px solid $darkgrey;
} }
} }

Loading…
Cancel
Save