-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathItineraryGenerator3.jsx
208 lines (197 loc) · 7.08 KB
/
ItineraryGenerator3.jsx
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
import React, { useState } from 'react';
import { View, Text, TouchableOpacity, TextInput, ScrollView, StyleSheet } from 'react-native';
import { Ionicons } from '@expo/vector-icons';
import { Stack } from 'expo-router';
import { Colors } from 'react-native/Libraries/NewAppScreen';
const ItineraryGenerator3 = () => {
const [selectedHotelRatings, setSelectedHotelRatings] = useState([]);
const [selectedHotelTypes, setSelectedHotelTypes] = useState([]);
const [otherInterests, setOtherInterests] = useState([]);
const handleHotelRatingSelection = (rating) => {
if (selectedHotelRatings.includes(rating)) {
setSelectedHotelRatings(selectedHotelRatings.filter((r) => r !== rating));
} else {
setSelectedHotelRatings([...selectedHotelRatings, rating]);
}
};
const handleHotelTypeSelection = (type) => {
if (selectedHotelTypes.includes(type)) {
setSelectedHotelTypes(selectedHotelTypes.filter((t) => t !== type));
} else {
setSelectedHotelTypes([...selectedHotelTypes, type]);
}
};
const handleAddOtherInterest = () => {
setOtherInterests([...otherInterests, '']);
};
const handleOtherInterestChange = (index, value) => {
const updatedOtherInterests = [...otherInterests];
updatedOtherInterests[index] = value;
setOtherInterests(updatedOtherInterests);
};
return (
<ScrollView style={styles.container}>
<Stack.Screen
options={{
headerShown: false,
headerTransparent: true,
}}
/>
<View style={styles.section}>
<View style={styles.header}>
<TouchableOpacity onPress={() => navigation.navigate('Home')} >
<Ionicons name="chevron-back" size={24} color="black" />
</TouchableOpacity>
<Text style={styles.headerText}>Itinerary Generator</Text>
<View>
<TouchableOpacity onPress={() => alert('Notifications clicked!')}>
<Ionicons name='notifications-outline' size={24} color={Colors.black} style={styles.icon} />
</TouchableOpacity>
</View>
</View>
<Text style={styles.sectionTitle}>What are the ratings of the hotels you expect?</Text>
<Text style={{color: 'gray', marginTop: 5}}>Pick one or more categories</Text>
<TouchableOpacity
onPress={() => handleHotelRatingSelection('3 Star')}
style={[styles.button, selectedHotelRatings.includes('3 Star') && styles.selectedButton]}
>
<Text style={styles.buttonText}>3 Star</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => handleHotelRatingSelection('5 Star')}
style={[styles.button, selectedHotelRatings.includes('5 Star') && styles.selectedButton]}
>
<Text style={styles.buttonText}>5 Star</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => handleHotelRatingSelection('7 Star')}
style={[styles.button, selectedHotelRatings.includes('7 Star') && styles.selectedButton]}
>
<Text style={styles.buttonText}>7 Star</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => handleHotelRatingSelection('Other')}
style={[styles.button, selectedHotelRatings.includes('Other') && styles.selectedButton]}
>
<Text style={styles.buttonText}>Other</Text>
</TouchableOpacity>
</View>
<View style={styles.section}>
<Text style={styles.sectionTitle}>Preferred Hotel Type</Text>
<Text style={{color: 'gray', marginTop: 5}}>Pick one or more categories</Text>
<TouchableOpacity
onPress={() => handleHotelTypeSelection('Luxury')}
style={[styles.button, selectedHotelTypes.includes('Luxury') && styles.selectedButton]}
>
<Text style={styles.buttonText}>Luxury</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => handleHotelTypeSelection('Boutique')}
style={[styles.button, selectedHotelTypes.includes('Boutique') && styles.selectedButton]}
>
<Text style={styles.buttonText}>Boutique</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => handleHotelTypeSelection('Cabana')}
style={[styles.button, selectedHotelTypes.includes('Cabana') && styles.selectedButton]}
>
<Text style={styles.buttonText}>Cabana</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => handleHotelTypeSelection('Resort')}
style={[styles.button, selectedHotelTypes.includes('Resort') && styles.selectedButton]}
>
<Text style={styles.buttonText}>Resort</Text>
</TouchableOpacity>
</View>
<View style={styles.section}>
<Text style={styles.sectionTitle}>Add Other Interests <TouchableOpacity style={styles.roundButton} onPress={handleAddOtherInterest}><Ionicons name="add" size={20} color="black" /></TouchableOpacity></Text>
{otherInterests.map((interest, index) => (
<TextInput
key={index}
value={interest}
placeholder='Add aother interests'
onChangeText={(value) => handleOtherInterestChange(index, value)}
style={styles.textInput}
/>
))}
</View>
<TouchableOpacity style={styles.nextButton}>
<Text style={styles.nextButtonText}>Next</Text>
</TouchableOpacity>
</ScrollView>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
padding: 20,
},
section: {
marginBottom: 20,
},
sectionTitle: {
fontSize: 20,
fontWeight: 'bold',
},
header: {
backgroundColor: '#fff',
padding: 10,
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'flex-start',
marginBottom: 20,
},
headerText: {
fontWeight: 'bold',
fontSize: 20,
},
button: {
fontSize: 16,
color: '#fff',
padding: 10,
borderWidth: 1,
borderColor: 'purple',
borderRadius: 10,
marginBottom: 10,
marginTop: 10,
},
selectedButton: {
backgroundColor: 'purple',
},
textInput: {
height: 40,
borderWidth: 1,
borderColor: 'purple',
borderRadius: 5,
paddingHorizontal: 10,
marginBottom: 10,
marginTop: 10,
},
nextButton: {
backgroundColor: 'purple',
padding: 15,
borderRadius: 5,
alignItems: 'center',
justifyContent: 'center',
},
nextButtonText: {
color: 'white',
fontSize: 18,
fontWeight: 'bold',
},
roundButton: {
width: 25,
height: 25,
borderRadius: 25,
borderWidth: 2,
borderColor: 'black',
justifyContent: 'center',
alignItems: 'center',
},
buttonText: {
textAlign: 'center',
}
});
export default ItineraryGenerator3;