Skip to content

Commit 0d3e4ad

Browse files
committed
merge main
2 parents d110df0 + eaee4c1 commit 0d3e4ad

File tree

29 files changed

+1146
-784
lines changed

29 files changed

+1146
-784
lines changed

package-lock.json

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { StatusBar } from "expo-status-bar";
21
import { StyleSheet } from "react-native";
32
import { Stack, useRouter } from "expo-router";
43
import { useFacade } from "@/data/facades";
54
import { CurrencyUtils } from "@ironfish/sdk";
6-
import { Layout, Text, Button, Card } from "@ui-kitten/components";
5+
import { Layout, Text, Button, Card, Spinner } from "@ui-kitten/components";
6+
import React from "react";
77

88
export default function AccountSelect() {
99
const router = useRouter();
@@ -15,6 +15,12 @@ export default function AccountSelect() {
1515

1616
const setActiveAccount = facade.setActiveAccount.useMutation();
1717

18+
const renderLoadingSkeleton = () => (
19+
<Layout style={[styles.content, styles.loadingContainer]}>
20+
<Spinner size="large" />
21+
</Layout>
22+
);
23+
1824
return (
1925
<>
2026
<Stack.Screen
@@ -25,33 +31,35 @@ export default function AccountSelect() {
2531
/>
2632
<Layout style={styles.container}>
2733
<Layout style={styles.content}>
28-
{getAccountsResult.data?.map((account) => (
29-
<Card
30-
key={account.name}
31-
style={styles.accountCard}
32-
onPress={async () => {
33-
const result = await setActiveAccount.mutateAsync({
34-
name: account.name,
35-
});
36-
console.log(`setActiveAccount: ${result}`);
37-
router.dismissAll();
38-
}}
39-
>
40-
<Layout style={styles.accountInfo}>
41-
<Layout>
42-
<Text category="s1">{account.name}</Text>
43-
<Text category="p2" appearance="hint">
44-
{`${CurrencyUtils.render(account.balances.iron.confirmed)} $IRON`}
45-
</Text>
46-
</Layout>
47-
{account.active && (
48-
<Text status="success" category="c1">
49-
Active
50-
</Text>
51-
)}
52-
</Layout>
53-
</Card>
54-
))}
34+
{getAccountsResult.isLoading
35+
? renderLoadingSkeleton()
36+
: getAccountsResult.data?.map((account) => (
37+
<Card
38+
key={account.name}
39+
style={styles.accountCard}
40+
onPress={async () => {
41+
const result = await setActiveAccount.mutateAsync({
42+
name: account.name,
43+
});
44+
console.log(`setActiveAccount: ${result}`);
45+
router.dismissAll();
46+
}}
47+
>
48+
<Layout style={styles.accountInfo}>
49+
<Layout>
50+
<Text category="s1">{account.name}</Text>
51+
<Text category="p2" appearance="hint">
52+
{`${CurrencyUtils.render(account.balances.iron.confirmed)} $IRON`}
53+
</Text>
54+
</Layout>
55+
{account.active && (
56+
<Text status="success" category="c1">
57+
Active
58+
</Text>
59+
)}
60+
</Layout>
61+
</Card>
62+
))}
5563
<Button
5664
style={styles.addButton}
5765
onPress={() =>
@@ -61,7 +69,6 @@ export default function AccountSelect() {
6169
Add Account
6270
</Button>
6371
</Layout>
64-
<StatusBar style="auto" />
6572
</Layout>
6673
</>
6774
);
@@ -88,4 +95,8 @@ const styles = StyleSheet.create({
8895
addButton: {
8996
marginTop: 8,
9097
},
98+
loadingContainer: {
99+
justifyContent: "center",
100+
alignItems: "center",
101+
},
91102
});

packages/mobile-app/app/(drawer)/account/account-settings/add-account/create.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { StatusBar } from "expo-status-bar";
21
import { Button, StyleSheet, TextInput, View } from "react-native";
32
import { useRouter } from "expo-router";
43
import { useState } from "react";
@@ -26,7 +25,6 @@ export default function CreateAccount() {
2625
router.dismissAll();
2726
}}
2827
/>
29-
<StatusBar style="auto" />
3028
</View>
3129
);
3230
}
Lines changed: 10 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,11 @@
1-
import { StatusBar } from "expo-status-bar";
2-
import { StyleSheet, View } from "react-native";
3-
import { useRouter, Stack } from "expo-router";
4-
import { useState } from "react";
5-
import { useFacade } from "@/data/facades";
6-
import {
7-
Layout,
8-
Text,
9-
Card,
10-
Button,
11-
Input,
12-
Modal,
13-
Spinner,
14-
} from "@ui-kitten/components";
1+
import { Stack } from "expo-router";
2+
import { useRouter } from "expo-router";
3+
import { Layout } from "@ui-kitten/components";
4+
import { StyleSheet } from "react-native";
5+
import { EncodedImport } from "@/components/EncodedImport/EncodedImport";
156

16-
const LoadingIndicator = () => (
17-
<View style={styles.loadingContainer}>
18-
<Spinner size="small" status="basic" />
19-
</View>
20-
);
21-
22-
export default function ImportEncoded() {
7+
export default function ImportEncodedScreen() {
238
const router = useRouter();
24-
const [modalVisible, setModalVisible] = useState(false);
25-
const [accountName, setAccountName] = useState("Account Name");
26-
const [encodedAccount, setEncodedAccount] = useState("");
27-
28-
const facade = useFacade();
29-
const importAccount = facade.importAccount.useMutation();
309

3110
return (
3211
<>
@@ -38,82 +17,10 @@ export default function ImportEncoded() {
3817
/>
3918

4019
<Layout style={styles.container} level="1">
41-
<Modal
42-
visible={modalVisible}
43-
backdropStyle={styles.backdrop}
44-
onBackdropPress={() => setModalVisible(false)}
45-
>
46-
<Card disabled style={styles.modalCard}>
47-
<Text category="h6" style={styles.modalTitle}>
48-
Account Imported!
49-
</Text>
50-
<Text style={styles.modalText} appearance="hint">
51-
Before you start managing your digital assets, we need to scan the
52-
blockchain. This may take some time.
53-
</Text>
54-
<Button
55-
onPress={async () => {
56-
router.dismissAll();
57-
setModalVisible(false);
58-
}}
59-
style={styles.modalButton}
60-
>
61-
Let's go!
62-
</Button>
63-
</Card>
64-
</Modal>
65-
66-
<Card disabled style={styles.card}>
67-
<Text category="h6" style={styles.title}>
68-
Encoded Key Import
69-
</Text>
70-
71-
<Text appearance="hint" style={styles.description}>
72-
Paste the complete string into the provided text field below.
73-
</Text>
74-
75-
<Input
76-
label="Account Name"
77-
placeholder="Enter account name"
78-
value={accountName}
79-
onChangeText={setAccountName}
80-
style={styles.input}
81-
size="large"
82-
/>
83-
84-
<Input
85-
label="Encoded Key"
86-
placeholder="Paste your encoded key here"
87-
value={encodedAccount}
88-
onChangeText={setEncodedAccount}
89-
style={styles.input}
90-
size="large"
91-
multiline
92-
textStyle={styles.encodedInput}
93-
/>
94-
95-
<Button
96-
style={styles.button}
97-
size="large"
98-
onPress={async () => {
99-
await importAccount.mutateAsync({
100-
account: encodedAccount,
101-
name: accountName,
102-
});
103-
setModalVisible(true);
104-
}}
105-
accessoryLeft={
106-
importAccount.isPending ? LoadingIndicator : undefined
107-
}
108-
disabled={
109-
importAccount.isPending || !encodedAccount || !accountName
110-
}
111-
>
112-
{importAccount.isPending ? "Importing..." : "Import Account"}
113-
</Button>
114-
</Card>
115-
116-
<StatusBar style="auto" />
20+
<EncodedImport
21+
onSuccess={() => router.dismissAll()}
22+
showSuccessModal={true}
23+
/>
11724
</Layout>
11825
</>
11926
);
@@ -124,49 +31,4 @@ const styles = StyleSheet.create({
12431
flex: 1,
12532
padding: 16,
12633
},
127-
card: {
128-
marginVertical: 8,
129-
borderRadius: 12,
130-
},
131-
title: {
132-
textAlign: "center",
133-
marginBottom: 8,
134-
},
135-
description: {
136-
textAlign: "center",
137-
marginBottom: 24,
138-
},
139-
input: {
140-
marginBottom: 16,
141-
},
142-
encodedInput: {
143-
minHeight: 80,
144-
textAlignVertical: "top",
145-
},
146-
button: {
147-
marginTop: 8,
148-
},
149-
backdrop: {
150-
backgroundColor: "rgba(0, 0, 0, 0.5)",
151-
},
152-
modalCard: {
153-
borderRadius: 12,
154-
margin: 24,
155-
padding: 16,
156-
},
157-
modalTitle: {
158-
textAlign: "center",
159-
marginVertical: 16,
160-
},
161-
modalText: {
162-
textAlign: "center",
163-
marginBottom: 24,
164-
},
165-
modalButton: {
166-
marginTop: 8,
167-
},
168-
loadingContainer: {
169-
justifyContent: "center",
170-
alignItems: "center",
171-
},
17234
});
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { Stack } from "expo-router";
2+
import { useRouter } from "expo-router";
3+
import { Layout } from "@ui-kitten/components";
4+
import { StyleSheet } from "react-native";
5+
import { FileImport } from "@/components/FileImport/FileImport";
6+
import React from "react";
7+
8+
export default function ImportFileScreen() {
9+
const router = useRouter();
10+
11+
return (
12+
<React.Fragment>
13+
<Stack.Screen
14+
options={{
15+
headerTitle: "Account Import",
16+
headerBackTitle: "Back",
17+
}}
18+
/>
19+
20+
<Layout style={styles.container} level="1">
21+
<FileImport
22+
onSuccess={() => router.dismissAll()}
23+
showSuccessModal={true}
24+
/>
25+
</Layout>
26+
</React.Fragment>
27+
);
28+
}
29+
30+
const styles = StyleSheet.create({
31+
container: {
32+
flex: 1,
33+
padding: 16,
34+
},
35+
});
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { Stack } from "expo-router";
2+
import { useRouter } from "expo-router";
3+
import { Layout } from "@ui-kitten/components";
4+
import { StyleSheet } from "react-native";
5+
import { MnemonicImport } from "@/components/MnemonicImport/MnemonicImport";
6+
7+
export default function ImportMnemonicScreen() {
8+
const router = useRouter();
9+
10+
return (
11+
<>
12+
<Stack.Screen
13+
options={{
14+
headerTitle: "Account Import",
15+
headerBackTitle: "Back",
16+
}}
17+
/>
18+
19+
<Layout style={styles.container} level="1">
20+
<MnemonicImport
21+
onSuccess={() => router.dismissAll()}
22+
showSuccessModal={true}
23+
/>
24+
</Layout>
25+
</>
26+
);
27+
}
28+
29+
const styles = StyleSheet.create({
30+
container: {
31+
flex: 1,
32+
padding: 16,
33+
},
34+
});

0 commit comments

Comments
 (0)