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,222 +0,0 @@
|
|
|
1
|
-
import { ClubSearchRequest, ClubSearchResponse } from '../services/authService';
|
|
2
|
-
|
|
3
|
-
export interface ClubData {
|
|
4
|
-
id?: string | number;
|
|
5
|
-
name?: string;
|
|
6
|
-
clubName?: string;
|
|
7
|
-
image?: string;
|
|
8
|
-
profileImage?: string;
|
|
9
|
-
logo?: string;
|
|
10
|
-
members?: number;
|
|
11
|
-
memberCount?: number;
|
|
12
|
-
address?: string;
|
|
13
|
-
location?: string;
|
|
14
|
-
clubCode?: string;
|
|
15
|
-
color?: string;
|
|
16
|
-
description?: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface PaginationState {
|
|
20
|
-
clubs: ClubData[];
|
|
21
|
-
currentPage: number;
|
|
22
|
-
totalPages: number;
|
|
23
|
-
totalCount: number;
|
|
24
|
-
isLoading: boolean;
|
|
25
|
-
isLoadingMore: boolean;
|
|
26
|
-
isRefreshing: boolean;
|
|
27
|
-
hasMoreData: boolean;
|
|
28
|
-
error: string | null;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export class ClubSearchManager {
|
|
32
|
-
private state: PaginationState;
|
|
33
|
-
private onStateChange: (state: PaginationState) => void;
|
|
34
|
-
private searchClubs: (params: ClubSearchRequest) => Promise<any>;
|
|
35
|
-
private pageSize: number;
|
|
36
|
-
|
|
37
|
-
constructor(
|
|
38
|
-
onStateChange: (state: PaginationState) => void,
|
|
39
|
-
searchClubs: (params: ClubSearchRequest) => Promise<any>,
|
|
40
|
-
pageSize: number = 5
|
|
41
|
-
) {
|
|
42
|
-
this.onStateChange = onStateChange;
|
|
43
|
-
this.searchClubs = searchClubs;
|
|
44
|
-
this.pageSize = pageSize;
|
|
45
|
-
|
|
46
|
-
this.state = {
|
|
47
|
-
clubs: [],
|
|
48
|
-
currentPage: 0,
|
|
49
|
-
totalPages: 0,
|
|
50
|
-
totalCount: 0,
|
|
51
|
-
isLoading: false,
|
|
52
|
-
isLoadingMore: false,
|
|
53
|
-
isRefreshing: false,
|
|
54
|
-
hasMoreData: true,
|
|
55
|
-
error: null,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// Initial load
|
|
60
|
-
async loadInitialData(): Promise<void> {
|
|
61
|
-
this.setState({
|
|
62
|
-
...this.state,
|
|
63
|
-
isLoading: true,
|
|
64
|
-
error: null,
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
try {
|
|
68
|
-
const response = await this.searchClubs({
|
|
69
|
-
pageNumber: 1,
|
|
70
|
-
pageSize: this.pageSize,
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
console.log('response1', response);
|
|
74
|
-
const data = response?.data?.data || {};
|
|
75
|
-
const clubs = data || [];
|
|
76
|
-
|
|
77
|
-
this.setState({
|
|
78
|
-
...this.state,
|
|
79
|
-
clubs,
|
|
80
|
-
currentPage: 1,
|
|
81
|
-
totalPages: data?.totalPages || 0,
|
|
82
|
-
totalCount: data?.totalCount || 0,
|
|
83
|
-
isLoading: false,
|
|
84
|
-
hasMoreData: clubs.length < (data?.totalCount || 0),
|
|
85
|
-
error: null,
|
|
86
|
-
});
|
|
87
|
-
} catch (error: any) {
|
|
88
|
-
this.setState({
|
|
89
|
-
...this.state,
|
|
90
|
-
isLoading: false,
|
|
91
|
-
error: error?.message || 'Failed to load clubs',
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// Load more data (pagination)
|
|
97
|
-
async loadMoreData(): Promise<void> {
|
|
98
|
-
if (this.state.isLoadingMore || !this.state.hasMoreData) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const nextPage = this.state.currentPage + 1;
|
|
103
|
-
|
|
104
|
-
this.setState({
|
|
105
|
-
...this.state,
|
|
106
|
-
isLoadingMore: true,
|
|
107
|
-
error: null,
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
try {
|
|
111
|
-
const response = await this.searchClubs({
|
|
112
|
-
pageNumber: nextPage,
|
|
113
|
-
pageSize: this.pageSize,
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
console.log('response2', response);
|
|
117
|
-
|
|
118
|
-
const data = response?.data?.data || {};
|
|
119
|
-
const newClubs = data || [];
|
|
120
|
-
|
|
121
|
-
this.setState({
|
|
122
|
-
...this.state,
|
|
123
|
-
clubs: [...this.state.clubs, ...newClubs],
|
|
124
|
-
currentPage: nextPage,
|
|
125
|
-
totalPages: data?.totalPages || 0,
|
|
126
|
-
totalCount: data?.totalCount || 0,
|
|
127
|
-
isLoadingMore: false,
|
|
128
|
-
hasMoreData: this.state.clubs.length + newClubs.length < (data?.totalCount || 0),
|
|
129
|
-
error: null,
|
|
130
|
-
});
|
|
131
|
-
} catch (error: any) {
|
|
132
|
-
this.setState({
|
|
133
|
-
...this.state,
|
|
134
|
-
isLoadingMore: false,
|
|
135
|
-
error: error?.message || 'Failed to load more clubs',
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// Pull to refresh
|
|
141
|
-
async refreshData(): Promise<void> {
|
|
142
|
-
this.setState({
|
|
143
|
-
...this.state,
|
|
144
|
-
isRefreshing: true,
|
|
145
|
-
error: null,
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
try {
|
|
149
|
-
const response = await this.searchClubs({
|
|
150
|
-
pageNumber: 1,
|
|
151
|
-
pageSize: this.pageSize,
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
console.log('response3', response);
|
|
156
|
-
|
|
157
|
-
const data = response?.data?.data || {};
|
|
158
|
-
const clubs = data || [];
|
|
159
|
-
|
|
160
|
-
this.setState({
|
|
161
|
-
...this.state,
|
|
162
|
-
clubs,
|
|
163
|
-
currentPage: 0,
|
|
164
|
-
totalPages: data?.totalPages || 0,
|
|
165
|
-
totalCount: data?.totalCount || 0,
|
|
166
|
-
isRefreshing: false,
|
|
167
|
-
hasMoreData: clubs.length < (data?.totalCount || 0),
|
|
168
|
-
error: null,
|
|
169
|
-
});
|
|
170
|
-
} catch (error: any) {
|
|
171
|
-
this.setState({
|
|
172
|
-
...this.state,
|
|
173
|
-
isRefreshing: false,
|
|
174
|
-
error: error?.message || 'Failed to refresh clubs',
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// Reset data
|
|
180
|
-
resetData(): void {
|
|
181
|
-
this.setState({
|
|
182
|
-
clubs: [],
|
|
183
|
-
currentPage: 0,
|
|
184
|
-
totalPages: 0,
|
|
185
|
-
totalCount: 0,
|
|
186
|
-
isLoading: false,
|
|
187
|
-
isLoadingMore: false,
|
|
188
|
-
isRefreshing: false,
|
|
189
|
-
hasMoreData: true,
|
|
190
|
-
error: null,
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// Get current state
|
|
195
|
-
getState(): PaginationState {
|
|
196
|
-
return { ...this.state };
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// Set state helper
|
|
200
|
-
private setState(newState: PaginationState): void {
|
|
201
|
-
this.state = newState;
|
|
202
|
-
this.onStateChange(newState);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// Check if we can load more
|
|
206
|
-
canLoadMore(): boolean {
|
|
207
|
-
return this.state.hasMoreData && !this.state.isLoadingMore && !this.state.isLoading;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// Get loading footer text
|
|
211
|
-
getLoadingFooterText(): string {
|
|
212
|
-
if (this.state.isLoadingMore) {
|
|
213
|
-
return 'Loading more clubs...';
|
|
214
|
-
}
|
|
215
|
-
if (!this.state.hasMoreData && this.state.clubs.length > 0) {
|
|
216
|
-
return 'No more clubs to load';
|
|
217
|
-
}
|
|
218
|
-
return '';
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
export default ClubSearchManager;
|