-
-
Notifications
You must be signed in to change notification settings - Fork 73
/
ServiceSelector.tsx
138 lines (124 loc) · 4.37 KB
/
ServiceSelector.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
import React, { useState } from "react";
import type { Screen } from "@/router/helpers/types";
import { useTheme } from "@react-navigation/native";
import { CircleDashed, Star } from "lucide-react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { Image, View, StyleSheet, StatusBar, ScrollView } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
import Reanimated, { LinearTransition, FlipInXDown } from "react-native-reanimated";
import PapillonShineBubble from "@/components/FirstInstallation/PapillonShineBubble";
import { AccountService } from "@/stores/account/types";
import { useCurrentAccount } from "@/stores/account";
import DuoListPressable from "@/components/FirstInstallation/DuoListPressable";
import ButtonCta from "@/components/FirstInstallation/ButtonCta";
const ExternalAccountSelector: Screen<"ExternalAccountSelector"> = ({ navigation, route }) => {
const theme = useTheme();
const { colors } = theme;
const insets = useSafeAreaInsets();
const account = useCurrentAccount(store => store.account!);
type Service = AccountService | "Other";
const [service, setService] = useState<Service | null>(null);
return (
<SafeAreaView
style={styles.container}
>
<PapillonShineBubble
message={"Pour commencer, quel est ton service de cantine ?"}
width={250}
numberOfLines={2}
offsetTop={insets.top}
/>
<Reanimated.View
style={styles.list}
layout={LinearTransition}
>
<Reanimated.View
style={{ width: "100%" }}
layout={LinearTransition}
entering={FlipInXDown.springify().delay(100)}
>
<DuoListPressable
leading={<Image source={require("../../../../assets/images/service_turboself.png")} style={styles.image} />}
text="Turboself"
enabled={service === AccountService.Turboself}
onPress={() => setService(AccountService.Turboself)}
/>
</Reanimated.View>
<Reanimated.View
style={{ width: "100%" }}
layout={LinearTransition}
entering={FlipInXDown.springify().delay(200)}
>
<DuoListPressable
leading={<Image source={require("../../../../assets/images/service_ard.png")} style={styles.image} />}
text="ARD"
enabled={service === AccountService.ARD}
onPress={() => setService(AccountService.ARD)}
/>
</Reanimated.View>
<Reanimated.View
style={{ width: "100%" }}
layout={LinearTransition}
entering={FlipInXDown.springify().delay(200)}
>
<DuoListPressable
leading={<Image source={require("../../../../assets/images/service_izly.png")} style={styles.image} />}
text="Izly"
enabled={service === AccountService.Izly}
onPress={() => setService(AccountService.Izly)}
/>
</Reanimated.View>
<Reanimated.View
style={{ width: "100%" }}
layout={LinearTransition}
entering={FlipInXDown.springify().delay(200)}
>
<DuoListPressable
leading={<Image source={require("../../../../assets/images/service_alise.png")} style={styles.image} />}
text="Alise"
enabled={service === AccountService.Alise}
onPress={() => setService(AccountService.Alise)}
/>
</Reanimated.View>
</Reanimated.View>
<View style={styles.buttons}>
<ButtonCta
primary
value="Confirmer"
disabled={!service || service === "Other"}
onPress={() => {
if (service) {
navigation.navigate("ExternalAccountSelectMethod", { service });
}
}}
/>
</View>
</SafeAreaView>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: "center",
gap: 20,
},
list: {
flex: 1,
width: "100%",
alignItems: "center",
gap: 9,
paddingHorizontal: 20,
},
buttons: {
width: "100%",
paddingHorizontal: 16,
gap: 9,
marginBottom: 16,
},
image: {
width: 32,
height: 32,
borderRadius: 80,
},
});
export default ExternalAccountSelector;