Add new eslint rule and format code (#2315)
Co-authored-by: Juliano Lazzarotto <[email protected]>
Co-authored-by: Juliano Lazzarotto <[email protected]>
'react-native/no-unused-styles': 2,
'react-native/split-platform-components': 0,
'react/display-name': 0,
'react/jsx-newline': ['warn', {prevent: false}],
'react/no-access-state-in-setstate': 2,
'react/no-typos': 2,
'react/sort-comp': [2, {order: ['instance-variables', 'lifecycle', 'everything-else', 'render']}],
}}
>
{/* Not Authenticated */}
{isLoggedOut && (
<Stack.Group>
{authAction === 'first-run' && <Stack.Screen name="first-run" component={FirstRunNavigator} />}
{authAction === 'auth-with-pin' && (
<Stack.Screen
name="custom-pin-auth"
component={PinLoginScreen}
options={{title: strings.loginPinTitle}}
/>
)}
{authAction === 'auth-with-os' && (
<Stack.Screen name="bio-auth-initial" component={OsLoginScreen} options={{headerShown: false}} />
)}
{authAction === 'request-new-pin' && (
<Stack.Screen //
name="enable-login-with-pin"
)}
{/* Authenticated */}
{isLoggedIn && (
<Stack.Group>
<Stack.Screen name="app-root" component={WalletNavigator} />
<Stack.Screen name="new-wallet" component={WalletInitNavigator} />
</Stack.Group>
)}
{/* Development */}
{__DEV__ && (
<Stack.Group>
<Stack.Screen name="developer" component={DeveloperScreen} options={{headerShown: false}} />
<Stack.Screen name="storybook" component={StorybookScreen} />
</Stack.Group>
)}
<Row style={{justifyContent: 'center'}}>
<PinBox selected={confirmPin.length === 0}>{confirmPin[0]}</PinBox>
<Spacer width={16} />
<PinBox selected={confirmPin.length === 1}>{confirmPin[1]}</PinBox>
<Spacer width={16} />
<PinBox selected={confirmPin.length === 2}>{confirmPin[2]}</PinBox>
<Spacer width={16} />
<PinBox selected={confirmPin.length === 3}>{confirmPin[3]}</PinBox>
</Row>
</ScrollView>
<Row style={{justifyContent: 'center'}}>
<PinBox>{pin[0]}</PinBox>
<Spacer width={10} />
<PinBox>{pin[1]}</PinBox>
<Spacer width={10} />
<PinBox>{pin[2]}</PinBox>
<Spacer width={10} />
<PinBox>{pin[3]}</PinBox>
</Row>
</ScrollView>
<Row>
<AppStoreButton />
<Spacer width={16} />
<PlayStoreButton />
</Row>
<SecretCodeBox>
<Text style={{flex: 1}}>{votingKeyEncrypted}</Text>
<Spacer width={16} />
<CopyButton value={votingKeyEncrypted} />
</SecretCodeBox>
</ScrollView>
<TouchableOpacity onPress={handleOnPress} disabled={disabled}>
<View style={styles.button}>
<Icon.Catalyst size={26} color={COLORS.LIGHT_POSITIVE_GREEN} />
<Text style={styles.text}>{strings.name.toLocaleUpperCase()}</Text>
</View>
</TouchableOpacity>
<Stack.Screen name="confirm-pin">
{/**/}
{() => <ConfirmPin onNext={navigateTo.confirmTx} pin={pin} />}
</Stack.Screen>
<View style={styles.stats}>
<View style={styles.row}>
<Text style={styles.label}>{intl.formatMessage(globalMessages.epochLabel)}:</Text>
<Text style={styles.value}>{currentEpoch}</Text>
</View>
<View style={styles.row}>
<Text style={styles.label}>{intl.formatMessage(messages.endsInLabel)}:</Text>
<View style={styles.timeWrapper}>
{endTime.d != null && <Text style={styles.timeBlock}>{endTime.d}</Text>}
<Text style={styles.timeBlock}>{endTime.h}</Text>
<Text>:</Text>
<Text style={styles.timeBlock}>{endTime.m}</Text>
<Text>:</Text>
<Text style={styles.timeBlock}>{endTime.s}</Text>
</View>
</View>
</View>
<Text style={[styles.text, styles.textFirstLine]}>{strings.firstLine}</Text>
<Text style={[styles.text, styles.textSecondLine]}>{strings.secondLine}</Text>
<Line />
<View style={styles.amountBlock}>
<Text style={styles.label}>{strings.availableFunds}:</Text>
<Text bold style={styles.value} testID="userSummaryAvailableFundsText">
{totalAdaSum != null ? formatAdaWithText(totalAdaSum) : '-'}
</Text>
<View style={styles.amountBlock}>
<Text style={styles.label}>{strings.rewardsLabel}:</Text>
<Text bold style={styles.value} testID="userSummaryRewardsText">
{totalRewards != null ? formatAdaWithText(totalRewards) : '-'}
</Text>
<View style={styles.amountBlock}>
<Text style={styles.label}>{strings.delegatedLabel}:</Text>
<Text bold style={styles.value} testID="userSummaryDelegatedText">
{totalDelegated != null ? formatAdaWithText(totalDelegated) : '-'}
</Text>
<>
<Item>
<Text>{strings.balanceLabel}</Text>
<Text style={styles.balanceAmount} testID="recoveredBalanceText">
{formatTokenWithText(new BigNumber(refundAmount.quantity), wallet.primaryToken)}
</Text>
</Item>
<Item>
<Text>{strings.fees}</Text>
<Text style={styles.balanceAmount} testID="feeAmountText">
{formatTokenWithText(new BigNumber(feeAmount.quantity), wallet.primaryToken)}
</Text>
</Item>
<Item>
<Text>{strings.finalBalanceLabel}</Text>
<Text style={styles.balanceAmount} testID="totalAmountText">
{formatTokenWithText(new BigNumber(totalAmount.quantity), wallet.primaryToken)}
</Text>
</Item>
{withdrawals && <Withdrawals wallet={wallet} withdrawals={withdrawals} />}
{deregistrations && <Deregistrations wallet={wallet} deregistrations={deregistrations} />}
</>
)
return (
<Item>
<Text>{strings.withdrawals}</Text>
{Object.keys(withdrawals).map((address) => (
<TouchableOpacity
key={address}
<>
<Item>
<Text>{strings.stakeDeregistration}</Text>
{addresses.map((address) => (
<TouchableOpacity
key={address}
}}
>
<Markdown style={styles.paragraph}>{strings.explanation1}</Markdown>
<Spacer height={8} />
<Markdown style={styles.paragraph}>{strings.explanation2}</Markdown>
<Spacer height={8} />
<Markdown style={styles.paragraph}>{strings.explanation3}</Markdown>
</DangerousAction>
)
return (
<SafeAreaView edges={['left', 'right', 'bottom']} style={styles.safeAreaView}>
<LanguagePicker />
<Actions>
<Button
onPress={() => navigation.navigate('accept-terms-of-service')}
return (
<View style={[addMargin === true && styles.blockMargin]}>
<Text style={styles.paragraphText}>{strings.beforeConfirm}</Text>
{rows.map((row, i) => (
<BulletPointItem textRow={row} key={i} style={styles.paragraphText} />
))}
disabled={isButtonDisabled}
>
<Text style={styles.deviceName}>{device.name}</Text>
{pending && <ActivityIndicator color="black" />}
</TouchableOpacity>
)
const ListHeaderWrapper = ({msg, err}: {msg: string; err?: string | null}) => (
<View style={styles.listHeader}>
<Text style={[styles.paragraph, styles.paragraphText]}>{msg}</Text>
{err != null && <Text style={[styles.error, styles.paragraphText]}>{err}</Text>}
</View>
)
<View style={[styles.container, fillSpace === true && styles.fillSpace]}>
<View style={styles.heading}>
<Image source={useUSB === true ? usbImage : bleImage} />
{!useUSB && (
<Text secondary style={styles.caption}>
{intl.formatMessage(messages.caption)}
</Text>
)}
</View>
{((!useUSB && devices.length === 0) || (useUSB && deviceObj == null)) && (
<View style={styles.instructionsBlock}>
<Text style={styles.paragraphText}>{intl.formatMessage(messages.introline)}</Text>
{rows.map((row, i) => (
<BulletPointItem textRow={row} key={i} style={styles.item} />
))}
</View>
)}
<ScrollView style={styles.scrollView}>
<FlatList
extraData={[error, deviceId]}
/>
</ScrollView>
</View>
{useUSB === true && (
<Button
onPress={() => {
style={styles.button}
/>
)}
{waiting && <ActivityIndicator color="black" />}
</>
)
<View style={styles.heading}>
<Text style={styles.title}>{strings.title}</Text>
</View>
<Text style={styles.paragraph}>{strings.usbExplanation}</Text>
<Button
block
onPress={onSelectUSB}
style={styles.button}
testID="connectWithUSBButton"
/>
<Text style={styles.paragraph}>{strings.bluetoothExplanation}</Text>
<Button
block
onPress={() => request()}
onPress={navigateTo.allWallets}
left={<Icon.Wallets size={26} color="#6B7384" />}
/>
<HR />
<Boundary loading={{size: 'small', style: {padding: 16}}} error={{size: 'inline'}}>
left={<Icon.Catalyst size={26} color="#6B7384" />}
/>
</Boundary>
<HR />
<Settings //
label={strings.settings}
onPress={navigateTo.settings}
left={<Icon.Gear size={26} color="#6B7384" />}
/>
<HR />
<KnowledgeBase //
label={strings.knowledgeBase}
onPress={navigateTo.knowledgeBase}
left={<Icon.Info size={24} color="#6B7384" />}
/>
<HR />
<Spacer fill />
<View style={styles.supportTitle}>
<Text style={styles.supportTitleText}>{strings.supportTitle}</Text>
</View>
<Spacer height={10} />
<TouchableOpacity onPress={navigateTo.support} style={styles.supportLink}>
<Image source={SupportImage} />
<Spacer width={10} />
<Text bold style={styles.supportLinkText}>
{strings.supportLink.toLocaleUpperCase()}
</Text>
return (
<TouchableOpacity onPress={onPress} style={styles.item} disabled={disabled}>
{left}
<Spacer width={12} />
<Text style={styles.itemText}>{label}</Text>
<Spacer fill />
<Icon.Chevron direction="right" size={16} color="#6B7384" />
</TouchableOpacity>
)
<Info>
<Text style={styles.subtitle}>{strings.walletAddress}</Text>
<Row>
<Text style={{flex: 1}} secondary monospace numberOfLines={1} ellipsizeMode="middle">
{address}
</Text>
<Spacer width={16} />
<CopyButton
value={address}
onCopy={() => {
{path && (
<>
<PathInfo path={path} />
<Spacer width={8} />
</>
)}
<Text style={styles.subtitle}>{strings.staking}</Text>
<Text secondary monospace>
{keyHashes?.staking}
</Text>
<Spacer width={8} />
<Text style={styles.subtitle}>{strings.spending}</Text>
<Text secondary monospace>
{keyHashes?.spending}
</Text>
return (
<>
<Text style={styles.subtitle}>{strings.BIP32path}</Text>
<Text secondary monospace>
{formatPath(account, addressType, index, wallet.walletImplementationId)}
</Text>
Co-authored-by: Alexey Kuleshevich <[email protected]>