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
2 changes: 1 addition & 1 deletion app/LoadingApp/components/ConnectIndexer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ const ConnectIndexer: React.FunctionComponent<ConnectIndexerProps> = ({
}}
>
<TextInput
placeholder={'e.g. 18232'}
placeholder={'e.g. 18234'}
placeholderTextColor={colors.placeholder}
style={{
flexGrow: 1,
Expand Down
23 changes: 23 additions & 0 deletions app/LoadingApp/components/SelectNetwork.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { faChevronRight } from '@fortawesome/free-solid-svg-icons';
import ComputerBlue from '../../../assets/icons/computer-blue.svg';
import ComputerWhite from '../../../assets/icons/computer-white.svg';
import { HeaderTitle } from '../../../components/Header';
import { serverUris } from '../../uris';

type SelectNetworkProps = {
actionButtonsDisabled: boolean;
Expand All @@ -42,6 +43,7 @@ const SelectNetwork: React.FunctionComponent<SelectNetworkProps> = ({
fromSettings,
goConnectIndexer,
goAvailableServers,
setIndexerServer,
}) => {
const context = useContext(ContextAppLoading);
const {
Expand All @@ -54,6 +56,15 @@ const SelectNetwork: React.FunctionComponent<SelectNetworkProps> = ({
const screenName = ScreenEnum.Servers;

const [kbOpen, setKbOpen] = useState(false);
const [indexerServerUriLocal] = useState<string>(
indexerServerContext.uri ? indexerServerContext.uri : serverUris()[0].uri,
);

const [, setIndexerServerChainNameLocal] = useState<ChainNameEnum>(
indexerServerContext.uri
? indexerServerContext.chainName
: serverUris()[0].chainName,
);

const insets = useSafeAreaInsets();

Expand Down Expand Up @@ -231,6 +242,11 @@ const SelectNetwork: React.FunctionComponent<SelectNetworkProps> = ({
style={{ width: '100%' }}
disabled={actionButtonsDisabled}
onPress={() => {
setIndexerServerChainNameLocal(ChainNameEnum.testChainName);
setIndexerServer(
indexerServerUriLocal,
ChainNameEnum.testChainName,
);
goConnectIndexer();
}}
>
Expand Down Expand Up @@ -323,6 +339,13 @@ const SelectNetwork: React.FunctionComponent<SelectNetworkProps> = ({
hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
disabled={actionButtonsDisabled}
onPress={() => {
setIndexerServerChainNameLocal(
ChainNameEnum.regtestChainName,
);
setIndexerServer(
indexerServerUriLocal,
ChainNameEnum.regtestChainName,
);
goConnectIndexer();
}}
>
Expand Down
2 changes: 1 addition & 1 deletion app/LoadingApp/components/ServerListScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export const ServerListScreen: React.FC<ServerListScreenProps> = ({
<View
style={{
marginHorizontal: 16,
borderRadius: 14,
borderRadius: 26,
overflow: 'hidden',
backgroundColor: IOS_GROUP_BG,
}}
Expand Down
249 changes: 123 additions & 126 deletions components/Staking/Finalizers/FinalizerDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
KeyboardAvoidingView,
Platform,
Text,
TouchableWithoutFeedback,
View,
Modal,
Keyboard,
Expand Down Expand Up @@ -145,155 +144,153 @@ export function FinalizerDetail({ route }: FinalizerDetailProps) {
};

return (
<TouchableWithoutFeedback onPress={Keyboard.dismiss} accessible={false}>
<KeyboardAvoidingView
<KeyboardAvoidingView
style={{
flex: 1,
backgroundColor: colors.background,
gap: 20,
}}
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
keyboardVerticalOffset={
Platform.OS === 'ios' ? insets.top : kbOpen ? insets.top : 0
}
>
<HeaderTitle
title="Finalizer Details"
goBack={() => {
if (navigation.canGoBack()) {
navigation.goBack();
}
}}
ExtraComponent={<StakingDayBubble />}
/>

<FinalizerCard
containerStyle={{
marginHorizontal: 20,
}}
lifehash={lifehash || ''}
finalizerId={finalizer || ''}
userStake={totalUserStaked}
totalStake={totalStakedFinalizer}
/>

{/* Content */}
<View
style={{
flex: 1,
backgroundColor: colors.background,
gap: 20,
paddingHorizontal: 24,
}}
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
keyboardVerticalOffset={
Platform.OS === 'ios' ? insets.top : kbOpen ? insets.top : 0
}
>
<HeaderTitle
title="Finalizer Details"
goBack={() => {
if (navigation.canGoBack()) {
navigation.goBack();
}
}}
ExtraComponent={<StakingDayBubble />}
/>

<FinalizerCard
containerStyle={{
marginHorizontal: 20,
{/* Staked TX list */}
<Text
style={{
fontSize: 16,
fontWeight: '600',
color: colors.text,
marginBottom: 8,
}}
lifehash={lifehash || ''}
finalizerId={finalizer || ''}
userStake={totalUserStaked}
totalStake={totalStakedFinalizer}
/>
>
Staking positions
</Text>

{/* Content */}
<View
style={{
flex: 1,
paddingHorizontal: 24,
marginBottom: 16,
}}
>
{/* Staked TX list */}
<Text
style={{
fontSize: 16,
fontWeight: '600',
color: colors.text,
marginBottom: 8,
}}
>
Staking positions
</Text>
<FlatList
data={movements}
keyExtractor={item => item.txid}
renderItem={renderStakedTxItem}
ItemSeparatorComponent={renderSeparator}
ListEmptyComponent={
<Text
style={{
color: colors.placeholder,
fontSize: 13,
textAlign: 'center',
marginTop: 16,
}}
>
You don&apos;t have any staking positions that match the
currently selected filters.
</Text>
}
/>
</View>
</View>

{/* Modal */}
<Modal
visible={modalVisible}
transparent
animationType="fade"
onRequestClose={() => {
if (modalState === 'success') {
setModalState('idle');
}
}}
>
<View style={styles.modalBackdrop}>
<View
style={{
flex: 1,
marginBottom: 16,
}}
style={[
styles.modalCard,
{
backgroundColor: colors.background,
borderColor: colors.border,
},
]}
>
<FlatList
data={movements}
keyExtractor={item => item.txid}
renderItem={renderStakedTxItem}
ItemSeparatorComponent={renderSeparator}
ListEmptyComponent={
{modalState === 'sending' && (
<>
<ActivityIndicator size="large" color={colors.text} />
<Text
style={{
color: colors.placeholder,
fontSize: 13,
textAlign: 'center',
marginTop: 16,
color: colors.text,
fontSize: 16,
textAlign: 'center',
}}
>
You don&apos;t have any staking positions that match the
currently selected filters.
Sending unstaking transaction…
</Text>
}
/>
</View>
</View>
</>
)}

{/* Modal */}
<Modal
visible={modalVisible}
transparent
animationType="fade"
onRequestClose={() => {
if (modalState === 'success') {
setModalState('idle');
}
}}
>
<View style={styles.modalBackdrop}>
<View
style={[
styles.modalCard,
{
backgroundColor: colors.background,
borderColor: colors.border,
},
]}
>
{modalState === 'sending' && (
<>
<ActivityIndicator size="large" color={colors.text} />
<Text
style={{
marginTop: 16,
color: colors.text,
fontSize: 16,
textAlign: 'center',
}}
>
Sending unstaking transaction…
</Text>
</>
)}
{modalState === 'success' && (
<>
<FontAwesomeIcon
icon={faCheckCircle}
size={40}
color={colors.primary}
/>
<Text
style={{
marginTop: 16,
color: colors.text,
fontSize: 18,
fontWeight: '600',
textAlign: 'center',
}}
>
Unstaking request transaction sent!
</Text>

{modalState === 'success' && (
<>
<FontAwesomeIcon
icon={faCheckCircle}
size={40}
color={colors.primary}
<View style={{ marginTop: 24, alignSelf: 'stretch' }}>
<LiquidPrimaryButton
title="View movements"
onPress={handleViewMovements}
style={{ alignSelf: 'stretch' }}
/>
<Text
style={{
marginTop: 16,
color: colors.text,
fontSize: 18,
fontWeight: '600',
textAlign: 'center',
}}
>
Unstaking request transaction sent!
</Text>

<View style={{ marginTop: 24, alignSelf: 'stretch' }}>
<LiquidPrimaryButton
title="View movements"
onPress={handleViewMovements}
style={{ alignSelf: 'stretch' }}
/>
</View>
</>
)}
</View>
</View>
</>
)}
</View>
</Modal>
</KeyboardAvoidingView>
</TouchableWithoutFeedback>
</View>
</Modal>
</KeyboardAvoidingView>
);
}

Expand Down
Loading