This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3742 from LN-Zap/master
Master onto Next
- Loading branch information
Showing
16 changed files
with
221 additions
and
91 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import { Flex } from 'rebass/styled-components' | ||
import { CoinBig } from '@zap/utils/coin' | ||
import { Text } from 'components/UI' | ||
import { CryptoSelector, CryptoValue } from 'containers/UI' | ||
import HtlcHops from './HtlcHops' | ||
|
||
const Htlc = ({ route, isAmountVisible = true, ...rest }) => { | ||
const amountExcludingFees = CoinBig(route.totalAmt) | ||
.minus(route.totalFees) | ||
.toString() | ||
return ( | ||
<Flex alignItems="center" justifyContent="space-between" {...rest}> | ||
{isAmountVisible && ( | ||
<Text fontWeight="normal"> | ||
<CryptoValue value={amountExcludingFees} /> | ||
<CryptoSelector ml={2} /> | ||
</Text> | ||
)} | ||
<HtlcHops hops={route.hops} /> | ||
</Flex> | ||
) | ||
} | ||
|
||
Htlc.propTypes = { | ||
isAmountVisible: PropTypes.bool, | ||
route: PropTypes.object.isRequired, | ||
} | ||
|
||
export default Htlc |
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,50 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import { Flex } from 'rebass/styled-components' | ||
import { useIntl } from 'react-intl' | ||
import { CoinBig } from '@zap/utils/coin' | ||
import { getDisplayNodeName } from 'reducers/payment/utils' | ||
import { Truncate } from 'components/Util' | ||
import ArrowRight from 'components/Icon/ArrowRight' | ||
import messages from './messages' | ||
|
||
const HtlcHops = ({ hops, ...rest }) => { | ||
const { formatMessage, formatNumber } = useIntl() | ||
return ( | ||
<Flex {...rest} flexDirection="column"> | ||
{hops.map((hop, index) => { | ||
const displayName = getDisplayNodeName(hop) | ||
const hasFee = CoinBig(hop.feeMsat).gt(0) | ||
const isLast = index === hops.length - 1 | ||
const multiHop = hops.length > 1 | ||
return ( | ||
<Flex | ||
key={hop.pubKey} | ||
alignItems="center" | ||
className="hint--top-left" | ||
color={isLast ? null : 'grey'} | ||
data-hint={formatMessage( | ||
{ ...messages[hasFee ? 'htlc_hop_fee' : 'htlc_hop_no_fee'] }, | ||
{ hopFee: formatNumber(hop.feeMsat), cryptoUnitName: 'msat' } | ||
)} | ||
justifyContent="flex-end" | ||
my={1} | ||
> | ||
{multiHop && ( | ||
<Flex alignItems="center" color="gray" mx={2} opacity={isLast ? 1 : 0.5}> | ||
<ArrowRight /> | ||
</Flex> | ||
)} | ||
<Truncate maxlen={50} text={displayName} /> | ||
</Flex> | ||
) | ||
})} | ||
</Flex> | ||
) | ||
} | ||
|
||
HtlcHops.propTypes = { | ||
hops: PropTypes.array.isRequired, | ||
} | ||
|
||
export default HtlcHops |
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 |
---|---|---|
@@ -1 +1,4 @@ | ||
export PaymentModal from './PaymentModal' | ||
export Route from './Route' | ||
export Htlc from './Htlc' | ||
export HtlcHops from './HtlcHops' |
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
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import payReducer from './reducer' | ||
|
||
export default payReducer | ||
export paySelectors from './selectors' | ||
export * from './constants' | ||
export * from './reducer' | ||
export * from './ipc' |
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
Oops, something went wrong.