Skip to content

Commit 606a720

Browse files
committed
merge main
2 parents db65ec2 + 7c0173d commit 606a720

File tree

46 files changed

+1407
-1008
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1407
-1008
lines changed

package-lock.json

Lines changed: 53 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/mobile-app/.env.template

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
EXPO_PUBLIC_DEMO_API=false
1+
EXPO_PUBLIC_DEMO_API=false
2+
EXPO_PUBLIC_DISABLE_PIN_LOCK=false
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { GestureHandlerRootView } from "react-native-gesture-handler";
2+
import { Drawer } from "expo-router/drawer";
3+
4+
export default function Layout() {
5+
return (
6+
<GestureHandlerRootView style={{ flex: 1 }}>
7+
<Drawer>
8+
<Drawer.Screen
9+
name="account"
10+
options={{
11+
headerShown: false,
12+
drawerLabel: "Account",
13+
}}
14+
/>
15+
<Drawer.Screen
16+
name="app-settings"
17+
options={{
18+
headerShown: false,
19+
drawerLabel: "App Settings",
20+
}}
21+
/>
22+
</Drawer>
23+
</GestureHandlerRootView>
24+
);
25+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import { Icon, useTheme, Text } from "@ui-kitten/components";
2+
import { useNavigation, useRouter } from "expo-router";
3+
import { Stack } from "expo-router/stack";
4+
import { TouchableOpacity, View } from "react-native";
5+
import { DrawerActions } from "@react-navigation/native";
6+
import { TouchableWithoutFeedback } from "react-native-gesture-handler";
7+
8+
function MenuIconButton({
9+
name,
10+
onPress,
11+
}: {
12+
name: string;
13+
onPress: () => void;
14+
}) {
15+
const theme = useTheme();
16+
return (
17+
<TouchableOpacity onPress={onPress}>
18+
<Icon
19+
name={name}
20+
fill={theme["color-primary-default"]}
21+
style={{
22+
height: 26,
23+
width: 26,
24+
}}
25+
/>
26+
</TouchableOpacity>
27+
);
28+
}
29+
30+
export default function Layout() {
31+
const navigation = useNavigation();
32+
const router = useRouter();
33+
const theme = useTheme();
34+
35+
return (
36+
<Stack>
37+
<Stack.Screen
38+
name="index"
39+
options={{
40+
title: "Loading...",
41+
headerTitle: (props) => (
42+
<TouchableWithoutFeedback
43+
onPress={() => {
44+
router.push(
45+
"/(drawer)/account/account-settings/account-select",
46+
);
47+
}}
48+
>
49+
<View
50+
style={{ flexDirection: "row", alignItems: "center", gap: 4 }}
51+
>
52+
<Text category="h6">{props.children}</Text>
53+
<Icon
54+
name="chevron-down-outline"
55+
fill={theme["text-basic-color"]}
56+
style={{
57+
height: 20,
58+
width: 20,
59+
}}
60+
/>
61+
</View>
62+
</TouchableWithoutFeedback>
63+
),
64+
headerLeft: () => (
65+
<MenuIconButton
66+
name="menu-outline"
67+
onPress={() => {
68+
navigation.dispatch(DrawerActions.openDrawer());
69+
}}
70+
/>
71+
),
72+
headerRight: () => (
73+
<MenuIconButton
74+
name="settings-outline"
75+
onPress={() => {
76+
router.push("/(drawer)/account/account-settings");
77+
}}
78+
/>
79+
),
80+
}}
81+
/>
82+
</Stack>
83+
);
84+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
import { StatusBar } from "expo-status-bar";
2+
import { StyleSheet } from "react-native";
3+
import { Stack, useRouter } from "expo-router";
4+
import { useFacade } from "@/data/facades";
5+
import { CurrencyUtils } from "@ironfish/sdk";
6+
import { Layout, Text, Button, Card } from "@ui-kitten/components";
7+
8+
export default function AccountSelect() {
9+
const router = useRouter();
10+
const facade = useFacade();
11+
12+
const getAccountsResult = facade.getAccounts.useQuery(undefined, {
13+
refetchInterval: 1000,
14+
});
15+
16+
const setActiveAccount = facade.setActiveAccount.useMutation();
17+
18+
return (
19+
<>
20+
<Stack.Screen
21+
options={{
22+
headerTitle: "Select Account",
23+
headerBackTitle: "Back",
24+
}}
25+
/>
26+
<Layout style={styles.container}>
27+
<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+
))}
55+
<Button
56+
style={styles.addButton}
57+
onPress={() =>
58+
router.push("/(drawer)/account/account-settings/add-account")
59+
}
60+
>
61+
Add Account
62+
</Button>
63+
</Layout>
64+
<StatusBar style="auto" />
65+
</Layout>
66+
</>
67+
);
68+
}
69+
70+
const styles = StyleSheet.create({
71+
container: {
72+
flex: 1,
73+
backgroundColor: "#fff",
74+
},
75+
content: {
76+
flex: 1,
77+
padding: 16,
78+
gap: 16,
79+
},
80+
accountCard: {
81+
marginVertical: 4,
82+
},
83+
accountInfo: {
84+
flexDirection: "row",
85+
justifyContent: "space-between",
86+
alignItems: "center",
87+
},
88+
addButton: {
89+
marginTop: 8,
90+
},
91+
});

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { StatusBar } from "expo-status-bar";
22
import { Button, StyleSheet, TextInput, View } from "react-native";
33
import { useRouter } from "expo-router";
44
import { useState } from "react";
5-
import { useFacade } from "../../data/facades";
5+
import { useFacade } from "@/data/facades";
66

77
export default function CreateAccount() {
88
const router = useRouter();

0 commit comments

Comments
 (0)