Skip to content

Commit

Permalink
Overlay styling for "Wallet Paused"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon-edge committed Oct 20, 2023
1 parent 969e429 commit 463c19c
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

- added: "Paused Wallet" visual indicator on wallet list
- changed: Change FlipInput styling to make the edit functionality more obvious
- changed: Move asset-specific settings into their own settings page

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ exports[`FioAddressList should render with loading props 1`] = `
"outlineTextInputLabelColorDisabled": "#87939E",
"outlineTextInputLabelColorFocused": "#00f1a2",
"outlineTextInputTextColor": "#FFFFFF",
"overlayDisabledColor": "rgba(0, 0, 0, .5)",
"overlayDisabledTextColor": "#FFFFFF",
"paymentTypeLogoApplePay": {
"testUri": "../../../src/assets/images/paymentTypes/paymentTypeLogoApplePay.png",
},
Expand Down Expand Up @@ -672,6 +674,8 @@ exports[`FioAddressList should render with loading props 1`] = `
"outlineTextInputLabelColorDisabled": "#87939E",
"outlineTextInputLabelColorFocused": "#00f1a2",
"outlineTextInputTextColor": "#FFFFFF",
"overlayDisabledColor": "rgba(0, 0, 0, .5)",
"overlayDisabledTextColor": "#FFFFFF",
"paymentTypeLogoApplePay": {
"testUri": "../../../src/assets/images/paymentTypes/paymentTypeLogoApplePay.png",
},
Expand Down
31 changes: 28 additions & 3 deletions src/components/themed/WalletListCurrencyRow.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { EdgeCurrencyWallet, EdgeToken } from 'edge-core-js'
import * as React from 'react'
import { TouchableOpacity } from 'react-native'
import { StyleSheet, TouchableOpacity, View } from 'react-native'

import { useHandler } from '../../hooks/useHandler'
import { lstrings } from '../../locales/strings'
import { useSelector } from '../../types/reactRedux'
import { triggerHaptic } from '../../util/haptic'
import { CurrencyRow } from '../data/row/CurrencyRow'
import { CustomAsset, CustomAssetRow } from '../data/row/CustomAssetRow'
import { cacheStyles, Theme, useTheme } from '../services/ThemeContext'
import { EdgeText } from './EdgeText'

interface Props {
customAsset?: CustomAsset
Expand Down Expand Up @@ -34,6 +37,8 @@ const WalletListCurrencyRowComponent = (props: Props) => {
} = props
const theme = useTheme()
const styles = getStyles(theme)
const pausedWallets = useSelector(state => state.ui.settings.userPausedWalletsSet)
const isPaused = pausedWallets != null && pausedWallets.has(wallet.id)

// Currency code and wallet name for display:
const currencyCode = customAsset?.currencyCode ?? token?.currencyCode ?? wallet.currencyInfo.currencyCode
Expand All @@ -50,13 +55,33 @@ const WalletListCurrencyRowComponent = (props: Props) => {

return (
<TouchableOpacity accessible={false} style={styles.row} onLongPress={handleLongPress} onPress={handlePress}>
{customAsset != null ? <CustomAssetRow customAsset={customAsset} /> : <CurrencyRow showRate={showRate} token={token} tokenId={tokenId} wallet={wallet} />}
{customAsset != null ? (
<CustomAssetRow customAsset={customAsset} />
) : (
<CurrencyRow showRate={showRate && !isPaused} token={token} tokenId={tokenId} wallet={wallet} />
)}
{isPaused ? (
<View style={styles.overlayContainer}>
<EdgeText style={styles.overlayLabel}>{lstrings.fragment_wallets_wallet_paused}</EdgeText>
</View>
) : null}
</TouchableOpacity>
)
}

const getStyles = cacheStyles((theme: Theme) => ({
// Layout:
overlayLabel: {
color: theme.overlayDisabledTextColor
},
overlayLabelContainer: {
...StyleSheet.absoluteFillObject
},
overlayContainer: {
...StyleSheet.absoluteFillObject,
alignItems: 'center',
backgroundColor: theme.overlayDisabledColor,
justifyContent: 'center'
},
row: {
alignItems: 'center',
flexDirection: 'row',
Expand Down
1 change: 1 addition & 0 deletions src/locales/en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ const strings = {
fragment_wallets_get_seed_wallet: 'Get Seed',
fragment_wallets_pause_wallet: 'Pause Wallet',
fragment_wallets_unpause_wallet: 'Unpause Wallet',
fragment_wallets_wallet_paused: 'Wallet Paused',
fragment_wallets_view_private_view_key: 'Private View Key',
fragment_wallets_view_private_view_key_warning_s: `The private view key allows the receiver to see the balance in your %1$s wallet. Do not share this key unless necessary, such as for tax purposes, accounting, or similar reasons.`,
fragment_wallets_view_xpub: 'View XPub Address',
Expand Down
1 change: 1 addition & 0 deletions src/locales/strings/enUS.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@
"fragment_wallets_get_seed_wallet": "Get Seed",
"fragment_wallets_pause_wallet": "Pause Wallet",
"fragment_wallets_unpause_wallet": "Unpause Wallet",
"fragment_wallets_wallet_paused": "Wallet Paused",
"fragment_wallets_view_private_view_key": "Private View Key",
"fragment_wallets_view_private_view_key_warning_s": "The private view key allows the receiver to see the balance in your %1$s wallet. Do not share this key unless necessary, such as for tax purposes, accounting, or similar reasons.",
"fragment_wallets_view_xpub": "View XPub Address",
Expand Down
4 changes: 4 additions & 0 deletions src/theme/variables/edgeDark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,10 @@ export const edgeDark: Theme = {
underlayColor: palette.white,
underlayOpacity: 0.95,

// TouchableHighlights overlay
overlayDisabledColor: palette.blackOp50,
overlayDisabledTextColor: palette.white,

// Tutorials
tutorialModalUnderlay: palette.transparent,

Expand Down
4 changes: 4 additions & 0 deletions src/theme/variables/edgeLight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,10 @@ export const edgeLight: Theme = {
underlayColor: palette.white,
underlayOpacity: 0.95,

// TouchableHighlights overlay
overlayDisabledColor: palette.blackOp50,
overlayDisabledTextColor: palette.white,

// Tutorials
tutorialModalUnderlay: palette.transparent,

Expand Down
4 changes: 4 additions & 0 deletions src/types/Theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,10 @@ export interface Theme {
underlayColor: string
underlayOpacity: number

// TouchableHighlights overlay
overlayDisabledColor: string
overlayDisabledTextColor: string

// Tutorials
tutorialModalUnderlay: string

Expand Down

0 comments on commit 463c19c

Please sign in to comment.