Skip to content

Commit 3b9b7a7

Browse files
author
Jon Tzeng
committed
Add Get Help to kebab menu and failed card button
Add a 'Get Help' row to the gift card kebab menu that navigates to the new Gift Card Account Information scene with the quoteId. Also surface a 'Get Help' button on failed cards, reusing the existing redeem button pattern.
1 parent a3ca8ef commit 3b9b7a7

3 files changed

Lines changed: 44 additions & 5 deletions

File tree

src/components/cards/GiftCardDisplayCard.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ interface Props {
4343
/** Display state of the card */
4444
status: GiftCardStatus
4545
onMenuPress: () => void
46+
/** Called when user taps the "Get Help" button on failed cards */
47+
onGetHelpPress?: () => void
4648
/** Called when user taps redeem and completes viewing (webview closes) */
4749
onRedeemComplete?: () => void
4850
}
@@ -53,7 +55,7 @@ interface Props {
5355
* and redemption link overlaid.
5456
*/
5557
export const GiftCardDisplayCard: React.FC<Props> = props => {
56-
const { order, status, onMenuPress, onRedeemComplete } = props
58+
const { order, status, onMenuPress, onGetHelpPress, onRedeemComplete } = props
5759
const theme = useTheme()
5860
const styles = getStyles(theme)
5961

@@ -152,9 +154,19 @@ export const GiftCardDisplayCard: React.FC<Props> = props => {
152154
{lstrings.gift_card_pending}
153155
</EdgeText>
154156
) : status === 'failed' ? (
155-
<EdgeText style={styles.pendingText}>
156-
{lstrings.gift_card_failed}
157-
</EdgeText>
157+
<EdgeTouchableOpacity
158+
onPress={onGetHelpPress}
159+
style={styles.redeemContainer}
160+
>
161+
<EdgeText style={styles.redeemText}>
162+
{lstrings.gift_card_get_help}
163+
</EdgeText>
164+
<ChevronRightIcon
165+
size={theme.rem(1)}
166+
color={theme.iconTappable}
167+
style={styles.embossedShadow}
168+
/>
169+
</EdgeTouchableOpacity>
158170
) : status === 'available' && redemptionUrl != null ? (
159171
<EdgeTouchableOpacity
160172
onPress={handleRedeem}

src/components/modals/GiftCardMenuModal.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { useWatch } from '../../hooks/useWatch'
99
import { lstrings } from '../../locales/strings'
1010
import type { PhazeDisplayOrder } from '../../plugins/gift-cards/phazeGiftCardTypes'
1111
import { useSelector } from '../../types/reactRedux'
12-
import { ArrowRightIcon, CheckIcon } from '../icons/ThemedIcons'
12+
import { ArrowRightIcon, CheckIcon, QuestionIcon } from '../icons/ThemedIcons'
1313
import { cacheStyles, type Theme, useTheme } from '../services/ThemeContext'
1414
import { EdgeText } from '../themed/EdgeText'
1515
import { SelectableRow } from '../themed/SelectableRow'
@@ -19,6 +19,7 @@ export type GiftCardMenuResult =
1919
| { type: 'goToTransaction'; transaction: EdgeTransaction; walletId: string }
2020
| { type: 'markAsRedeemed' }
2121
| { type: 'unmarkAsRedeemed' }
22+
| { type: 'getHelp' }
2223
| undefined
2324

2425
interface Props {
@@ -93,6 +94,10 @@ export const GiftCardMenuModal: React.FC<Props> = props => {
9394
})
9495
})
9596

97+
const handleGetHelp = useHandler(() => {
98+
bridge.resolve({ type: 'getHelp' })
99+
})
100+
96101
// Determine "Go to Transaction" state
97102
const hasTx = transaction != null
98103
const canNavigate = hasTx && order.walletId != null
@@ -140,6 +145,15 @@ export const GiftCardMenuModal: React.FC<Props> = props => {
140145
</View>
141146
}
142147
/>
148+
<SelectableRow
149+
title={lstrings.gift_card_get_help}
150+
onPress={handleGetHelp}
151+
icon={
152+
<View style={styles.iconContainer}>
153+
<QuestionIcon size={iconSize} color={iconColor} />
154+
</View>
155+
}
156+
/>
143157
</EdgeModal>
144158
)
145159
}

src/components/scenes/GiftCardListScene.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ export const GiftCardListScene: React.FC<Props> = (props: Props) => {
186186
await saveOrderAugment(account, order.quoteId, {
187187
redeemedDate: undefined
188188
})
189+
} else if (result.type === 'getHelp') {
190+
navigation.navigate('giftCardAccountInfo', {
191+
quoteId: order.quoteId
192+
})
189193
}
190194
}
191195
)
@@ -285,6 +289,15 @@ export const GiftCardListScene: React.FC<Props> = (props: Props) => {
285289
onMenuPress={() => {
286290
handleMenuPress(order, false).catch(() => {})
287291
}}
292+
onGetHelpPress={
293+
status !== 'failed'
294+
? undefined
295+
: () => {
296+
navigation.navigate('giftCardAccountInfo', {
297+
quoteId: order.quoteId
298+
})
299+
}
300+
}
288301
onRedeemComplete={
289302
status !== 'available'
290303
? undefined

0 commit comments

Comments
 (0)