diff --git a/src/features/collectables/AntennaSetupScreen.tsx b/src/features/collectables/AntennaSetupScreen.tsx index a0b303643..cd9911835 100644 --- a/src/features/collectables/AntennaSetupScreen.tsx +++ b/src/features/collectables/AntennaSetupScreen.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useState, useMemo, useCallback, memo } from 'react' import BackScreen from '@components/BackScreen' -import { ReAnimatedBlurBox } from '@components/AnimatedBox' +import { ReAnimatedBox } from '@components/AnimatedBox' import Box from '@components/Box' import ButtonPressable from '@components/ButtonPressable' import CircleLoader from '@components/CircleLoader' @@ -18,16 +18,19 @@ import { import { useEntityKey } from '@hooks/useEntityKey' import { useIotInfo } from '@hooks/useIotInfo' import { Edge } from 'react-native-safe-area-context' -import { CollectableStackParamList } from './collectablesTypes' +import { DelayedFadeIn } from '@components/FadeInOut' +import { + CollectableNavigationProp, + CollectableStackParamList, +} from './collectablesTypes' import { parseH3BNLocation } from '../../utils/h3' import * as Logger from '../../utils/logger' -import { TabBarNavigationProp } from '../../navigation/rootTypes' const BUTTON_HEIGHT = 65 type Route = RouteProp const AntennaSetupScreen = () => { const { t } = useTranslation() - const navigation = useNavigation() + const nav = useNavigation() const route = useRoute() const { collectable } = route.params const entityKey = useEntityKey(collectable) @@ -76,11 +79,7 @@ const AntennaSetupScreen = () => { elevation, decimalGain: gain, }) - setUpdating(false) - navigation.reset({ - index: 0, - routes: [{ name: 'Collectables' }], - }) + nav.push('SettingUpAntennaScreen') } catch (error) { setUpdating(false) Logger.error(error) @@ -95,7 +94,7 @@ const AntennaSetupScreen = () => { setUpdating, setTransactionError, submitUpdateEntityInfo, - navigation, + nav, ]) const showError = useMemo(() => { @@ -103,12 +102,7 @@ const AntennaSetupScreen = () => { }, [transactionError]) return ( - + { - + ) } diff --git a/src/features/collectables/CollectablesNavigator.tsx b/src/features/collectables/CollectablesNavigator.tsx index a7bcd1007..104becc5c 100644 --- a/src/features/collectables/CollectablesNavigator.tsx +++ b/src/features/collectables/CollectablesNavigator.tsx @@ -20,6 +20,7 @@ import ClaimingRewardsScreen from './ClaimingRewardsScreen' import CollectionScreen from './CollectionScreen' import NftDetailsScreen from './NftDetailsScreen' import AntennaSetupScreen from './AntennaSetupScreen' +import SettingUpAntennaScreen from './SettingUpAntennaScreen' const CollectablesStack = createStackNavigator() @@ -46,6 +47,10 @@ const CollectablesStackScreen = () => { name="AntennaSetupScreen" component={AntennaSetupScreen} /> + { + const { currentAccount } = useAccountStorage() + const navigation = useNavigation() + const wallet = useCurrentWallet() + const solBalance = useBN(useSolOwnedAmount(wallet).amount) + const { bottom } = useSafeAreaInsets() + + const { t } = useTranslation() + const solanaPayment = useSelector( + (reduxState: RootState) => reduxState.solana.payment, + ) + + const onReturn = useCallback(() => { + // Reset Collectables stack to first screen + navigation.reset({ + index: 0, + routes: [{ name: 'Collectables' }], + }) + }, [navigation]) + + if (!currentAccount) { + return null + } + + return ( + + + + + + + {solanaPayment && !solanaPayment.error && !solanaPayment.loading && ( + + + {t('antennaSetupScreen.settingUpComplete')} + + + {t('antennaSetupScreen.settingUpCompleteBody')} + + + )} + + {solanaPayment?.error && ( + + + {t('collectablesScreen.rewardsError')} + + + {parseTransactionError( + solBalance, + solanaPayment?.error?.message, + )} + + + )} + + {!solanaPayment && ( + + + {t('antennaSetupScreen.settingUpError')} + + + )} + + {solanaPayment && solanaPayment.loading && ( + + + {t('antennaSetupScreen.settingUp')} + + + {t('antennaSetupScreen.settingUpBody')} + + + + + + )} + + + + } + /> + + + + ) +} + +export default memo(SettingUpAntennaScreen) diff --git a/src/features/collectables/collectablesTypes.ts b/src/features/collectables/collectablesTypes.ts index fa15c59d3..0b4e65a8b 100644 --- a/src/features/collectables/collectablesTypes.ts +++ b/src/features/collectables/collectablesTypes.ts @@ -21,14 +21,13 @@ export type CollectableStackParamList = { AntennaSetupScreen: { collectable: HotspotWithPendingRewards } + SettingUpAntennaScreen: undefined PaymentScreen: undefined | PaymentRouteParam - ClaimRewardsScreen: { hotspot: HotspotWithPendingRewards } ClaimAllRewardsScreen: undefined ClaimingRewardsScreen: undefined - CollectionScreen: { collection: Collectable[] } @@ -44,7 +43,6 @@ export type CollectableStackParamList = { TransferCompleteScreen: { collectable: CompressedNFT | Collectable } - AddNewContact: undefined PaymentQrScanner: undefined AddressBookNavigator: undefined diff --git a/src/locales/en.ts b/src/locales/en.ts index 17cdd9b1d..c6b1a3d4e 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -332,6 +332,12 @@ export default { gainPlaceholder: 'TX / RX Gain (dBi)', elevationPlaceholder: 'Elevation (meters)', submit: 'Update Antenna', + settingUp: 'Setting up your antenna...', + settingUpBody: 'Please wait while we update your Antenna!', + settingUpError: 'Antenna Setup failed. Please try again later.', + settingUpComplete: 'Antenna Setup!', + settingUpCompleteBody: + 'We’ve updated the gain and elevation of your antenna.', }, swapsScreen: { title: 'Swap my Tokens',