create-gufran-expo-app 2.0.3 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/package.json +3 -3
- package/template/src/navigation/AuthStack.tsx +6 -25
- package/template/src/navigation/MainStack.tsx +0 -148
- package/template/src/navigation/RootNavigator.tsx +4 -26
- package/template/src/navigation/index.ts +0 -1
- package/template/src/navigation/navigationRef.ts +1 -1
- package/template/src/screens/HomeScreen.tsx +3 -215
- package/template/src/screens/auth/LoginScreen.tsx +13 -13
- package/template/src/screens/auth/index.ts +1 -6
- package/template/src/screens/index.ts +0 -35
- package/template/src/services/api.ts +5 -5
- package/template/src/services/authService.ts +3 -299
- package/template/src/services/mainServices.ts +19 -1914
- package/template/src/types/navigation.ts +5 -155
- package/template/src/utils/index.ts +5 -8
- package/template/src/navigation/MiddleStack.tsx +0 -35
- package/template/src/screens/auth/AddMamber.tsx +0 -428
- package/template/src/screens/auth/ForgotPasswordScreen.tsx +0 -176
- package/template/src/screens/auth/OTPVerifyScreen.tsx +0 -359
- package/template/src/screens/auth/RegisterScreen.tsx +0 -430
- package/template/src/screens/auth/SuccessScreen.tsx +0 -201
- package/template/src/screens/chat/ChatScreen.tsx +0 -1819
- package/template/src/screens/chat/ChatThreadsScreen.tsx +0 -360
- package/template/src/screens/chat/ReportMessageScreen.tsx +0 -238
- package/template/src/screens/clubs/Announcements.tsx +0 -426
- package/template/src/screens/clubs/BuyRaffleTicketsScreen.tsx +0 -568
- package/template/src/screens/clubs/ClubDeteils.tsx +0 -497
- package/template/src/screens/clubs/JoinClub.tsx +0 -841
- package/template/src/screens/events/EventScreen.tsx +0 -460
- package/template/src/screens/raffles/MyReferralMembersScreen.tsx +0 -758
- package/template/src/screens/raffles/RaffleDetailsScreen.tsx +0 -762
- package/template/src/screens/raffles/RafflesScreen.tsx +0 -495
- package/template/src/screens/raffles/SetRaffleReminderScreen.tsx +0 -390
- package/template/src/screens/teams/JoinTeamScreen.tsx +0 -464
- package/template/src/screens/teams/MyTeamDetailsScreen.tsx +0 -979
- package/template/src/screens/teams/MyTeamScreen.tsx +0 -568
- package/template/src/screens/teams/PendingRequestsScreen.tsx +0 -426
- package/template/src/screens/volunteerOpportunities/SetReminderScreen.tsx +0 -631
- package/template/src/screens/volunteerOpportunities/VolunteerOpportunitiesDetailsScreen.tsx +0 -1049
- package/template/src/screens/volunteerOpportunities/VolunteerOpportunitiesScreen.tsx +0 -608
- package/template/src/utils/ClubSearchManager.ts +0 -222
|
@@ -1,390 +0,0 @@
|
|
|
1
|
-
import React, { useMemo, useState } from 'react';
|
|
2
|
-
import { View, Text, StyleSheet, StatusBar, Platform, TouchableOpacity, Image, FlatList } from 'react-native';
|
|
3
|
-
import moment from 'moment';
|
|
4
|
-
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
5
|
-
import { useRaffleDetails, useSetRaffleReminder, useRaffleReminder, useDeleteRaffleReminder } from '@services/mainServices';
|
|
6
|
-
import { ReminderCardItem, SetReminderModal } from '@components/common';
|
|
7
|
-
import { SetRaffleReminderScreenProps } from '@navigation';
|
|
8
|
-
import ToastManager from '@components/common/ToastManager';
|
|
9
|
-
import { moderateScale } from '@utils/scaling';
|
|
10
|
-
import { getApiErrorInfo } from '@services';
|
|
11
|
-
import { Fonts } from '@constants/Fonts';
|
|
12
|
-
import { theme } from '@constants';
|
|
13
|
-
import SVG from '@assets/icons';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export const SetRaffleReminderScreen: React.FC<SetRaffleReminderScreenProps> = ({ navigation, route }) => {
|
|
19
|
-
|
|
20
|
-
const { selectedClub, raffle: raffleDetails } = route?.params ?? {};
|
|
21
|
-
const raffleId = raffleDetails?.raffleId;
|
|
22
|
-
const clubId = selectedClub?.id;
|
|
23
|
-
const memberId = selectedClub?.selectedMember?.id;
|
|
24
|
-
const [isReminderModalOpen, setIsReminderModalOpen] = useState<boolean>(false);
|
|
25
|
-
|
|
26
|
-
const { data: raffleResponse, isLoading, error } = useRaffleDetails(raffleId);
|
|
27
|
-
const { data: reminderResponse, isLoading: isReminderLoading, refetch: refetchReminder } = useRaffleReminder(raffleId, clubId, memberId);
|
|
28
|
-
|
|
29
|
-
const setReminderMutation = useSetRaffleReminder();
|
|
30
|
-
const deleteReminderMutation = useDeleteRaffleReminder();
|
|
31
|
-
|
|
32
|
-
const raffleData = raffleResponse?.data?.data;
|
|
33
|
-
const details = useMemo(() => raffleData ?? raffleDetails ?? {}, [raffleData, raffleDetails]);
|
|
34
|
-
|
|
35
|
-
const reminderDataRaw = reminderResponse?.data?.data;
|
|
36
|
-
const reminderData = reminderDataRaw?.raffleReminders ?? [];
|
|
37
|
-
|
|
38
|
-
// Handle setting reminder
|
|
39
|
-
const handleSetReminder = async (reminderDateTime: Date) => {
|
|
40
|
-
if (!raffleId || !memberId || !clubId) {
|
|
41
|
-
ToastManager.error('Missing Information', 'Unable to set reminder. Missing required information.');
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
try {
|
|
46
|
-
// Format date using moment for API
|
|
47
|
-
const formattedDateTime = moment(reminderDateTime).format("YYYY-MM-DDTHH:mm:ssZ");
|
|
48
|
-
|
|
49
|
-
const response = await setReminderMutation.mutateAsync({
|
|
50
|
-
reminderDateTime: formattedDateTime,
|
|
51
|
-
raffleId: raffleId,
|
|
52
|
-
memberId: memberId,
|
|
53
|
-
clubId: clubId,
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
ToastManager.success(response.data?.message);
|
|
58
|
-
|
|
59
|
-
// Close modal
|
|
60
|
-
setIsReminderModalOpen(false);
|
|
61
|
-
|
|
62
|
-
// Refetch the reminder data to update the UI
|
|
63
|
-
refetchReminder();
|
|
64
|
-
} catch (error: any) {
|
|
65
|
-
console.error('Failed to set reminder:', error);
|
|
66
|
-
const errorInfo = getApiErrorInfo(error);
|
|
67
|
-
ToastManager.error(errorInfo?.message || 'Failed to set reminder. Please try again.');
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
// Handle deleting reminder
|
|
72
|
-
const handleDeleteReminder = async (reminderId: number | string | undefined) => {
|
|
73
|
-
if (!raffleId) {
|
|
74
|
-
ToastManager.error('Unable to delete reminder. Missing raffle ID.');
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (!reminderId) {
|
|
79
|
-
ToastManager.error('Unable to delete reminder. Missing reminder ID.');
|
|
80
|
-
console.error('reminderId is undefined or null:', reminderId);
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
try {
|
|
85
|
-
const reminderIdNumber = typeof reminderId === 'string' ? parseInt(reminderId, 10) : reminderId;
|
|
86
|
-
|
|
87
|
-
if (isNaN(reminderIdNumber)) {
|
|
88
|
-
ToastManager.error('Invalid reminder ID format.');
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
await deleteReminderMutation.mutateAsync({
|
|
93
|
-
raffleId: raffleId,
|
|
94
|
-
reminderId: reminderIdNumber,
|
|
95
|
-
clubId: clubId,
|
|
96
|
-
memberId: memberId,
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
ToastManager.success('Reminder has been deleted successfully!');
|
|
100
|
-
|
|
101
|
-
// Refetch the reminder data to update the UI
|
|
102
|
-
refetchReminder();
|
|
103
|
-
} catch (error: any) {
|
|
104
|
-
console.error('Failed to delete reminder:', error);
|
|
105
|
-
ToastManager.error(error?.message || 'Failed to delete reminder. Please try again.');
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
return (
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
<View style={styles.container}>
|
|
116
|
-
<StatusBar
|
|
117
|
-
barStyle="light-content"
|
|
118
|
-
backgroundColor={theme.colors.blue}
|
|
119
|
-
translucent={Platform.OS === 'android' ? true : false}
|
|
120
|
-
/>
|
|
121
|
-
{Platform.OS === 'ios' && <View style={styles.statusBarBackground} />}
|
|
122
|
-
<SafeAreaView style={styles.safeArea}>
|
|
123
|
-
<View style={styles.header}>
|
|
124
|
-
<View style={styles.navRow}>
|
|
125
|
-
<TouchableOpacity onPress={() => navigation.goBack()} hitSlop={{ top: 12, bottom: 12, left: 12, right: 12 }}>
|
|
126
|
-
<SVG.arrowLeft_white width={moderateScale(25)} height={moderateScale(25)} />
|
|
127
|
-
</TouchableOpacity>
|
|
128
|
-
<View style={styles.clubInfoContainer}>
|
|
129
|
-
<View style={styles.userConSty}>
|
|
130
|
-
{selectedClub?.clubImage ? (
|
|
131
|
-
<Image
|
|
132
|
-
source={{ uri: selectedClub.clubImage }}
|
|
133
|
-
style={styles.userDetailsSty}
|
|
134
|
-
resizeMode="cover"
|
|
135
|
-
/>
|
|
136
|
-
) : (
|
|
137
|
-
<View style={styles.placeholderLogoHeader}>
|
|
138
|
-
<SVG.UsersIcon width={moderateScale(20)} height={moderateScale(20)} />
|
|
139
|
-
</View>
|
|
140
|
-
)}
|
|
141
|
-
</View>
|
|
142
|
-
<Text style={styles.userNameSty}>{selectedClub?.clubName ?? 'Unknown Club'}</Text>
|
|
143
|
-
</View>
|
|
144
|
-
</View>
|
|
145
|
-
<View style={styles.headerMain}>
|
|
146
|
-
<Text style={styles.headerTitle}>{details?.raffleTitle ?? 'Raffle'}</Text>
|
|
147
|
-
{details?.locationAddress && (
|
|
148
|
-
<View style={styles.opMetaRow}>
|
|
149
|
-
<SVG.locationWhite width={moderateScale(18)} height={moderateScale(18)} />
|
|
150
|
-
<Text style={styles.opMetaText}>{details.locationAddress}</Text>
|
|
151
|
-
</View>
|
|
152
|
-
)}
|
|
153
|
-
{details?.drawDate && (
|
|
154
|
-
<View style={styles.opMetaRow}>
|
|
155
|
-
<SVG.CalendarWhite width={moderateScale(18)} height={moderateScale(18)} />
|
|
156
|
-
<Text style={styles.opMetaText}>{details.drawDate}</Text>
|
|
157
|
-
</View>
|
|
158
|
-
)}
|
|
159
|
-
</View>
|
|
160
|
-
</View>
|
|
161
|
-
<View style={styles.content}>
|
|
162
|
-
<Text style={styles.sectionTitle}>
|
|
163
|
-
MY REMINDERS
|
|
164
|
-
</Text>
|
|
165
|
-
{isLoading ? (
|
|
166
|
-
<View style={styles.loadingContainer}>
|
|
167
|
-
<Text style={styles.emptyText}>Loading raffle details...</Text>
|
|
168
|
-
</View>
|
|
169
|
-
) : error ? (
|
|
170
|
-
<View style={styles.loadingContainer}>
|
|
171
|
-
<Text style={styles.errorText}>Error loading raffle details.</Text>
|
|
172
|
-
</View>
|
|
173
|
-
) : (
|
|
174
|
-
<FlatList
|
|
175
|
-
data={reminderData}
|
|
176
|
-
style={styles.reminderList}
|
|
177
|
-
keyExtractor={(item) => item?.reminderId?.toString() || item?.reminderDateTime.toString()}
|
|
178
|
-
ListFooterComponent={<></>}
|
|
179
|
-
ListFooterComponentStyle={styles.reminderListFooter}
|
|
180
|
-
showsVerticalScrollIndicator={false}
|
|
181
|
-
renderItem={({ item }) => {
|
|
182
|
-
console.log("ssss", item);
|
|
183
|
-
|
|
184
|
-
const reminderId = item?.reminderId;
|
|
185
|
-
return (
|
|
186
|
-
<ReminderCardItem
|
|
187
|
-
reminderData={item}
|
|
188
|
-
onDelete={() => {
|
|
189
|
-
if (reminderId) {
|
|
190
|
-
handleDeleteReminder(reminderId);
|
|
191
|
-
} else {
|
|
192
|
-
console.warn('Cannot delete: reminderId is missing', item);
|
|
193
|
-
ToastManager.error('Cannot delete reminder: ID is missing.');
|
|
194
|
-
}
|
|
195
|
-
}}
|
|
196
|
-
/>
|
|
197
|
-
);
|
|
198
|
-
}}
|
|
199
|
-
ListEmptyComponent={() => {
|
|
200
|
-
return (
|
|
201
|
-
<View style={styles.emptyState}>
|
|
202
|
-
<Text style={styles.emptyStateText}>
|
|
203
|
-
No reminders set yet
|
|
204
|
-
</Text>
|
|
205
|
-
</View>
|
|
206
|
-
);
|
|
207
|
-
}}
|
|
208
|
-
/>
|
|
209
|
-
)}
|
|
210
|
-
</View>
|
|
211
|
-
|
|
212
|
-
{/* Add Reminder Button */}
|
|
213
|
-
<TouchableOpacity
|
|
214
|
-
style={styles.addReminderButton}
|
|
215
|
-
onPress={() => setIsReminderModalOpen(true)}
|
|
216
|
-
activeOpacity={0.7}
|
|
217
|
-
>
|
|
218
|
-
<Text style={styles.addReminderButtonText}>+</Text>
|
|
219
|
-
</TouchableOpacity>
|
|
220
|
-
</SafeAreaView>
|
|
221
|
-
|
|
222
|
-
{/* Set Reminder Modal */}
|
|
223
|
-
<SetReminderModal
|
|
224
|
-
maxDate={reminderDataRaw?.raffleDrawDate}
|
|
225
|
-
visible={isReminderModalOpen}
|
|
226
|
-
onClose={() => setIsReminderModalOpen(false)}
|
|
227
|
-
onSave={(date) => {
|
|
228
|
-
setIsReminderModalOpen(false);
|
|
229
|
-
handleSetReminder(date);
|
|
230
|
-
}}
|
|
231
|
-
onSuccessClose={true}
|
|
232
|
-
/>
|
|
233
|
-
</View>
|
|
234
|
-
);
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
const styles = StyleSheet.create({
|
|
238
|
-
container: {
|
|
239
|
-
flex: 1,
|
|
240
|
-
backgroundColor: theme.colors.blue,
|
|
241
|
-
},
|
|
242
|
-
statusBarBackground: {
|
|
243
|
-
position: 'absolute',
|
|
244
|
-
top: 0,
|
|
245
|
-
left: 0,
|
|
246
|
-
right: 0,
|
|
247
|
-
height: Platform.OS === 'ios' ? 44 : 0,
|
|
248
|
-
backgroundColor: theme.colors.blue,
|
|
249
|
-
zIndex: 1000,
|
|
250
|
-
},
|
|
251
|
-
safeArea: {
|
|
252
|
-
flex: 1,
|
|
253
|
-
backgroundColor: theme.colors.blue,
|
|
254
|
-
},
|
|
255
|
-
header: {
|
|
256
|
-
paddingBottom: theme.spacing.lg,
|
|
257
|
-
backgroundColor: theme.colors.blue,
|
|
258
|
-
},
|
|
259
|
-
reminderListFooter: {
|
|
260
|
-
marginBottom: moderateScale(50),
|
|
261
|
-
},
|
|
262
|
-
navRow: {
|
|
263
|
-
flexDirection: 'row',
|
|
264
|
-
alignItems: 'center',
|
|
265
|
-
paddingHorizontal: theme.spacing.lg,
|
|
266
|
-
},
|
|
267
|
-
clubInfoContainer: {
|
|
268
|
-
flexDirection: 'row',
|
|
269
|
-
alignItems: 'center',
|
|
270
|
-
},
|
|
271
|
-
userConSty: {
|
|
272
|
-
marginHorizontal: moderateScale(10),
|
|
273
|
-
width: moderateScale(30),
|
|
274
|
-
height: moderateScale(30),
|
|
275
|
-
borderRadius: moderateScale(15),
|
|
276
|
-
borderWidth: 1.5,
|
|
277
|
-
borderColor: theme.colors.imageBorder,
|
|
278
|
-
backgroundColor: theme.colors.background,
|
|
279
|
-
alignItems: 'center',
|
|
280
|
-
justifyContent: 'center',
|
|
281
|
-
},
|
|
282
|
-
placeholderLogoHeader: {
|
|
283
|
-
width: moderateScale(24),
|
|
284
|
-
height: moderateScale(24),
|
|
285
|
-
borderRadius: moderateScale(12),
|
|
286
|
-
alignItems: 'center',
|
|
287
|
-
justifyContent: 'center',
|
|
288
|
-
},
|
|
289
|
-
userDetailsSty: {
|
|
290
|
-
width: moderateScale(30),
|
|
291
|
-
height: moderateScale(30),
|
|
292
|
-
borderRadius: moderateScale(15),
|
|
293
|
-
resizeMode: 'cover',
|
|
294
|
-
},
|
|
295
|
-
userNameSty: {
|
|
296
|
-
color: theme.colors.white,
|
|
297
|
-
fontFamily: Fonts.outfitMedium,
|
|
298
|
-
fontSize: moderateScale(15),
|
|
299
|
-
},
|
|
300
|
-
headerMain: {
|
|
301
|
-
paddingHorizontal: theme.spacing.lg,
|
|
302
|
-
marginTop: theme.spacing.sm,
|
|
303
|
-
},
|
|
304
|
-
headerTitle: {
|
|
305
|
-
fontFamily: Fonts.outfitSemiBold,
|
|
306
|
-
fontSize: moderateScale(24),
|
|
307
|
-
color: theme.colors.white,
|
|
308
|
-
marginBottom: theme.spacing.sm,
|
|
309
|
-
},
|
|
310
|
-
opMetaRow: {
|
|
311
|
-
flexDirection: 'row',
|
|
312
|
-
alignItems: 'center',
|
|
313
|
-
marginBottom: theme.spacing.xs,
|
|
314
|
-
},
|
|
315
|
-
opMetaText: {
|
|
316
|
-
marginLeft: theme.spacing.xs,
|
|
317
|
-
fontFamily: Fonts.outfitRegular,
|
|
318
|
-
fontSize: theme.typography.fontSize.xs,
|
|
319
|
-
color: 'rgba(255, 255, 255, 0.85)',
|
|
320
|
-
},
|
|
321
|
-
content: {
|
|
322
|
-
flex: 1,
|
|
323
|
-
backgroundColor: theme.colors.background,
|
|
324
|
-
borderTopLeftRadius: moderateScale(28),
|
|
325
|
-
borderTopRightRadius: moderateScale(28),
|
|
326
|
-
paddingTop: moderateScale(10),
|
|
327
|
-
paddingBottom: theme.spacing.md,
|
|
328
|
-
paddingHorizontal: theme.spacing.lg
|
|
329
|
-
},
|
|
330
|
-
reminderList: {
|
|
331
|
-
flex: 1,
|
|
332
|
-
},
|
|
333
|
-
sectionTitle: {
|
|
334
|
-
fontFamily: Fonts.outfitRegular,
|
|
335
|
-
fontSize: theme.typography.fontSize.sm,
|
|
336
|
-
color: theme.colors.blue,
|
|
337
|
-
marginBottom: theme.spacing.sm,
|
|
338
|
-
},
|
|
339
|
-
emptyState: {
|
|
340
|
-
paddingVertical: theme.spacing.lg,
|
|
341
|
-
alignItems: 'center',
|
|
342
|
-
justifyContent: 'center',
|
|
343
|
-
},
|
|
344
|
-
emptyStateText: {
|
|
345
|
-
fontFamily: Fonts.outfitMedium,
|
|
346
|
-
fontSize: theme.typography.fontSize.sm,
|
|
347
|
-
color: theme.colors.DarkGray,
|
|
348
|
-
},
|
|
349
|
-
loadingContainer: {
|
|
350
|
-
flex: 1,
|
|
351
|
-
justifyContent: 'center',
|
|
352
|
-
alignItems: 'center',
|
|
353
|
-
paddingHorizontal: theme.spacing.lg,
|
|
354
|
-
},
|
|
355
|
-
emptyText: {
|
|
356
|
-
fontFamily: Fonts.outfitMedium,
|
|
357
|
-
fontSize: theme.typography.fontSize.md,
|
|
358
|
-
color: theme.colors.DarkGray,
|
|
359
|
-
textAlign: 'center',
|
|
360
|
-
},
|
|
361
|
-
errorText: {
|
|
362
|
-
fontFamily: Fonts.outfitMedium,
|
|
363
|
-
fontSize: theme.typography.fontSize.md,
|
|
364
|
-
color: theme.colors.cancelButton,
|
|
365
|
-
marginTop: theme.spacing.md,
|
|
366
|
-
textAlign: 'center',
|
|
367
|
-
},
|
|
368
|
-
addReminderButton: {
|
|
369
|
-
position: 'absolute',
|
|
370
|
-
bottom: moderateScale(50),
|
|
371
|
-
right: moderateScale(25),
|
|
372
|
-
width: moderateScale(56),
|
|
373
|
-
height: moderateScale(56),
|
|
374
|
-
borderRadius: moderateScale(28),
|
|
375
|
-
backgroundColor: theme.colors.blue,
|
|
376
|
-
alignItems: 'center',
|
|
377
|
-
justifyContent: 'center',
|
|
378
|
-
shadowColor: theme.colors.black,
|
|
379
|
-
shadowOpacity: 0.3,
|
|
380
|
-
shadowRadius: 8,
|
|
381
|
-
shadowOffset: { width: 0, height: 4 },
|
|
382
|
-
elevation: 8,
|
|
383
|
-
},
|
|
384
|
-
addReminderButtonText: {
|
|
385
|
-
fontFamily: Fonts.outfitSemiBold,
|
|
386
|
-
fontSize: moderateScale(32),
|
|
387
|
-
color: theme.colors.white,
|
|
388
|
-
marginBottom: moderateScale(2),
|
|
389
|
-
},
|
|
390
|
-
});
|