Skip to content

Commit 5e8b88e

Browse files
committed
start redesign
1 parent a38dc9f commit 5e8b88e

File tree

2 files changed

+218
-30
lines changed

2 files changed

+218
-30
lines changed
Lines changed: 105 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,132 @@
1-
import { StatusBar } from "expo-status-bar";
2-
import { Button, Modal, StyleSheet, Text, View } from "react-native";
1+
import { StyleSheet, View } from "react-native";
2+
import { Button, Layout, Modal, Text } from "@ui-kitten/components";
33
import { useLocalSearchParams, useRouter } from "expo-router";
44
import { useState } from "react";
55
import { useFacade } from "../../../data/facades";
66

7+
import { RemoveAccount as RemoveAccountIcon } from "@/svgs/RemoveAccount";
8+
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

16+
const handleRemove = async () => {
17+
await removeAccount.mutateAsync({ name: accountName });
18+
setModalVisible(false);
19+
router.dismissAll();
20+
};
21+
1722
return (
18-
<View style={styles.container}>
19-
<Modal visible={modalVisible} animationType="slide">
20-
<View style={styles.container}>
21-
<Text>Are you sure?</Text>
23+
<Layout style={styles.container}>
24+
{/* Confirmation Modal */}
25+
<Modal
26+
visible={modalVisible}
27+
backdropStyle={styles.backdrop}
28+
onBackdropPress={() => setModalVisible(false)}
29+
>
30+
<View style={styles.modalContainer}>
31+
<Text category="h4" style={styles.modalTitle}>
32+
Are you sure?
33+
</Text>
2234
<Button
23-
title="Yes, remove account"
24-
onPress={async () => {
25-
await removeAccount.mutateAsync({ name: accountName });
26-
setModalVisible(false);
27-
router.dismissAll();
28-
}}
29-
/>
35+
style={styles.button}
36+
status="danger"
37+
onPress={handleRemove}
38+
disabled={removeAccount.isPending}
39+
>
40+
{removeAccount.isPending ? "Removing..." : "Yes, remove account"}
41+
</Button>
3042
<Button
31-
title="I changed my mind"
43+
style={styles.button}
44+
appearance="ghost"
3245
onPress={() => setModalVisible(false)}
33-
/>
46+
>
47+
I changed my mind
48+
</Button>
3449
</View>
3550
</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()} />
4451

45-
<StatusBar style="auto" />
46-
</View>
52+
{/* Main Screen */}
53+
<View style={styles.content}>
54+
<RemoveAccountIcon />
55+
<Text category="h3" style={styles.title}>
56+
Remove Account:
57+
</Text>
58+
<Text category="h4" style={styles.subtitle}>
59+
{accountName}
60+
</Text>
61+
<Text style={styles.description}>
62+
Even though you are removing this account, you're still able to import
63+
it at another time. Please be sure to backup your accounts.
64+
</Text>
65+
<View style={styles.buttonContainer}>
66+
<Button
67+
style={styles.button}
68+
status="danger"
69+
onPress={() => setModalVisible(true)}
70+
>
71+
Remove
72+
</Button>
73+
<Button
74+
style={styles.button}
75+
appearance="ghost"
76+
onPress={() => router.dismiss()}
77+
>
78+
Cancel
79+
</Button>
80+
</View>
81+
</View>
82+
</Layout>
4783
);
4884
}
4985

5086
const styles = StyleSheet.create({
5187
container: {
5288
flex: 1,
53-
backgroundColor: "#fff",
89+
},
90+
content: {
91+
flex: 1,
5492
alignItems: "center",
55-
justifyContent: "center",
93+
padding: 24,
94+
gap: 16,
95+
},
96+
title: {
97+
marginTop: 24,
98+
textAlign: "center",
99+
},
100+
subtitle: {
101+
textAlign: "center",
102+
},
103+
description: {
104+
textAlign: "center",
105+
color: "#666",
106+
marginTop: 8,
107+
},
108+
buttonContainer: {
109+
width: "100%",
110+
marginTop: "auto",
111+
gap: 8,
112+
},
113+
button: {
114+
width: "100%",
115+
},
116+
// Modal styles
117+
backdrop: {
118+
backgroundColor: "rgba(0, 0, 0, 0.5)",
119+
},
120+
modalContainer: {
121+
backgroundColor: "white",
122+
padding: 24,
123+
borderRadius: 16,
124+
width: "90%",
125+
alignSelf: "center",
126+
gap: 16,
127+
},
128+
modalTitle: {
129+
textAlign: "center",
130+
marginBottom: 8,
56131
},
57132
});

0 commit comments

Comments
 (0)