Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
feat(ui): display fee limit when fee is unknown
Browse files Browse the repository at this point in the history
  • Loading branch information
mrfelton committed May 17, 2020
1 parent 32cde4e commit 88a9bf2
Show file tree
Hide file tree
Showing 36 changed files with 44 additions and 3 deletions.
12 changes: 9 additions & 3 deletions renderer/components/Pay/PaySummaryLightning.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react'
import PropTypes from 'prop-types'
import { Box, Flex } from 'rebass/styled-components'
import { FormattedMessage } from 'react-intl'
import config from 'config'
import { CoinBig } from '@zap/utils/coin'
import { convert } from '@zap/utils/btc'
import { decodePayReq, getNodeAlias, getTag } from '@zap/utils/crypto'
Expand Down Expand Up @@ -54,8 +55,8 @@ class PaySummaryLightning extends React.Component {
}

// Select an appropriate fee message...
// Default to unknown.
let feeMessage = messages.fee_unknown
// Default to configured limit.
let feeMessage = messages.fee_config_limit

if (hasMinFee || hasMaxFee) {
// If thex max fee is 0 or 1 then show a message like "less than 1".
Expand All @@ -73,7 +74,12 @@ class PaySummaryLightning extends React.Component {
}

if (feeMessage) {
return <FormattedMessage {...feeMessage} values={{ minFee, maxFee }} />
return (
<FormattedMessage
{...feeMessage}
values={{ minFee, maxFee: hasMaxFee ? maxFee : config.payments.feeLimit }}
/>
)
}

return null
Expand Down
1 change: 1 addition & 0 deletions renderer/components/Pay/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default defineMessages({
fee_upto: 'up to {maxFee} satoshi',
fee_unknown: 'unknown',
fee_per_byte: 'per byte',
fee_config_limit: 'unknown (no more than {maxFee} satoshi)',
fee_subtraction: 'Deducted from total',
fee_addition: 'Added to total',
amount: 'Amount',
Expand Down
1 change: 1 addition & 0 deletions translations/af-ZA.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "",
"components.Pay.fee_per_byte": "",
"components.Pay.fee_range": "",
Expand Down
1 change: 1 addition & 0 deletions translations/ar-SA.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "",
"components.Pay.fee_per_byte": "",
"components.Pay.fee_range": "",
Expand Down
1 change: 1 addition & 0 deletions translations/bg-BG.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "",
"components.Pay.fee_per_byte": "",
"components.Pay.fee_range": "",
Expand Down
1 change: 1 addition & 0 deletions translations/ca-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "",
"components.Pay.fee_per_byte": "",
"components.Pay.fee_range": "",
Expand Down
1 change: 1 addition & 0 deletions translations/cs-CZ.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "Pokoušíte se odeslat více, než je vaše současná kapacita jednorázového odesílání {capacity} {unit}",
"components.Pay.fee": "Poplatek",
"components.Pay.fee_addition": "Celkem přidáno",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "méně než 1 satoshi",
"components.Pay.fee_per_byte": "za byte",
"components.Pay.fee_range": "mezi {minFee} a {maxFee} satoshi",
Expand Down
1 change: 1 addition & 0 deletions translations/da-DK.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "Gebyr",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "mindre end 1 satoshi",
"components.Pay.fee_per_byte": "",
"components.Pay.fee_range": "mellem {minFee} og {maxFee} satoshis",
Expand Down
1 change: 1 addition & 0 deletions translations/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "Du versuchst, mehr als dein aktuelles Sendevermögen von {capacity} {unit} zu senden",
"components.Pay.fee": "Gebühr",
"components.Pay.fee_addition": "Zu Gesamt hinzugefügt",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "weniger als 1 Satoshi",
"components.Pay.fee_per_byte": "pro Byte",
"components.Pay.fee_range": "zwischen {minFee} und {maxFee} Satoshi",
Expand Down
1 change: 1 addition & 0 deletions translations/el-GR.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "",
"components.Pay.fee_per_byte": "",
"components.Pay.fee_range": "",
Expand Down
1 change: 1 addition & 0 deletions translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "You are trying to send more than your current one time send capacity of {capacity} {unit}",
"components.Pay.fee": "Fee",
"components.Pay.fee_addition": "Added to total",
"components.Pay.fee_config_limit": "unknown (no more than {maxFee} satoshi)",
"components.Pay.fee_less_than_1": "less than 1 satoshi",
"components.Pay.fee_per_byte": "per byte",
"components.Pay.fee_range": "between {minFee} and {maxFee} satoshis",
Expand Down
1 change: 1 addition & 0 deletions translations/es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "Estás intentando enviar más de tu capacidad de envío actual de {capacity} {unit}",
"components.Pay.fee": "Comisión",
"components.Pay.fee_addition": "Añadido al total",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "menos de 1 satoshi",
"components.Pay.fee_per_byte": "por byte",
"components.Pay.fee_range": "entre {minFee} y {maxFee} satoshis",
Expand Down
1 change: 1 addition & 0 deletions translations/fi-FI.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "",
"components.Pay.fee_per_byte": "",
"components.Pay.fee_range": "",
Expand Down
1 change: 1 addition & 0 deletions translations/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "Vous essayez d'envoyer plus que ce que votre capacité d'envoi de {capacity}{unit} vous permet d'envoyer d'un coup",
"components.Pay.fee": "Frais",
"components.Pay.fee_addition": "Ajoutés au total",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "moins d'1 satoshi",
"components.Pay.fee_per_byte": "par byte",
"components.Pay.fee_range": "entre {minFee} et {maxFee} satoshis",
Expand Down
1 change: 1 addition & 0 deletions translations/ga-IE.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "",
"components.Pay.fee_addition": "Cuireadh leis an iomlán é",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "",
"components.Pay.fee_per_byte": "",
"components.Pay.fee_range": "",
Expand Down
1 change: 1 addition & 0 deletions translations/he-IL.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "",
"components.Pay.fee_per_byte": "",
"components.Pay.fee_range": "",
Expand Down
1 change: 1 addition & 0 deletions translations/hi-IN.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "",
"components.Pay.fee_per_byte": "",
"components.Pay.fee_range": "",
Expand Down
1 change: 1 addition & 0 deletions translations/hr-HR.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "Naknada",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "manje od 1 satoshi",
"components.Pay.fee_per_byte": "po bajtu",
"components.Pay.fee_range": "između {minFee} i {maxFee} satošija",
Expand Down
1 change: 1 addition & 0 deletions translations/hu-HU.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "",
"components.Pay.fee_per_byte": "",
"components.Pay.fee_range": "",
Expand Down
1 change: 1 addition & 0 deletions translations/it-IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "",
"components.Pay.fee_per_byte": "",
"components.Pay.fee_range": "",
Expand Down
1 change: 1 addition & 0 deletions translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "",
"components.Pay.fee_per_byte": "",
"components.Pay.fee_range": "",
Expand Down
1 change: 1 addition & 0 deletions translations/ko-KR.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "",
"components.Pay.fee_per_byte": "",
"components.Pay.fee_range": "",
Expand Down
1 change: 1 addition & 0 deletions translations/nl-NL.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "",
"components.Pay.fee_per_byte": "",
"components.Pay.fee_range": "",
Expand Down
1 change: 1 addition & 0 deletions translations/no-NO.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "Avgift",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "mindre enn 1 satoshi",
"components.Pay.fee_per_byte": "per byte",
"components.Pay.fee_range": "mellom {minFee} og {maxFee} satoshis",
Expand Down
1 change: 1 addition & 0 deletions translations/pl-PL.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "",
"components.Pay.fee_per_byte": "",
"components.Pay.fee_range": "",
Expand Down
1 change: 1 addition & 0 deletions translations/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "",
"components.Pay.fee_per_byte": "",
"components.Pay.fee_range": "",
Expand Down
1 change: 1 addition & 0 deletions translations/pt-PT.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "",
"components.Pay.fee_per_byte": "",
"components.Pay.fee_range": "",
Expand Down
1 change: 1 addition & 0 deletions translations/ro-RO.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "",
"components.Pay.fee_per_byte": "",
"components.Pay.fee_range": "",
Expand Down
1 change: 1 addition & 0 deletions translations/ru-RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "",
"components.Pay.fee_per_byte": "",
"components.Pay.fee_range": "",
Expand Down
1 change: 1 addition & 0 deletions translations/sr-SP.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "",
"components.Pay.fee_per_byte": "",
"components.Pay.fee_range": "",
Expand Down
1 change: 1 addition & 0 deletions translations/sv-SE.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "",
"components.Pay.fee_per_byte": "",
"components.Pay.fee_range": "",
Expand Down
1 change: 1 addition & 0 deletions translations/tr-TR.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "",
"components.Pay.fee_per_byte": "",
"components.Pay.fee_range": "",
Expand Down
1 change: 1 addition & 0 deletions translations/uk-UA.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "",
"components.Pay.fee_per_byte": "",
"components.Pay.fee_range": "",
Expand Down
1 change: 1 addition & 0 deletions translations/vi-VN.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "",
"components.Pay.fee_per_byte": "",
"components.Pay.fee_range": "",
Expand Down
1 change: 1 addition & 0 deletions translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "",
"components.Pay.fee_per_byte": "",
"components.Pay.fee_range": "",
Expand Down
1 change: 1 addition & 0 deletions translations/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
"components.Pay.error_not_onetime_send_capacity": "",
"components.Pay.fee": "",
"components.Pay.fee_addition": "",
"components.Pay.fee_config_limit": "",
"components.Pay.fee_less_than_1": "",
"components.Pay.fee_per_byte": "",
"components.Pay.fee_range": "",
Expand Down

0 comments on commit 88a9bf2

Please sign in to comment.