Skip to content

Commit

Permalink
Address comments in the PR
Browse files Browse the repository at this point in the history
  • Loading branch information
i1skn committed Dec 11, 2019
1 parent f57b96b commit c80d4b7
Show file tree
Hide file tree
Showing 19 changed files with 813 additions and 826 deletions.
2 changes: 2 additions & 0 deletions packages/mobile/locales/en-US/inviteFlow11.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@
"inviteComplete": "Invite Complete",
"inviteReceived": "Invite Received",
"escrowPaymentNotificationTitle": "Invited ({{amount}}) {{mobile}}",
"escrowPaymentNotificationLine": "<0>{{recipientPhone}} for</0> <1>{{amount}}</1>",
"escrowPaymentNotificationLine_missingRecipientPhone": "<0>Unknown for</0> <1>{{amount}}</1>",
"defaultComment": "Invitation sent"
}
3 changes: 2 additions & 1 deletion packages/mobile/locales/en-US/paymentRequestFlow.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"paymentRequestUpdateFailed": "Cannot update payment request",
"incomingPaymentRequestNotificationTitle": "{{name}} requested {{amount}}",
"outgoingPaymentRequestNotificationTitle": "Requested {{amount}} from {{name}}",
"defaultComment": "Payment Requested"
"defaultComment": "Payment Requested",
"paymentRequestNotificationLine": "<0>{{displayName}} for</0> <1>{{amount}}</1>"
}
2 changes: 2 additions & 0 deletions packages/mobile/locales/es-419/inviteFlow11.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@
"inviteComplete": "Invitación completa",
"inviteReceived": "Invitación recibida",
"escrowPaymentNotificationTitle": "~~Invited ({{amount}}) {{mobile}}",
"escrowPaymentNotificationLine": "~~<0>{{recipientPhone}} for</0> <1>{{amount}}</1>",
"escrowPaymentNotificationLine_missingRecipientPhone": "~~<0>Unknown for</0> <1>{{amount}}</1>",
"defaultComment": "~~Invitation sent"
}
3 changes: 2 additions & 1 deletion packages/mobile/locales/es-419/paymentRequestFlow.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"paymentRequestUpdateFailed": "No se pudo actualizar el pedido de pago",
"incomingPaymentRequestNotificationTitle": "~~{{name}} requested {{amount}}",
"outgoingPaymentRequestNotificationTitle": "~~Requested {{amount}} from {{name}}",
"defaultComment": "~~Payment Requested"
"defaultComment": "~~Payment Requested",
"paymentRequestNotificationLine": "~~<0>{{displayName}} for</0> <1>{{amount}}</1>"
}
1 change: 0 additions & 1 deletion packages/mobile/locales/es-419/walletFlow5.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"balanceNeedUpdating": "Saldo necesita actualizarse",
"refreshBalances": "Actualizar saldos",
"escrowedPaymentReminder": "Reacuerda al receptor aceptar el pago",
"escrowedPaymentReminderWithCount_plural": "Recordar {{count}} receptores to aceptar el pago",
"escrowedPaymentReminderSms":
"¡Un recordatorio amistoso de que aún no ha canjeado sus dólares de celo!",
"testnetAlert": {
Expand Down
28 changes: 18 additions & 10 deletions packages/mobile/src/escrow/EscrowedPaymentLineItem.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
import fontStyles from '@celo/react-components/styles/fonts'
import * as React from 'react'
import { withNamespaces, WithNamespaces } from 'react-i18next'
import { Trans, withNamespaces, WithNamespaces } from 'react-i18next'
import { StyleSheet, Text } from 'react-native'
import { EscrowedPayment } from 'src/escrow/actions'
import { CURRENCIES, CURRENCY_ENUM } from 'src/geth/consts'
import { divideByWei, getCentAwareMoneyDisplay } from 'src/utils/formatting'

interface Props {
payment: EscrowedPayment
}

function EscrowedPaymentLineItem(props: Props & WithNamespaces) {
const { t } = props
const { amount, recipientPhone } = props.payment
return (
<Text numberOfLines={1} ellipsizeMode="middle" style={styles.oneLine}>
<Text style={[fontStyles.subSmall]}>
{recipientPhone ? recipientPhone : t('unknown')} {t('for')}
</Text>
<Text style={[fontStyles.subSmall, fontStyles.semiBold]}>
{' '}
${getCentAwareMoneyDisplay(divideByWei(amount.toString()))}
</Text>
{/*
// @ts-ignore tOptions prop is missing in type bindings, but exists in the implementation */}
<Trans
i18nKey="escrowPaymentNotificationLine"
tOptions={{ context: !recipientPhone ? 'missingRecipientPhone' : null }}
values={{
amount:
CURRENCIES[CURRENCY_ENUM.DOLLAR].symbol +
getCentAwareMoneyDisplay(divideByWei(amount.toString())),
recipientPhone,
}}
>
<Text style={fontStyles.subSmall}>{{ recipientPhone }} for </Text>
<Text style={[fontStyles.subSmall, fontStyles.semiBold]}>{{ amount }}</Text>
</Trans>
</Text>
)
}
Expand All @@ -31,4 +39,4 @@ const styles = StyleSheet.create({
},
})

