Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
finnian0826 committed Jul 10, 2024
1 parent 8b97051 commit 0ec330a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 39 deletions.
2 changes: 1 addition & 1 deletion locales/base/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@
"header": "Restore wallet",
"title": "Enter your recovery phrase",
"description": "Use the 12 or 24-word phrase that you saved when you set up your wallet to restore.",
"description_v1_89": "Your Recovery Phrase is a 12 or 24-word phrase that you wrote down and saved when you set up your wallet. Please enter it here to restore your wallet.",
"description_V1_89": "Your Recovery Phrase is a 12 or 24-word phrase that you wrote down and saved when you set up your wallet. Please enter it here to restore your wallet.",
"emptyWalletDialog": {
"description": "This wallet doesn’t have any funds. Would you still like to use it?",
"action": "Use Wallet",
Expand Down
46 changes: 11 additions & 35 deletions src/components/ClipboardAwarePasteButton.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import { debounce } from 'lodash'
import React, { useLayoutEffect } from 'react'
import { useTranslation } from 'react-i18next'
import { LayoutAnimation, Platform, StyleSheet, Text, View } from 'react-native'
import Touchable from 'src/components/Touchable'
import colors from 'src/styles/colors'
import { typeScale } from 'src/styles/fonts'

const BUTTON_TAP_DEBOUNCE_TIME = 300 // milliseconds
const DEBOUNCE_OPTIONS = {
leading: true,
trailing: false,
}
import { Spacing } from 'src/styles/styles'

interface Props {
getClipboardContent: () => Promise<string>
Expand Down Expand Up @@ -39,54 +33,36 @@ export default React.memo(function ClipboardAwarePasteButton({
return null
}

// Debounce onPress event so that it is called once on trigger and
// consecutive calls in given period are ignored.
const debouncedOnPress = debounce(
async () => {
await onPressInternal()
},
BUTTON_TAP_DEBOUNCE_TIME,
DEBOUNCE_OPTIONS
)

return (
<View style={styles.container}>
{/* these Views cannot be combined as it will cause ripple to not respect the border radius */}
<View style={styles.containRipple}>
<Touchable onPress={debouncedOnPress} style={styles.button} testID={'PasteButton'}>
<>
<Text maxFontSizeMultiplier={1} style={styles.fontStyle}>
{t('paste')}
</Text>
</>
</Touchable>
</View>
<Touchable onPress={onPressInternal} style={styles.button} testID={'PasteButton'}>
<>
<Text maxFontSizeMultiplier={1} style={styles.fontStyle}>
{t('paste')}
</Text>
</>
</Touchable>
</View>
)
})

const styles = StyleSheet.create({
// on android Touchable Provides a ripple effect, by itself it does not respect the border radius on Touchable
containRipple: {
overflow: 'hidden',
},
container: {
flexDirection: 'column',
overflow: 'hidden',
},
button: {
alignItems: 'center',
justifyContent: 'center',
paddingVertical: 5,
paddingHorizontal: 24,
paddingHorizontal: Spacing.Thick24,
backgroundColor: colors.white,
flexDirection: 'row',
height: 48,
height: Spacing.XLarge48,
flexGrow: 1,
},
fontStyle: {
...typeScale.labelSemiBoldMedium,
color: colors.black,
marginLeft: 0,
marginRight: 0,
},
})
5 changes: 3 additions & 2 deletions src/components/RecoveryPhraseInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
Text,
View,
} from 'react-native'
import { isValidBackupPhrase } from 'src/backup/utils'
import Card from 'src/components/Card'
import ClipboardAwarePasteButton from 'src/components/ClipboardAwarePasteButton'
import TextInput, { LINE_HEIGHT } from 'src/components/TextInput'
Expand Down Expand Up @@ -68,8 +69,8 @@ export default function RecoveryPhraseInput({
return (
<Card
rounded={true}
shadow={showInput ? null : Shadow.SoftLight}
style={[showInput ? styles.containerActive : styles.container]}
shadow={!isValidBackupPhrase(inputValue) ? null : Shadow.SoftLight}
style={[!isValidBackupPhrase(inputValue) ? styles.containerActive : styles.container]}
>
{/* These views cannot be combined as it will cause the shadow to be clipped on iOS */}
<View style={styles.containRadius}>
Expand Down
2 changes: 1 addition & 1 deletion src/import/ImportWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ function ImportWallet({ navigation, route }: Props) {
onInputChange={formatAndSetBackupPhrase}
shouldShowClipboard={shouldShowClipboard}
/>
<Text style={styles.description}>{t('importExistingKey.description_v1_89')}</Text>
<Text style={styles.description}>{t('importExistingKey.description_V1_89')}</Text>
<Button
testID="ImportWalletButton"
onPress={onPressRestore}
Expand Down

0 comments on commit 0ec330a

Please sign in to comment.