BlueWallet/components/SecondButton.tsx
Nuno 9e907566f0
feat: redesigned wallet details (#8301)
* feat: redesign transaction detail screen with unified layout and Lottie pending animation

* ADD: decode OP_RETURN payload as UTF-8 text in transaction detail

Co-authored-by: Cursor <cursoragent@cursor.com>

* REF: transaction detail redesign (themes, pending icon, loc)

Co-authored-by: Cursor <cursoragent@cursor.com>

* REF: remove deprecated TransactionDetails, TransactionStatus and getTransactionStatusOptions

Co-authored-by: Cursor <cursoragent@cursor.com>

* FIX: resolve lint errors (unused vars, styles, loc keys, no-bitwise, inline styles)

Co-authored-by: Cursor <cursoragent@cursor.com>

* FIX: remove redundant !tx check in transaction detail guard

Co-authored-by: Cursor <cursoragent@cursor.com>

* FIX: show transaction not available when tx not found after load

Co-authored-by: Cursor <cursoragent@cursor.com>

* FIX: remove unused transaction prop type from TransactionDetail

Co-authored-by: Cursor <cursoragent@cursor.com>

* TST: update UTXO note E2E to use new transaction detail note prompt UI

Co-authored-by: Cursor <cursoragent@cursor.com>

* simplify changes on the PR for review

* remove unused loc

* remove unchanged colors

* better offline support for tx details

* remove unused key loc

* fix code review issues

* fix balance

* fix tests

* REF: address PR #8289 review feedback

* redesigned wallets details

* fix lint

* fix lint

* fix bip84 test

* fix test

* fix tests

* fix tests

* fix: truncation and sendTo logic display

* fix: new arch fixes

* fix: lint

* fix: crash on status update

* fix: lint and tests

* fix: tests

* fix: tests

* fix: tests

* fix: tests

* fix: tests

* Potential fix for pull request finding 'Identical operands'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* fix: tests

* fix: tests

* fix: tests

* fix: tests

* fix: tests

* fix style

* fix merge master

* Merge branch 'wallet-details' of https://github.com/BlueWallet/BlueWallet into wallet-details

* fix loc

* fix loc

* fix style

* improve coin control from wallet details

* fix: e2e

* fix: WalletDetails

* fix: flat

* fix: e2e

* fix: e2e

* Potential fix for pull request finding 'Unused variable, import, function or class'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* fix: remove notifications dialogs

* fix: second button title

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Ivan Vershigora <ivan.vershigora@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Co-authored-by: Overtorment <overtorment@gmail.com>
2026-05-21 09:12:49 +02:00

81 lines
2.1 KiB
TypeScript

import React, { forwardRef } from 'react';
import { StyleSheet, Text, TouchableOpacity, View, ActivityIndicator } from 'react-native';
import Icon, { type IconProps } from './Icon';
import { useTheme } from './themes';
type IconButtonProps = Pick<IconProps, 'name' | 'type'> & { color: string };
type SecondButtonProps = {
backgroundColor?: string;
disabled?: boolean;
icon?: IconButtonProps;
title: string;
textColor?: string;
onPress?: () => void;
loading?: boolean;
testID?: string;
};
export const SecondButton = forwardRef<React.ElementRef<typeof TouchableOpacity>, SecondButtonProps>((props, ref) => {
const { colors } = useTheme();
let backgroundColor = props.backgroundColor ? props.backgroundColor : colors.buttonGrayBackgroundColor;
let fontColor = props.textColor ?? colors.secondButtonTextColor;
if (props.disabled === true) {
backgroundColor = colors.buttonDisabledBackgroundColor;
fontColor = colors.buttonDisabledTextColor;
}
const buttonView = props.loading ? (
<ActivityIndicator size="small" color={colors.buttonTextColor} />
) : (
<View style={styles.view}>
{props.icon && <Icon {...props.icon} />}
{props.title && <Text style={[styles.text, { color: fontColor }]}>{props.title}</Text>}
</View>
);
return props.onPress ? (
<TouchableOpacity
disabled={props.disabled || props.loading}
accessibilityRole="button"
testID={props.testID}
style={[styles.button, { backgroundColor }]}
{...props}
ref={ref}
>
{buttonView}
</TouchableOpacity>
) : (
<View style={[styles.button, { backgroundColor }]}>{buttonView}</View>
);
});
const styles = StyleSheet.create({
button: {
minHeight: 45,
height: 48,
maxHeight: 48,
borderRadius: 7,
justifyContent: 'center',
alignItems: 'center',
paddingHorizontal: 16,
flexGrow: 1,
},
content: {
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
},
text: {
marginHorizontal: 8,
fontSize: 16,
fontWeight: '600',
},
view: {
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
},
});