Skip to content

Commit b4deb17

Browse files
committed
remove account ui
1 parent 997b97b commit b4deb17

File tree

2 files changed

+247
-36
lines changed

2 files changed

+247
-36
lines changed
Lines changed: 133 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,154 @@
1-
import { StatusBar } from "expo-status-bar";
2-
import { Button, Modal, StyleSheet, Text, View } from "react-native";
3-
import { useLocalSearchParams, useRouter } from "expo-router";
1+
import React from "react";
2+
import { StyleSheet, View } from "react-native";
3+
import { useLocalSearchParams, useRouter, Stack } from "expo-router";
44
import { useState } from "react";
55
import { useFacade } from "@/data/facades";
6+
import { Button, Card, Layout, Modal, Text } from "@ui-kitten/components";
7+
import { RemoveAccount as RemoveAccountIcon } from "@/svgs/RemoveAccount";
68

79
export default function RemoveAccount() {
810
const router = useRouter();
911
const facade = useFacade();
10-
1112
const { accountName } = useLocalSearchParams<{ accountName: string }>();
12-
1313
const removeAccount = facade.removeAccount.useMutation();
14-
1514
const [modalVisible, setModalVisible] = useState(false);
1615

1716
return (
18-
<View style={styles.container}>
19-
<Modal visible={modalVisible} animationType="slide">
20-
<View style={styles.container}>
21-
<Text>Are you sure?</Text>
22-
<Button
23-
title="Yes, remove account"
24-
onPress={async () => {
25-
await removeAccount.mutateAsync({ name: accountName });
26-
setModalVisible(false);
27-
router.dismissAll();
28-
}}
29-
/>
30-
<Button
31-
title="I changed my mind"
32-
onPress={() => setModalVisible(false)}
33-
/>
34-
</View>
35-
</Modal>
36-
<Button title="Back" onPress={() => router.dismissAll()} />
37-
<Text>Remove Account</Text>
38-
<Text>
39-
Even though you are removing this account, you’re still able to import
40-
it at another time. Please be sure to backup your accounts.
41-
</Text>
42-
<Button title="Remove" onPress={() => setModalVisible(true)} />
43-
<Button title="Cancel" onPress={() => router.dismiss()} />
17+
<>
18+
<Stack.Screen
19+
options={{
20+
headerTitle: "Remove Account",
21+
headerBackTitle: "Back",
22+
}}
23+
/>
24+
25+
<Layout style={styles.container} level="1">
26+
<Modal
27+
visible={modalVisible}
28+
backdropStyle={styles.backdrop}
29+
onBackdropPress={() => setModalVisible(false)}
30+
>
31+
<Card disabled style={styles.modalCard}>
32+
<Text category="h6" style={styles.modalTitle}>
33+
Are you sure?
34+
</Text>
35+
<Button
36+
style={[styles.modalButton, styles.removeButton]}
37+
onPress={async () => {
38+
await removeAccount.mutateAsync({ name: accountName });
39+
setModalVisible(false);
40+
router.dismissAll();
41+
}}
42+
>
43+
Yes, remove account
44+
</Button>
45+
<Button
46+
style={styles.modalButton}
47+
appearance="ghost"
48+
onPress={() => setModalVisible(false)}
49+
>
50+
I changed my mind
51+
</Button>
52+
</Card>
53+
</Modal>
54+
55+
<View style={styles.content}>
56+
<View style={styles.ctaContainer}>
57+
<RemoveAccountIcon />
58+
<Text category="s1" style={styles.title}>
59+
Remove Account:
60+
</Text>
61+
<Text category="s1" style={styles.accountName}>
62+
{accountName}
63+
</Text>
4464

45-
<StatusBar style="auto" />
46-
</View>
65+
<Text style={styles.description} appearance="hint">
66+
Even though you are removing this account, you're still able to
67+
import it at another time. Please be sure to backup your accounts.
68+
</Text>
69+
</View>
70+
71+
<View style={styles.buttonContainer}>
72+
<Button
73+
style={[styles.button, styles.removeButton]}
74+
onPress={() => setModalVisible(true)}
75+
>
76+
Remove
77+
</Button>
78+
<Button
79+
style={styles.button}
80+
appearance="ghost"
81+
status="basic"
82+
onPress={() => router.dismiss()}
83+
>
84+
Cancel
85+
</Button>
86+
</View>
87+
</View>
88+
</Layout>
89+
</>
4790
);
4891
}
4992

5093
const styles = StyleSheet.create({
5194
container: {
5295
flex: 1,
53-
backgroundColor: "#fff",
96+
},
97+
content: {
98+
flex: 1,
99+
padding: 16,
100+
alignItems: "center",
101+
gap: 16,
102+
justifyContent: "space-between",
103+
},
104+
ctaContainer: {
54105
alignItems: "center",
55-
justifyContent: "center",
106+
gap: 8,
107+
marginTop: 40,
108+
},
109+
title: {
110+
textAlign: "center",
111+
letterSpacing: 0.8,
112+
fontSize: 24,
113+
},
114+
accountName: {
115+
textAlign: "center",
116+
fontSize: 24,
117+
letterSpacing: 0.8,
118+
},
119+
description: {
120+
textAlign: "center",
121+
paddingHorizontal: 20,
122+
fontSize: 16,
123+
lineHeight: 24,
124+
marginTop: 24,
125+
},
126+
buttonContainer: {
127+
width: "100%",
128+
gap: 8,
129+
marginBottom: 16,
130+
},
131+
button: {
132+
borderRadius: 8,
133+
},
134+
removeButton: {
135+
backgroundColor: "#F15929",
136+
borderColor: "#F15929",
137+
},
138+
backdrop: {
139+
backgroundColor: "rgba(0, 0, 0, 0.5)",
140+
},
141+
modalCard: {
142+
borderRadius: 12,
143+
margin: 24,
144+
padding: 16,
145+
},
146+
modalTitle: {
147+
textAlign: "center",
148+
marginBottom: 24,
149+
},
150+
modalButton: {
151+
marginTop: 8,
152+
borderRadius: 8,
56153
},
57154
});

0 commit comments

Comments
 (0)