Skip to content

Commit 1551a2b

Browse files
committed
merge main
2 parents ef88cdc + eaee4c1 commit 1551a2b

File tree

29 files changed

+1147
-786
lines changed

29 files changed

+1147
-786
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: 42 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
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";
76
import { useHideBalances } from "@/hooks/useHideBalances";
87

98
export default function AccountSelect() {
@@ -17,6 +16,12 @@ export default function AccountSelect() {
1716

1817
const setActiveAccount = facade.setActiveAccount.useMutation();
1918

19+
const renderLoadingSkeleton = () => (
20+
<Layout style={[styles.content, styles.loadingContainer]}>
21+
<Spinner size="large" />
22+
</Layout>
23+
);
24+
2025
return (
2126
<>
2227
<Stack.Screen
@@ -27,35 +32,37 @@ export default function AccountSelect() {
2732
/>
2833
<Layout style={styles.container}>
2934
<Layout style={styles.content}>
30-
{getAccountsResult.data?.map((account) => (
31-
<Card
32-
key={account.name}
33-
style={styles.accountCard}
34-
onPress={async () => {
35-
const result = await setActiveAccount.mutateAsync({
36-
name: account.name,
37-
});
38-
console.log(`setActiveAccount: ${result}`);
39-
router.dismissAll();
40-
}}
41-
>
42-
<Layout style={styles.accountInfo}>
43-
<Layout>
44-
<Text category="s1">{account.name}</Text>
45-
<Text category="p2" appearance="hint">
46-
{hideBalances
47-
? `${balanceMask} $IRON`
48-
: `${CurrencyUtils.render(account.balances.iron.confirmed)} $IRON`}
49-
</Text>
50-
</Layout>
51-
{account.active && (
52-
<Text status="success" category="c1">
53-
Active
54-
</Text>
55-
)}
56-
</Layout>
57-
</Card>
58-
))}
35+
{getAccountsResult.isLoading
36+
? renderLoadingSkeleton()
37+
: getAccountsResult.data?.map((account) => (
38+
<Card
39+
key={account.name}
40+
style={styles.accountCard}
41+
onPress={async () => {
42+
const result = await setActiveAccount.mutateAsync({
43+
name: account.name,
44+
});
45+
console.log(`setActiveAccount: ${result}`);
46+
router.dismissAll();
47+
}}
48+
>
49+
<Layout style={styles.accountInfo}>
50+
<Layout>
51+
<Text category="s1">{account.name}</Text>
52+
<Text category="p2" appearance="hint">
53+
{hideBalances
54+
? `${balanceMask} $IRON`
55+
: `${CurrencyUtils.render(account.balances.iron.confirmed)} $IRON`}
56+
</Text>
57+
</Layout>
58+
{account.active && (
59+
<Text status="success" category="c1">
60+
Active
61+
</Text>
62+
)}
63+
</Layout>
64+
</Card>
65+
))}
5966
<Button
6067
style={styles.addButton}
6168
onPress={() =>
@@ -65,7 +72,6 @@ export default function AccountSelect() {
6572
Add Account
6673
</Button>
6774
</Layout>
68-
<StatusBar style="auto" />
6975
</Layout>
7076
</>
7177
);
@@ -92,4 +98,8 @@ const styles = StyleSheet.create({
9298
addButton: {
9399
marginTop: 8,
94100
},
101+
loadingContainer: {
102+
justifyContent: "center",
103+
alignItems: "center",
104+
},
95105
});

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)