REF: ManageWallets

This commit is contained in:
Marcos Rodriguez Velez 2024-07-24 20:22:06 -04:00
parent 64c1114dbc
commit 6289485ff9
No known key found for this signature in database
GPG key ID: 6030B2F48CCE86D7
8 changed files with 28 additions and 22 deletions

View file

@ -484,7 +484,8 @@
"list_tryagain": "Try again",
"no_ln_wallet_error": "Before paying a Lightning invoice, you must first add a Lightning wallet.",
"looks_like_bip38": "This looks like a password-protected private key (BIP38).",
"reorder_title": "Re-order Wallets",
"manage_title": "Manage Wallets",
"no_results_found": "No results found.",
"please_continue_scanning": "Please continue scanning.",
"select_no_bitcoin": "There are currently no Bitcoin wallets available.",
"select_no_bitcoin_exp": "A Bitcoin wallet is required to refill Lightning wallets. Please create or import one.",
@ -495,7 +496,7 @@
"add_ln_wallet_first": "You must first add a Lightning wallet.",
"identity_pubkey": "Identity Pubkey",
"xpub_title": "Wallet XPUB",
"search_wallets": "Search wallets, memos, and transactions",
"search_wallets": "Search wallets, memos, and transactions"
},
"multisig": {
"multisig_vault": "Vault",

View file

@ -55,7 +55,6 @@ import PaymentCodesListComponent from './LazyLoadPaymentCodeStack';
import LDKOpenChannelRoot from './LDKOpenChannelStack';
import LNDCreateInvoiceRoot from './LNDCreateInvoiceStack';
import ReceiveDetailsStackRoot from './ReceiveDetailsStack';
import ReorderWalletsStackRoot from './ReorderWalletsStack';
import ScanLndInvoiceRoot from './ScanLndInvoiceStack';
import ScanQRCodeStackRoot from './ScanQRCodeStack';
import SendDetailsStack from './SendDetailsStack';
@ -66,6 +65,7 @@ import WalletXpubStackRoot from './WalletXpubStack';
import PlusIcon from '../components/icons/PlusIcon';
import SettingsButton from '../components/icons/SettingsButton';
import ExportMultisigCoordinationSetupStack from './ExportMultisigCoordinationSetupStack';
import ManageWalletsStackRoot from './ManageWalletsStack';
const DetailViewStackScreensStack = () => {
const theme = useTheme();
@ -379,8 +379,8 @@ const DetailViewStackScreensStack = () => {
}}
/>
<DetailViewStack.Screen
name="ReorderWallets"
component={ReorderWalletsStackRoot}
name="ManageWalletsRoot"
component={ManageWalletsStackRoot}
options={{
headerShown: false,
gestureEnabled: false,

View file

@ -103,5 +103,5 @@ export type DetailViewStackParamList = {
paymentCode: string;
walletID: string;
};
ReorderWallets: undefined;
ManageWalletsRoot: undefined;
};

View file

@ -4,27 +4,27 @@ import React from 'react';
import navigationStyle from '../components/navigationStyle';
import { useTheme } from '../components/themes';
import loc from '../loc';
import ReorderWallets from '../screen/wallets/ReorderWallets';
import ManageWallets from '../screen/wallets/ManageWallets';
const Stack = createNativeStackNavigator();
const ReorderWalletsStackRoot = () => {
const ManageWalletsStackRoot = () => {
const theme = useTheme();
return (
<Stack.Navigator screenOptions={{ headerShadowVisible: false }}>
<Stack.Screen
name="ReorderWalletsScreen"
component={ReorderWallets}
name="ManageWallets"
component={ManageWallets}
options={navigationStyle({
headerBackVisible: false,
headerLargeTitle: true,
headerTitle: loc.wallets.reorder_title,
headerTitle: loc.wallets.manage_title,
})(theme)}
/>
</Stack.Navigator>
);
};
export default ReorderWalletsStackRoot;
export default ManageWalletsStackRoot;

View file

@ -213,5 +213,5 @@ export type DetailViewStackParamList = {
paymentCode: string;
walletID: string;
};
ReorderWallets: undefined;
ManageWallets: undefined;
};

View file

@ -124,7 +124,7 @@ const DrawerList: React.FC<DrawerListProps> = memo(({ navigation }) => {
const handleLongPress = useCallback(() => {
if (state.wallets.length > 1) {
navigation.navigate('ReorderWallets');
navigation.navigate('ManageWalletsRoot');
} else {
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
}

View file

@ -1,6 +1,6 @@
import React, { useEffect, useLayoutEffect, useRef, useReducer, useCallback, useMemo } from 'react';
import { Platform, StyleSheet, useColorScheme, TouchableOpacity, Image, Animated, Text, I18nManager } from 'react-native';
// @ts-ignore: fix later
// @ts-ignore: no declaration file
import DraggableFlatList, { ScaleDecorator } from 'react-native-draggable-flatlist';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
@ -101,7 +101,7 @@ const useBounceAnimation = (query: string) => {
return bounceAnim;
};
const ReorderWallets: React.FC = () => {
const ManageWallets: React.FC = () => {
const sortableList = useRef(null);
const { colors, closeImage } = useTheme();
const { wallets, setWalletsWithNewOrder, txMetadata } = useStorage();
@ -116,6 +116,9 @@ const ReorderWallets: React.FC = () => {
tip: {
backgroundColor: colors.ballOutgoingExpired,
},
noResultsText: {
color: colors.foregroundColor,
},
};
useEffect(() => {
@ -284,12 +287,14 @@ const ReorderWallets: React.FC = () => {
return (
<>
{hasWallets && <Header leftText="Wallets" isDrawerList />}
{hasTransactions && <Header leftText="Transactions" isDrawerList />}
{!hasWallets && !hasTransactions && <Text style={styles.noResultsText}>No results found</Text>}
{hasWallets && <Header leftText={loc.wallets.wallets} isDrawerList />}
{hasTransactions && <Header leftText={loc.addresses.transactions} isDrawerList />}
{!hasWallets && !hasTransactions && (
<Text style={[styles.noResultsText, stylesHook.noResultsText]}>{loc.wallets.no_results_found}</Text>
)}
</>
);
}, [state.searchQuery, state.walletData, state.txMetadata]);
}, [state.searchQuery, state.walletData.length, state.txMetadata, stylesHook.noResultsText]);
return (
<GestureHandlerRootView style={[styles.root, stylesHook.root]}>
@ -311,7 +316,7 @@ const ReorderWallets: React.FC = () => {
);
};
export default ReorderWallets;
export default ManageWallets;
const styles = StyleSheet.create({
root: {

View file

@ -229,7 +229,7 @@ const WalletsList: React.FC = () => {
const handleLongPress = useCallback(() => {
if (wallets.length > 1) {
navigate('ReorderWallets');
navigate('ManageWalletsRoot');
} else {
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
}