Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
55 changed files
with
1,870 additions
and
648 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import Modal from "../Modal"; | ||
import { FormattedMessage as T } from "react-intl"; | ||
import { Message } from "pi-ui"; | ||
import styles from "./LNPaymentModal.module.css"; | ||
import { Balance, LNPaymentStatus, DetailsTable, CopyableText } from "shared"; | ||
import { getPaymentDetails } from "./helpers"; | ||
|
||
const LNPaymentModal = ({ show, onCancelModal, tsDate, payment }) => ( | ||
<Modal className={styles.modal} {...{ show, onCancelModal }}> | ||
<div | ||
className={styles.closeButton} | ||
onClick={onCancelModal} | ||
data-testid="lnpayment-close-button" | ||
/> | ||
<div className={styles.title}> | ||
<T id="ln.paymentModal.title" m="Lightning Payment" /> | ||
</div> | ||
<div className={styles.dataGrid}> | ||
<label> | ||
<T id="ln.paymentModal.sentAmount" m="Sent Amount" /> | ||
</label> | ||
<label> | ||
<T id="ln.paymentModal.status" m="Status" /> | ||
</label> | ||
<label> | ||
<T id="ln.paymentModal.date" m="Date" /> | ||
</label> | ||
<label> | ||
<T id="ln.paymentModal.fee" m="Fee" /> | ||
</label> | ||
<Balance amount={payment?.valueAtoms} classNameWrapper={styles.amount} /> | ||
<div className={styles.status}> | ||
<LNPaymentStatus status={payment?.status} /> | ||
</div> | ||
<div className={styles.date}> | ||
<T | ||
id="ln.paymentModal.creationDate" | ||
m="{creationDate, date, medium} {creationDate, time, short}" | ||
values={{ creationDate: tsDate(payment?.creationDate) }} | ||
/> | ||
</div> | ||
<Balance amount={payment?.fee} classNameWrapper={styles.amount} /> | ||
</div> | ||
{payment?.paymentRequest && ( | ||
<> | ||
<div className={styles.requestCodeLabel}> | ||
<T | ||
id="ln.paymentModal.requestCodeLabel" | ||
m="Lightning Payment Request Code" | ||
/> | ||
</div> | ||
<CopyableText | ||
tooltipPlacement="top" | ||
id="paymentRequest" | ||
truncate={false}> | ||
{payment.paymentRequest} | ||
</CopyableText> | ||
</> | ||
)} | ||
{payment.paymentError && ( | ||
<Message kind="error">{payment.paymentError}</Message> | ||
)} | ||
<DetailsTable | ||
data={getPaymentDetails(payment, tsDate)} | ||
className={styles.details} | ||
title={<T id="ln.paymentModal.details" m="Details" />} | ||
expandable | ||
/> | ||
</Modal> | ||
); | ||
export default LNPaymentModal; |
96 changes: 96 additions & 0 deletions
96
app/components/modals/LNPaymentModal/LNPaymentModal.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
.modal { | ||
background-image: none; | ||
padding: 30px 40px; | ||
width: 764px; | ||
overflow-x: hidden; | ||
position: relative; | ||
margin: 0; | ||
max-height: calc(100% - 130px); | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
.closeButton { | ||
position: absolute; | ||
top: 20px; | ||
right: 20px; | ||
height: 10px; | ||
width: 10px; | ||
background-image: var(--x-grey); | ||
background-size: 10px 10px; | ||
background-repeat: no-repeat; | ||
cursor: pointer; | ||
} | ||
.title { | ||
font-size: 28px; | ||
color: var(--grey-7); | ||
line-height: 35px; | ||
} | ||
.date { | ||
font-size: 13px; | ||
line-height: 16px; | ||
color: var(--main-dark-blue); | ||
} | ||
.dataGrid { | ||
display: grid; | ||
grid-template-columns: 1fr 1fr 1fr 1fr; | ||
font-size: 13px; | ||
line-height: 16px; | ||
color: var(--main-dark-blue); | ||
align-items: center; | ||
grid-row-gap: 5px; | ||
margin: 19px 0 30px 0; | ||
} | ||
.dataGrid label { | ||
color: var(--grey-7); | ||
} | ||
.amount { | ||
font-size: 16px; | ||
line-height: 22px; | ||
} | ||
.requestCodeLabel { | ||
font-size: 13px; | ||
line-height: 16px; | ||
color: var(--grey-7); | ||
margin-bottom: 10px; | ||
} | ||
.paymentRequest { | ||
padding: 0.3rem 1rem; | ||
word-break: break-all; | ||
background-color: var(--copyable-text-background-color); | ||
border-radius: 0.4rem; | ||
color: var(--text-color); | ||
font-size: var(--font-size-normal); | ||
line-height: var(--spacing-2); | ||
} | ||
|
||
.details { | ||
margin: 20px 0 0 0; | ||
} | ||
|
||
@media screen and (max-width: 768px) { | ||
.modal { | ||
width: 355px; | ||
padding: 30px 20px; | ||
} | ||
.title { | ||
font-size: 24px; | ||
} | ||
.dataGrid { | ||
grid-template-columns: 2fr; | ||
} | ||
.dataGrid label { | ||
grid-column: 1; | ||
} | ||
.amount { | ||
grid-column: 2; | ||
grid-row: 1; | ||
} | ||
.status { | ||
grid-column: 2; | ||
grid-row: 2; | ||
} | ||
.date { | ||
grid-column: 2; | ||
grid-row: 3; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import { FormattedMessage as T } from "react-intl"; | ||
import { Balance } from "shared"; | ||
export const getPaymentDetails = (payment) => { | ||
const details = [ | ||
{ | ||
label: <T id="ln.paymentModal.hash" m="Hash" />, | ||
value: payment?.paymentHash, | ||
copyable: true, | ||
truncate: 40 | ||
} | ||
]; | ||
|
||
if (payment?.description) { | ||
details.push({ | ||
label: <T id="ln.paymentModal.desc" m="Description" />, | ||
value: payment.description | ||
}); | ||
} | ||
|
||
if (payment?.destination) { | ||
details.push({ | ||
label: <T id="ln.paymentModal.destination" m="Destination" />, | ||
value: payment.destination, | ||
truncate: 40 | ||
}); | ||
} | ||
|
||
payment?.htlcsList?.forEach((htlc, index) => { | ||
const response = { | ||
label: ( | ||
<> | ||
<T id="ln.paymentModal.htlc" m="HTLC" /> {index} | ||
</> | ||
), | ||
value: [ | ||
{ | ||
label: <T id="ln.paymentModal.htlc.status" m="Status" />, | ||
value: htlc.status | ||
}, | ||
{ | ||
label: <T id="ln.paymentModal.htlc.totalAmt" m="Total Amount" />, | ||
value: <Balance amount={htlc.route.totalAmt} /> | ||
}, | ||
{ | ||
label: <T id="ln.paymentModal.htlc.totalFees" m="Total Fees" />, | ||
value: <Balance amount={htlc.route.totalFees} /> | ||
} | ||
] | ||
}; | ||
// hopList | ||
htlc.route?.hopsList?.forEach((hop, hopIndex) => { | ||
const hopResponse = { | ||
label: ( | ||
<> | ||
<T id="ln.paymentModal.routeHop" m="Hop" /> {hopIndex} | ||
</> | ||
), | ||
value: [ | ||
{ | ||
label: <T id="ln.paymentModal.htlc.hop.fee" m="Fee" />, | ||
value: <Balance amount={hop.fee} /> | ||
}, | ||
{ | ||
label: <T id="ln.paymentModal.htlc.hop.pubkey" m="PubKey" />, | ||
value: hop.pubKey, | ||
copyable: true, | ||
truncate: 20 | ||
} | ||
] | ||
}; | ||
response.value.push(hopResponse); | ||
}); | ||
|
||
details.push(response); | ||
}); | ||
|
||
return details; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from "./LNPaymentModal"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import styles from "./CopyableText.module.css"; | ||
import { CopyableText as PiUiCopyableText, classNames } from "pi-ui"; | ||
|
||
const CopyableText = (props) => ( | ||
<PiUiCopyableText | ||
className={classNames(styles.copyableText, props.className)} | ||
{...props} | ||
/> | ||
); | ||
|
||
export default CopyableText; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.copyableText > span { | ||
padding: 10px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from "./CopyableText"; |
Oops, something went wrong.