export default withNamespaces('global')(EscrowedPaymentLineItem)
export default withNamespaces('inviteFlow11')(EscrowedPaymentLineItem)
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export class EscrowedPaymentReminderSummaryNotification extends React.Component<
navigate(Stacks.EscrowStack)
}

itemRenderer = (item: EscrowedPayment, key: number) => {
return <EscrowedPaymentLineItem payment={item} key={key} />
itemRenderer = (item: EscrowedPayment) => {
return <EscrowedPaymentLineItem payment={item} key={item.paymentID} />
}

render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,16 @@ exports[`renders correctly 1`] = `
>
<Text
style={
Array [
Object {
"color": "#81868B",
"fontFamily": "Hind-Regular",
"fontSize": 14,
"lineHeight": 20,
},
]
Object {
"color": "#81868B",
"fontFamily": "Hind-Regular",
"fontSize": 14,
"lineHeight": 20,
}
}
>
+491522345678
for
for
</Text>
<Text
style={
Expand All @@ -41,9 +38,7 @@ exports[`renders correctly 1`] = `
]
}
>
$
7
11870000
</Text>
</Text>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,16 @@ exports[`EscrowedPaymentReminderSummaryNotification renders correctly 1`] = `
>
<Text
style={
Array [
Object {
"color": "#81868B",
"fontFamily": "Hind-Regular",
"fontSize": 14,
"lineHeight": 20,
},
]
Object {
"color": "#81868B",
"fontFamily": "Hind-Regular",
"fontSize": 14,
"lineHeight": 20,
}
}
>
+491522345678
for
for
</Text>
<Text
style={
Expand All @@ -132,9 +129,7 @@ exports[`EscrowedPaymentReminderSummaryNotification renders correctly 1`] = `
]
}
>
$
7
11870000
</Text>
</Text>
<Text
Expand All @@ -148,19 +143,16 @@ exports[`EscrowedPaymentReminderSummaryNotification renders correctly 1`] = `
>
<Text
style={
Array [
Object {
"color": "#81868B",
"fontFamily": "Hind-Regular",
"fontSize": 14,
"lineHeight": 20,
},
]
Object {
"color": "#81868B",
"fontFamily": "Hind-Regular",
"fontSize": 14,
"lineHeight": 20,
}
}
>
+491522345678
for
for
</Text>
<Text
style={
Expand All @@ -177,9 +169,7 @@ exports[`EscrowedPaymentReminderSummaryNotification renders correctly 1`] = `
]
}
>
$
7
11870000
</Text>
</Text>
</View>
Expand Down Expand Up @@ -524,19 +514,16 @@ exports[`EscrowedPaymentReminderSummaryNotification when more than 2 requests re
>
<Text
style={
Array [
Object {
"color": "#81868B",
"fontFamily": "Hind-Regular",
"fontSize": 14,
"lineHeight": 20,
},
]
Object {
"color": "#81868B",
"fontFamily": "Hind-Regular",
"fontSize": 14,
"lineHeight": 20,
}
}
>
+491522345678
for
for
</Text>
<Text
style={
Expand All @@ -553,9 +540,7 @@ exports[`EscrowedPaymentReminderSummaryNotification when more than 2 requests re
]
}
>
$
7
11870000
</Text>
</Text>
<Text
Expand All @@ -569,19 +554,16 @@ exports[`EscrowedPaymentReminderSummaryNotification when more than 2 requests re
>
<Text
style={
Array [
Object {
"color": "#81868B",
"fontFamily": "Hind-Regular",
"fontSize": 14,
"lineHeight": 20,
},
]
Object {
"color": "#81868B",
"fontFamily": "Hind-Regular",
"fontSize": 14,
"lineHeight": 20,
}
}
>
+491522345678
for
for
</Text>
<Text
style={
Expand All @@ -598,9 +580,7 @@ exports[`EscrowedPaymentReminderSummaryNotification when more than 2 requests re
]
}
>
$
7
11870000
</Text>
</Text>
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ exports[`NotificationBox renders correctly for with all notifications 1`] = `
}
>
+14155550000
for
for
</Text>
<Text
style={
Expand All @@ -153,7 +152,7 @@ exports[`NotificationBox renders correctly for with all notifications 1`] = `
]
}
>
$12.34
12.34
</Text>
</Text>
<Text
Expand All @@ -176,8 +175,7 @@ exports[`NotificationBox renders correctly for with all notifications 1`] = `
}
>
+14155550000
for
for
</Text>
<Text
style={
Expand All @@ -194,7 +192,7 @@ exports[`NotificationBox renders correctly for with all notifications 1`] = `
]
}
>
$12.34
12.34
</Text>
</Text>
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ export class IncomingPaymentRequestSummaryNotification extends React.Component<P
navigate(Stacks.IncomingRequestStack)
}

