diff --git a/app/LoadingApp/LoadingApp.tsx b/app/LoadingApp/LoadingApp.tsx index 597ef0551..6c337992f 100644 --- a/app/LoadingApp/LoadingApp.tsx +++ b/app/LoadingApp/LoadingApp.tsx @@ -1661,6 +1661,7 @@ export class LoadingAppClass extends Component< setIndexerServer={this.setIndexerServer} checkIndexerServer={this.checkIndexerServer} closeServers={this.closeServers} + previousServer={this.state.indexerServer.uri} /> )} {screen === 1 && ( diff --git a/app/LoadingApp/components/ConnectIndexer.tsx b/app/LoadingApp/components/ConnectIndexer.tsx index 3c880b4af..53358f729 100644 --- a/app/LoadingApp/components/ConnectIndexer.tsx +++ b/app/LoadingApp/components/ConnectIndexer.tsx @@ -82,7 +82,14 @@ const ConnectIndexer: React.FunctionComponent = ({ const custom: boolean = serverUris().filter(s => s.uri === indexerServerContext.uri).length === 0; - const { base, port } = parseUri(indexerServerContext.uri); + const { base, port } = parseUri( + `${ + !indexerServerContext.uri.toLowerCase().startsWith(GlobalConst.http) && + !indexerServerContext.uri.toLowerCase().startsWith(GlobalConst.https) + ? GlobalConst.http + '//' + indexerServerContext.uri + : indexerServerContext.uri + }`, + ); const [indexerServerUriLocal, setIndexerServerUriLocal] = useState( custom ? base : '', @@ -116,7 +123,13 @@ const ConnectIndexer: React.FunctionComponent = ({ : (translate('info.unknown') as string) + ' (' + chain + ')'; }; - //console.log('Render Servers', insets); + console.log( + 'Render Servers', + indexerServerContext, + indexerServerUriLocal, + indexerServerPortLocal, + indexerServerChainNameLocal, + ); return ( @@ -523,12 +536,6 @@ const ConnectIndexer: React.FunctionComponent = ({ setConnected(null); setBorderColor('transparent'); // add http if it not have it - if ( - !indexerServerUriLocal - .toLowerCase() - .startsWith(GlobalConst.http) - ) { - } const { result: _connected, indexerServerUriParsed: _indexerServerUri, diff --git a/app/LoadingApp/components/SelectNetwork.tsx b/app/LoadingApp/components/SelectNetwork.tsx index c0b3db6ee..c66a6119d 100644 --- a/app/LoadingApp/components/SelectNetwork.tsx +++ b/app/LoadingApp/components/SelectNetwork.tsx @@ -77,7 +77,7 @@ const SelectNetwork: React.FunctionComponent = ({ }; }, []); - console.log('Render Select Network', indexerServerContext); + console.log('Render Select Network', fromSettings); return ( diff --git a/app/LoadingApp/components/ServerListScreen.tsx b/app/LoadingApp/components/ServerListScreen.tsx index 7f7128d5d..93f12f6d6 100644 --- a/app/LoadingApp/components/ServerListScreen.tsx +++ b/app/LoadingApp/components/ServerListScreen.tsx @@ -38,6 +38,7 @@ export type ServerListScreenProps = { indexerList: IndexerList; closeServers: () => void; goBack: () => void; + previousServer?: string; }; export const ServerListScreen: React.FC = ({ @@ -46,12 +47,19 @@ export const ServerListScreen: React.FC = ({ indexerList, closeServers, goBack, + previousServer, }) => { const { colors } = useTheme() as unknown as ThemeType; // TODO: FIX const insets = useSafeAreaInsets(); const { clear } = useToast(); - const [selectedServer, setSelectedServer] = useState(null); + const prevIndexer = indexerList.find( + indexer => indexer.url === previousServer, + ); + + const [selectedServer, setSelectedServer] = useState( + prevIndexer ? prevIndexer : null, + ); const [connected, setConnected] = useState(null); const [borderColor, setBorderColor] = useState('transparent'); const [isTestingSelected, setIsTestingSelected] = useState(false); @@ -116,7 +124,6 @@ export const ServerListScreen: React.FC = ({ title="Connect to indexer" goBack={() => { clear(); - goBack(); }} /> diff --git a/app/utils/Utils.ts b/app/utils/Utils.ts index 851b26925..cea88dc69 100644 --- a/app/utils/Utils.ts +++ b/app/utils/Utils.ts @@ -596,3 +596,7 @@ export async function getIndexerList(): Promise { console.log('json', json.data.indexers); return json.data.indexers; } + +export function formatAmount(value: number) { + return `${value.toFixed(2)} cTAZ`; +} diff --git a/components/Staking/Finalizers/FinalizerPosition.tsx b/components/Staking/Finalizers/FinalizerPosition.tsx index 08d63dcbe..881897e5a 100644 --- a/components/Staking/Finalizers/FinalizerPosition.tsx +++ b/components/Staking/Finalizers/FinalizerPosition.tsx @@ -9,6 +9,7 @@ import { ViewStyle, } from 'react-native'; import { WalletBondsStatusEnum } from '../../../app/AppState/enums/WalletBondsStatusEnum'; +import { formatAmount } from '../../../app/utils/Utils'; export default interface WalletBondsType { txid: string; @@ -37,10 +38,6 @@ type WalletBondCardProps = { secondaryButtonStyle?: StyleProp; }; -function formatAmount(value: number) { - return `${value.toFixed(2)} cTAZ`; -} - function truncateMiddle(value: string, start = 10, end = 8) { if (!value) return ''; if (value.length <= start + end + 3) return value; diff --git a/components/Staking/components/Redelegate.tsx b/components/Staking/components/Redelegate.tsx index da3a33965..ff68e27c6 100644 --- a/components/Staking/components/Redelegate.tsx +++ b/components/Staking/components/Redelegate.tsx @@ -42,6 +42,7 @@ import Refresh from '../../../assets/icons/refresh.svg'; import RegText from '../../Components/RegText'; import { WalletBondsStatusEnum } from '../../../app/AppState/enums/WalletBondsStatusEnum'; import ZecAmount from '../../Components/ZecAmount'; +import { ChevronRight } from 'lucide-react-native'; type ModalState = 'idle' | 'sending' | 'success'; @@ -322,18 +323,6 @@ const Redelegate: React.FC = ({ route }) => { }} /> - - Finalizers addresses - = ({ route }) => { alignItems: 'center', borderRadius: 20, marginBottom: 10, - backgroundColor: colors.secondary, padding: 16, marginHorizontal: 10, + marginTop: 20, borderWidth: 0.5, - borderColor: colors.text, + borderColor: '#575757', }} > = ({ route }) => { {!!stakedFromNumber && ( {`Staked: ${stakedFromNumber.toFixed(5)} ${info.currencyName}`} )} @@ -470,11 +459,12 @@ const Redelegate: React.FC = ({ route }) => { alignItems: 'center', borderRadius: 20, marginBottom: 10, - backgroundColor: colors.secondary, + backgroundColor: '#161616', + padding: 16, marginHorizontal: 10, borderWidth: 0.5, - borderColor: colors.text, + borderColor: '#575757', marginTop: -15, }} > @@ -552,7 +542,7 @@ const Redelegate: React.FC = ({ route }) => { )} - navigation.navigate(RouteEnum.Finalizers, { setFinalizer: (f: string, s: number) => { diff --git a/components/Staking/components/Unstake.tsx b/components/Staking/components/Unstake.tsx index e85ad90be..16e83f6bd 100644 --- a/components/Staking/components/Unstake.tsx +++ b/components/Staking/components/Unstake.tsx @@ -335,11 +335,11 @@ const Unstake: React.FC = ({ route }) => { alignItems: 'center', borderRadius: 20, marginBottom: 10, - backgroundColor: colors.secondary, + backgroundColor: '#161616', padding: 16, marginHorizontal: 10, borderWidth: 0.5, - borderColor: colors.text, + borderColor: '#575757', }} > = ({ route }) => { {!!stakedFromNumber && ( {`Staked: ${stakedFromNumber.toFixed(5)} ${info.currencyName}`} )}