-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSettingsScreen.js
More file actions
280 lines (267 loc) · 9.86 KB
/
Copy pathSettingsScreen.js
File metadata and controls
280 lines (267 loc) · 9.86 KB
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
import React, { useState } from 'react';
import { View, StyleSheet, Text, TouchableOpacity, ScrollView, Linking } from 'react-native';
import { Ionicons } from '@expo/vector-icons';
import { getTextColor, getLighterColor } from './colorUtils';
import { Button } from 'react-native';
const SettingsScreen = ({ setColors, colors, setTheme, theme, updateThemeMode, openGuide, navigation }) => {
const [isLightMode, setIsLightMode] = useState(false);
const textColor = getTextColor(colors.background);
const guideBackgroundColor = getLighterColor(colors.background);
const lightTheme = {
sunsetBloom: {
background: '#E8F1C0',
inputBackground: '#d4e79e',
buttonBackground: '#922d50',
todoBackground: '#501537',
resolvedButtonBackground: '#3c1b43',
},
grapeSoda: {
background: '#D8BFD8',
inputBackground: '#d4e79e',
buttonBackground: '#800080',
todoBackground: '#4B0082',
resolvedButtonBackground: '#9932CC',
},
oceanBreeze: {
background: '#ADD8E6',
inputBackground: '#d4e79e',
buttonBackground: '#0000FF',
todoBackground: '#4682B4',
resolvedButtonBackground: '#1E90FF',
},
nordyChill: {
background: '#E5E9F0',
inputBackground: '#ECEFF4',
buttonBackground: '#81A1C1',
todoBackground: '#D8DEE9',
resolvedButtonBackground: '#88C0D0',
},
cattuccino: {
background: '#F8E1D4',
inputBackground: '#F5C3B3',
buttonBackground: '#D6A07C',
todoBackground: '#D5C4A1',
resolvedButtonBackground: '#F3E2D5',
},
mintyFresh: {
background: '#98FF98',
inputBackground: '#B5FFB5',
buttonBackground: '#7FFF7F',
todoBackground: '#6EFF6E',
resolvedButtonBackground: '#5EFF5E',
},
};
const darkTheme = {
sunsetBloom: {
background: '#153238',
inputBackground: '#fff',
buttonBackground: '#b38a58',
todoBackground: '#264027',
resolvedButtonBackground: '#6f732f',
},
grapeSoda: {
background: '#3b254e',
inputBackground: '#fff',
buttonBackground: '#6a0dad',
todoBackground: '#5e3e76',
resolvedButtonBackground: '#86608e',
},
oceanBreeze: {
background: '#4682B4',
inputBackground: '#fff',
buttonBackground: '#0000FF',
todoBackground: '#ADD8E6',
resolvedButtonBackground: '#1E90FF',
},
nordyChill: {
background: '#2E3440',
inputBackground: '#3B4252',
buttonBackground: '#5E81AC',
todoBackground: '#4C566A',
resolvedButtonBackground: '#88C0D0',
},
cattuccino: {
background: '#504945',
inputBackground: '#7C6F64',
buttonBackground: '#D8A48F',
todoBackground: '#665C54',
resolvedButtonBackground: '#F3EACB',
},
mintyFresh: {
background: '#007A59',
inputBackground: '#228C68',
buttonBackground: '#3BAF73',
todoBackground: '#2B7D58',
resolvedButtonBackground: '#4AD996',
},
};
const themeOptions = isLightMode ? lightTheme : darkTheme;
const toggleThemeMode = (lightMode) => {
setIsLightMode(lightMode);
const themeKey = theme || 'sunsetBloom'; // Preserve the selected theme
const defaultTheme = lightMode ? lightTheme[themeKey] : darkTheme[themeKey]; // Use the selected theme
setColors(defaultTheme);
setTheme(themeKey);
updateThemeMode(themeKey, lightMode ? 'light' : 'dark', lightTheme, darkTheme);
};
const selectTheme = (themeKey) => {
setColors(themeOptions[themeKey]);
setTheme(themeKey);
updateThemeMode(themeKey, isLightMode ? 'light' : 'dark', lightTheme, darkTheme);
};
return (
<ScrollView contentContainerStyle={styles.scrollContainer}>
<View style={[styles.container, { backgroundColor: colors.background }]}>
<Text style={[styles.title, { color: textColor }]}>Display</Text>
<View style={styles.iconContainer}>
<TouchableOpacity onPress={() => toggleThemeMode(true)} style={styles.iconButton}>
<Ionicons name="sunny" size={50} color={isLightMode ? '#FFD700' : '#000'} />
<Text style={[styles.iconLabel, { color: textColor }]}>Light Mode</Text>
</TouchableOpacity>
<TouchableOpacity onPress={() => toggleThemeMode(false)} style={styles.iconButton}>
<Ionicons name="moon" size={50} color={!isLightMode ? '#6a0dad' : '#fff'} />
<Text style={[styles.iconLabel, { color: textColor }]}>Dark Mode</Text>
</TouchableOpacity>
</View>
<View style={styles.horizontalSeparator} />
<View style={styles.themeButtonContainer}>
{Object.keys(themeOptions).map((themeKey, index) => (
<TouchableOpacity
key={themeKey}
onPress={() => selectTheme(themeKey)}
style={styles.iconButton}
>
<Ionicons
name={index % 2 === 0 ? 'color-palette' : 'water'}
size={50}
color={themeOptions[themeKey].buttonBackground}
/>
<Text style={[styles.iconLabel, { color: textColor }]}>
{themeKey === 'sunsetBloom'
? 'Sunset Bloom'
: themeKey === 'grapeSoda'
? 'Grape Soda'
: themeKey === 'oceanBreeze'
? 'Ocean Breeze'
: themeKey === 'nordyChill'
? 'Nordy Chill'
: themeKey === 'cattuccino'
? 'Cattuccino'
: 'Minty Fresh'}
</Text>
{theme === themeKey && (
<Ionicons name="checkmark-circle" size={20} color="green" />
)}
</TouchableOpacity>
))}
</View>
<View style={styles.horizontalSeparatorThicc} />
<Text style={[styles.title, { color: textColor }]}>Guide</Text>
<View style={[styles.guideContainer, {backgroundColor: colors.guideBackgroundColor}]}>
<Text style={[styles.iconLabel, { color: textColor }]}>Hello and Welcome to FoundList!</Text>
<Text style={[styles.iconLabel, { color: textColor }]}>This App is pretty straight forward.</Text>
<Text style={[styles.iconLabel, { color: textColor }]}>Add a To Do to the List by navigating to the Pending Tab and typing your To Do and then pressing "Add ToDo"</Text>
<Text style={[styles.iconLabel, { color: textColor }]}>Once you have completed a To Do, you can swipe left on the To Do to mark it as completed.</Text>
<Text style={[styles.iconLabel, { color: textColor }]}>If you have completed a To Do by mistake, you can swipe right on the To Do to unmark it as completed.</Text>
<Text style={[styles.iconLabel, { color: textColor }]}>If you would like to delete a To Do, you can swipe left on the To Do and then press the trash can icon.</Text>
</View>
</View>
<View style={[styles.container, { backgroundColor: colors.background }]}>
<View style={styles.horizontalSeparatorThicc} />
<Text style={[styles.title, { color: textColor }]}>Contributors</Text>
<TouchableOpacity onPress={() => Linking.openURL('https://taymaerz.de')}>
<Text style={[styles.iconLabel, styles.link, { color: textColor }]}>Tay März - Core Developer</Text>
</TouchableOpacity>
<View style={styles.horizontalSeparator} />
<Text style={[styles.iconLabel, { color: textColor }]}>You? Contribute now to be listed here</Text>
<View style={styles.horizontalSeparatorThicc} />
<Text style={[styles.title, { color: textColor }]}>Links</Text>
<TouchableOpacity onPress={() => Linking.openURL('https://github.com/taynotfound/FoundList/')}>
<Text style={[styles.link, { color: textColor }]}>FoundList GitHub Repository</Text>
</TouchableOpacity>
<View style={styles.horizontalSeparator} />
<TouchableOpacity onPress={() => Linking.openURL('https://github.com/taynotfound/FoundList/releases')}>
<Text style={[styles.link, { color: textColor }]}>Latest Release & Change Logs</Text>
</TouchableOpacity>
<View style={styles.horizontalSeparatorThicc} />
<Text style={[styles.title, { color: textColor }]}>Support</Text>
<TouchableOpacity onPress={() => Linking.openURL('https://discord.gg/C2bAXnYXzm')}>
<Text style={[styles.link, { color: textColor }]}>Join the Discord</Text>
</TouchableOpacity>
<View style={styles.horizontalSeparatorThicc} />
<Text style={[styles.iconLabel, { color: textColor }]}>© 2024 - Tay März under TayLabs</Text>
</View>
</ScrollView>
);
};
const styles = StyleSheet.create({
scrollContainer: {
flexGrow: 1,
},
link: {
color: 'blue',
textDecorationLine: 'underline',
},
guideContainer: {
borderRadius: 10,
padding: 20,
marginVertical: 20,
elevation: 3, // Add shadow for elevation on Android
shadowColor: '#000', // Shadow properties for iOS
shadowOffset: {
width: 0,
height: 2,
},
shadowOpacity: 0.25,
shadowRadius: 4,
width: '100%', // Full width for better visibility
},
container: {
flex: 1,
justifyContent: 'flex-start',
alignItems: 'center',
padding: 20,
},
title: {
fontSize: 24,
marginBottom: 20,
},
iconContainer: {
flexDirection: 'row',
justifyContent: 'space-around',
width: '100%',
marginBottom: 20,
},
horizontalSeparator: {
width: '100%',
height: 1,
backgroundColor: '#ddd',
marginVertical: 20,
},
horizontalSeparatorThicc: {
width: '100%',
height: 5,
backgroundColor: '#ddd',
marginVertical: 20,
},
themeButtonContainer: {
flexDirection: 'row',
flexWrap: 'wrap',
justifyContent: 'space-around',
width: '100%',
},
iconButton: {
alignItems: 'center',
padding: 10,
margin: 10,
borderRadius: 5,
width: '30%',
},
iconLabel: {
marginTop: 5,
fontSize: 15,
textAlign: 'center',
flexWrap: 'wrap',
},
});
export default SettingsScreen;