itemRenderer = (item: PaymentRequest, key: number) => {
itemRenderer = (item: PaymentRequest) => {
return (
<PaymentRequestNotificationInner
key={key}
key={item.uid}
amount={item.amount}
requesterE164Number={item.requesterE164Number}
requesterRecipient={this.getRequesterRecipient(item.requesterE164Number)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ export class OutgoingPaymentRequestSummaryNotification extends React.Component<P
)
}

itemRenderer = (item: PaymentRequest, key: number) => {
itemRenderer = (item: PaymentRequest) => {
return (
<PaymentRequestNotificationInner
key={key}
key={item.uid}
amount={item.amount}
requesterE164Number={item.requesterE164Number}
requesterRecipient={this.getRequesterRecipient(item.requesterE164Number)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fontStyles from '@celo/react-components/styles/fonts'
import * as React from 'react'
import { WithNamespaces, withNamespaces } from 'react-i18next'
import { Trans, withNamespaces, WithNamespaces } from 'react-i18next'
import { StyleSheet, Text } from 'react-native'
import { CURRENCIES, CURRENCY_ENUM } from 'src/geth/consts'
import { Recipient } from 'src/recipients/recipient'
Expand All @@ -13,15 +13,20 @@ interface Props {
}

function PaymentRequestNotificationInner(props: Props & WithNamespaces) {
const { t, requesterE164Number, amount, requesterRecipient } = props
const { requesterE164Number, amount, requesterRecipient } = props
const displayName = (requesterRecipient && requesterRecipient.displayName) || requesterE164Number
return (
<Text numberOfLines={1} ellipsizeMode="middle" style={styles.oneLine}>
<Text style={fontStyles.subSmall}>
{(requesterRecipient && requesterRecipient.displayName) || requesterE164Number} {t('for')}
</Text>
<Text style={[fontStyles.subSmall, fontStyles.semiBold]}>
{' ' + CURRENCIES[CURRENCY_ENUM.DOLLAR].symbol + getCentAwareMoneyDisplay(amount)}
</Text>
<Trans
i18nKey="paymentRequestNotificationLine"
values={{
amount: CURRENCIES[CURRENCY_ENUM.DOLLAR].symbol + getCentAwareMoneyDisplay(amount),
displayName,
}}
>
<Text style={fontStyles.subSmall}>{{ displayName }} for </Text>
<Text style={[fontStyles.subSmall, fontStyles.semiBold]}>{{ amount }}</Text>
</Trans>
</Text>
)
}
Expand All @@ -32,4 +37,4 @@ const styles = StyleSheet.create({
},
})

export default withNamespaces('global')(PaymentRequestNotificationInner)
export default withNamespaces('paymentRequestFlow')(PaymentRequestNotificationInner)
Loading

0 comments on commit c80d4b7

Please sign in to comment.