Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/LoadingApp/LoadingApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 && (
Expand Down
23 changes: 15 additions & 8 deletions app/LoadingApp/components/ConnectIndexer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,14 @@ const ConnectIndexer: React.FunctionComponent<ConnectIndexerProps> = ({

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<string>(
custom ? base : '',
Expand Down Expand Up @@ -116,7 +123,13 @@ const ConnectIndexer: React.FunctionComponent<ConnectIndexerProps> = ({
: (translate('info.unknown') as string) + ' (' + chain + ')';
};

//console.log('Render Servers', insets);
console.log(
'Render Servers',
indexerServerContext,
indexerServerUriLocal,
indexerServerPortLocal,
indexerServerChainNameLocal,
);

return (
<ToastProvider>
Expand Down Expand Up @@ -523,12 +536,6 @@ const ConnectIndexer: React.FunctionComponent<ConnectIndexerProps> = ({
setConnected(null);
setBorderColor('transparent');
// add http if it not have it
if (
!indexerServerUriLocal
.toLowerCase()
.startsWith(GlobalConst.http)
) {
}
const {
result: _connected,
indexerServerUriParsed: _indexerServerUri,
Expand Down
2 changes: 1 addition & 1 deletion app/LoadingApp/components/SelectNetwork.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const SelectNetwork: React.FunctionComponent<SelectNetworkProps> = ({
};
}, []);

console.log('Render Select Network', indexerServerContext);
console.log('Render Select Network', fromSettings);

return (
<ToastProvider>
Expand Down
11 changes: 9 additions & 2 deletions app/LoadingApp/components/ServerListScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export type ServerListScreenProps = {
indexerList: IndexerList;
closeServers: () => void;
goBack: () => void;
previousServer?: string;
};

export const ServerListScreen: React.FC<ServerListScreenProps> = ({
Expand All @@ -46,12 +47,19 @@ export const ServerListScreen: React.FC<ServerListScreenProps> = ({
indexerList,
closeServers,
goBack,
previousServer,
}) => {
const { colors } = useTheme() as unknown as ThemeType; // TODO: FIX
const insets = useSafeAreaInsets();
const { clear } = useToast();

const [selectedServer, setSelectedServer] = useState<Indexer | null>(null);
const prevIndexer = indexerList.find(
indexer => indexer.url === previousServer,
);

const [selectedServer, setSelectedServer] = useState<Indexer | null>(
prevIndexer ? prevIndexer : null,
);
const [connected, setConnected] = useState<boolean | null>(null);
const [borderColor, setBorderColor] = useState<string>('transparent');
const [isTestingSelected, setIsTestingSelected] = useState(false);
Expand Down Expand Up @@ -116,7 +124,6 @@ export const ServerListScreen: React.FC<ServerListScreenProps> = ({
title="Connect to indexer"
goBack={() => {
clear();

goBack();
}}
/>
Expand Down
4 changes: 4 additions & 0 deletions app/utils/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -596,3 +596,7 @@ export async function getIndexerList(): Promise<IndexerList> {
console.log('json', json.data.indexers);
return json.data.indexers;
}

export function formatAmount(value: number) {
return `${value.toFixed(2)} cTAZ`;
}
5 changes: 1 addition & 4 deletions components/Staking/Finalizers/FinalizerPosition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -37,10 +38,6 @@ type WalletBondCardProps = {
secondaryButtonStyle?: StyleProp<ViewStyle>;
};

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;
Expand Down
26 changes: 8 additions & 18 deletions components/Staking/components/Redelegate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -322,30 +323,18 @@ const Redelegate: React.FC<RedelegateProps> = ({ route }) => {
}}
/>

<Text
style={{
fontSize: 16,
fontWeight: '600',
color: colors.text,
marginBottom: 8,
marginTop: 15,
marginHorizontal: 20,
}}
>
Finalizers addresses
</Text>
<View
style={{
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
borderRadius: 20,
marginBottom: 10,
backgroundColor: colors.secondary,
padding: 16,
marginHorizontal: 10,
marginTop: 20,
borderWidth: 0.5,
borderColor: colors.text,
borderColor: '#575757',
}}
>
<View
Expand Down Expand Up @@ -418,7 +407,7 @@ const Redelegate: React.FC<RedelegateProps> = ({ route }) => {
</View>
{!!stakedFromNumber && (
<FadeText
style={{ marginLeft: 15, marginBottom: 5 }}
style={{ marginBottom: 5 }}
>{`Staked: ${stakedFromNumber.toFixed(5)} ${info.currencyName}`}</FadeText>
)}
</View>
Expand Down Expand Up @@ -470,11 +459,12 @@ const Redelegate: React.FC<RedelegateProps> = ({ 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,
}}
>
Expand Down Expand Up @@ -552,7 +542,7 @@ const Redelegate: React.FC<RedelegateProps> = ({ route }) => {
)}
</View>
</View>
<ChevronDown
<ChevronRight
onPress={() =>
navigation.navigate(RouteEnum.Finalizers, {
setFinalizer: (f: string, s: number) => {
Expand Down
6 changes: 3 additions & 3 deletions components/Staking/components/Unstake.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,11 @@ const Unstake: React.FC<UnstakeProps> = ({ route }) => {
alignItems: 'center',
borderRadius: 20,
marginBottom: 10,
backgroundColor: colors.secondary,
backgroundColor: '#161616',
padding: 16,
marginHorizontal: 10,
borderWidth: 0.5,
borderColor: colors.text,
borderColor: '#575757',
}}
>
<View
Expand Down Expand Up @@ -412,7 +412,7 @@ const Unstake: React.FC<UnstakeProps> = ({ route }) => {
</View>
{!!stakedFromNumber && (
<FadeText
style={{ marginLeft: 15, marginBottom: 5 }}
style={{ marginBottom: 5 }}
>{`Staked: ${stakedFromNumber.toFixed(5)} ${info.currencyName}`}</FadeText>
)}
</View>
Expand Down
Loading