pay indivisual
This commit is contained in:
@@ -22,7 +22,7 @@ import { StackNavigationProp } from "@react-navigation/stack";
|
||||
import { RootStackParamList } from "../navigation/AppNavigator";
|
||||
import AppView from "../components/AppView";
|
||||
import { apiCall } from "../utils/ApiHelper";
|
||||
import { BASE_URL, GET_JOINED_GROUP_URL, JOIN_GROUP_URL, PUBLIC_GROUPS_URL, PUT_USER_STATUS } from "../utils/ApiUrls";
|
||||
import { BASE_URL, GET_JOINED_GROUP_URL, JOIN_GROUP_URL, PUBLIC_GROUPS_URL, USER_STATUS } from "../utils/ApiUrls";
|
||||
import colors from "../components/colors";
|
||||
import { ApiResponse } from "./home/UserProfileStatus";
|
||||
import * as Keychain from "react-native-keychain";
|
||||
@@ -214,7 +214,7 @@ export default function GroupScreen() {
|
||||
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
const response = await fetch(PUT_USER_STATUS, {
|
||||
const response = await fetch(USER_STATUS, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Accept: "*/*",
|
||||
|
||||
+174
-136
@@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import React, { useEffect, useState, useCallback } from "react";
|
||||
import {
|
||||
StyleSheet,
|
||||
Text,
|
||||
@@ -6,23 +6,21 @@ import {
|
||||
TouchableOpacity,
|
||||
UIManager,
|
||||
Platform,
|
||||
Image,
|
||||
Alert,
|
||||
FlatList,
|
||||
ListRenderItem,
|
||||
ToastAndroid,
|
||||
ScrollView,
|
||||
Alert,
|
||||
RefreshControl,
|
||||
} from "react-native";
|
||||
import AppView from "../../components/AppView";
|
||||
import colors from "../../components/colors";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useNavigation } from "@react-navigation/native";
|
||||
import { PROFILE_URL } from "../../utils/ApiUrls";
|
||||
import { DASHBOARD_URL, PROFILE_URL, USER_STATUS } from "../../utils/ApiUrls";
|
||||
import { setUserData } from "../../redux/userSlice";
|
||||
import { TabNavigationProp } from "../../navigation/BottomTabs";
|
||||
import UserProfileStatus from "./UserProfileStatus";
|
||||
import AnimatedCard from "../../components/common/AnimatedCard";
|
||||
import { Ionicons, IoniconsIconName } from "@react-native-vector-icons/ionicons";
|
||||
import { Ionicons } from "@react-native-vector-icons/ionicons";
|
||||
import { apiCall } from "../../utils/ApiHelper";
|
||||
import CustomAlert, { CustomAlertProps } from "../../components/CostomAlart";
|
||||
|
||||
@@ -38,6 +36,7 @@ type UserProfile = {
|
||||
imageBlob: string | null;
|
||||
role?: string;
|
||||
organizerStatus?: string;
|
||||
profileStatus?: boolean;
|
||||
};
|
||||
|
||||
interface ActionItem {
|
||||
@@ -45,174 +44,206 @@ interface ActionItem {
|
||||
title: string;
|
||||
action: string;
|
||||
tab?: "My Groups" | "Joined Groups" | "Requests" | "Your Requests";
|
||||
iconName?: IoniconsIconName;
|
||||
iconName?: any;
|
||||
backOne?: string;
|
||||
backTwo?: string;
|
||||
subtitle?: string;
|
||||
}
|
||||
|
||||
// Updated action items with a prettier pastel palette
|
||||
const organizerActions: ActionItem[] = [
|
||||
{ id: "1", title: "My Groups", subtitle: "Manage your groups", action: "NAVIGATE_MANAGEMENT", tab: "My Groups", iconName: "people-circle-outline", backOne: '#decbfcff', backTwo: '#B799FF' },
|
||||
{ id: "2", title: "Joined Groups", subtitle: "View member groups", action: "NAVIGATE_MANAGEMENT", tab: "Joined Groups", iconName: "people-outline", backOne: '#D7E9F7', backTwo: '#82AAE3' },
|
||||
{ id: "3", title: "Requests", subtitle: "Check new requests", action: "NAVIGATE_MANAGEMENT", tab: "Requests", iconName: "notifications-outline", backOne: '#DFF6DD', backTwo: '#88D18A' },
|
||||
{ id: "4", title: "Create Group", subtitle: "Create a new group", action: "NAVIGATE_CREATE_GROUP", tab: "Requests", iconName: "people-outline", backOne: '#DFF6DD', backTwo: '#88D18A' },
|
||||
{ id: "1", title: "My Groups", subtitle: "Manage groups", action: "NAVIGATE_MANAGEMENT", tab: "My Groups", iconName: "people-circle-outline", backOne: "#decbfcff", backTwo: "#B799FF" },
|
||||
{ id: "2", title: "Joined Groups", subtitle: "View groups", action: "NAVIGATE_MANAGEMENT", tab: "Joined Groups", iconName: "people-outline", backOne: "#D7E9F7", backTwo: "#82AAE3" },
|
||||
{ id: "3", title: "Requests", subtitle: "Check requests", action: "NAVIGATE_MANAGEMENT", tab: "Requests", iconName: "notifications-outline", backOne: "#DFF6DD", backTwo: "#88D18A" },
|
||||
{ id: "4", title: "Create Group", subtitle: "Start new group", action: "NAVIGATE_CREATE_GROUP", iconName: "add-circle-outline", backOne: "#FFF4D2", backTwo: "#FFB344" },
|
||||
{ id: "5", title: "Your Requests", subtitle: "Track requests", action: "NAVIGATE_MANAGEMENT", tab: "Your Requests", iconName: "mail-open-outline", backOne: "#FFF4D2", backTwo: "#FFB344" },
|
||||
{ id: "6", title: "Transactions", subtitle: "View history", action: "TRANSACTION", iconName: "receipt-outline", backOne: "#decbfcff", backTwo: "#B799FF" },
|
||||
];
|
||||
|
||||
const userActions: ActionItem[] = [
|
||||
{ id: "1", title: "Joined Groups", subtitle: "See your groups", action: "NAVIGATE_MANAGEMENT", tab: "Joined Groups", iconName: "person-outline", backOne: '#D7E9F7', backTwo: '#82AAE3' },
|
||||
{ id: "2", title: "Your Requests", subtitle: "Track your requests", action: "NAVIGATE_MANAGEMENT", tab: "Your Requests", iconName: "mail-open-outline", backOne: '#FFF4D2', backTwo: '#FFB344' },
|
||||
{ id: "3", title: "Transactions", subtitle: "View your history", action: "TRANSACTION", iconName: "receipt-outline", backOne: '#decbfcff', backTwo: '#B799FF' },
|
||||
{ id: "4", title: "Create Group", subtitle: "Create a new group", action: "NAVIGATE_CREATE_GROUP", tab: "Requests", iconName: "people-outline", backOne: '#DFF6DD', backTwo: '#88D18A' },
|
||||
{ id: "1", title: "Joined Groups", subtitle: "See your groups", action: "NAVIGATE_MANAGEMENT", tab: "Joined Groups", iconName: "people-outline", backOne: "#D7E9F7", backTwo: "#82AAE3" },
|
||||
{ id: "2", title: "Your Requests", subtitle: "Track requests", action: "NAVIGATE_MANAGEMENT", tab: "Your Requests", iconName: "mail-open-outline", backOne: "#FFF4D2", backTwo: "#FFB344" },
|
||||
{ id: "3", title: "Transactions", subtitle: "View history", action: "TRANSACTION", iconName: "receipt-outline", backOne: "#decbfcff", backTwo: "#B799FF" },
|
||||
{ id: "4", title: "Create Group", subtitle: "Start new group", action: "NAVIGATE_CREATE_GROUP", iconName: "add-circle-outline", backOne: "#DFF6DD", backTwo: "#88D18A" },
|
||||
];
|
||||
|
||||
|
||||
const Home: React.FC = () => {
|
||||
const user = useSelector((state: any) => state.user);
|
||||
const notifications = useSelector(
|
||||
(state: any) => state.notifications.notifications
|
||||
);
|
||||
const notifications = useSelector((state: any) => state.notifications.notifications);
|
||||
const navigation = useNavigation<TabNavigationProp>();
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const actions = user.role === 'ORGANIZER' ? organizerActions : userActions;
|
||||
const actions = user.role === "ORGANIZER" ? organizerActions : userActions;
|
||||
const [apiUser, setApiUser] = useState<UserProfile | null>(null);
|
||||
const [alartVisible, setalartVisible] = useState<boolean>(false)
|
||||
const [alartAction, setAlartAction] = useState<CustomAlertProps | null>(null)
|
||||
const [alertVisible, setAlertVisible] = useState(false);
|
||||
const [alertAction, setAlertAction] = useState<CustomAlertProps | null>(null);
|
||||
const [userDashboard, setUserDashboard] = useState<any>(null);
|
||||
const [refreshing, setRefreshing] = useState(false);
|
||||
const [statusData, setStatusData] = useState<any>(null);
|
||||
const getDashboardData = async () => {
|
||||
try {
|
||||
const result = (await apiCall(DASHBOARD_URL, "GET")) as any;
|
||||
if (result.status === "success") {
|
||||
console.log("dashboard -----",result)
|
||||
setUserDashboard(result.data);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("❌ Error fetching dashboard data:", error);
|
||||
}
|
||||
};
|
||||
|
||||
const getUserStatus = async () => {
|
||||
const result = await apiCall(USER_STATUS, "GET") as any;
|
||||
setStatusData(result.data);
|
||||
}
|
||||
|
||||
const fetchUserProfile = async () => {
|
||||
try {
|
||||
const result = (await apiCall(PROFILE_URL, "GET")) as any;
|
||||
console.log("profile data", result);
|
||||
if (result.status === "success") {
|
||||
setApiUser(result.data);
|
||||
dispatch(setUserData({ ...result.data, profileStatus: true }));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("❌ Error fetching profile:", error);
|
||||
}
|
||||
};
|
||||
|
||||
const fetchData = useCallback(async () => {
|
||||
await Promise.all([fetchUserProfile(), getDashboardData(), getUserStatus()]);
|
||||
}, []);
|
||||
|
||||
const onRefresh = useCallback(async () => {
|
||||
setRefreshing(true);
|
||||
await fetchData();
|
||||
setRefreshing(false);
|
||||
}, [fetchData]);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchUserProfile = async () => {
|
||||
try {
|
||||
const result = await apiCall(PROFILE_URL, "GET") as any;
|
||||
console.log(PROFILE_URL, result)
|
||||
if (result.status === "success") {
|
||||
setApiUser(result.data);
|
||||
dispatch(setUserData({ ...result.data, profileStatus: true }));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("❌ Error fetching profile:", error);
|
||||
}
|
||||
};
|
||||
const unsubscribe = navigation.addListener('focus', fetchUserProfile);
|
||||
fetchUserProfile();
|
||||
const unsubscribe = navigation.addListener("focus", fetchData);
|
||||
fetchData();
|
||||
return unsubscribe;
|
||||
}, [navigation, dispatch]);
|
||||
}, [navigation, fetchData]);
|
||||
|
||||
const handleActionPress = (item: ActionItem) => {
|
||||
if (item.action === "NAVIGATE_MANAGEMENT" && item.tab) {
|
||||
navigation.navigate('Management', { actionTab: item.tab });
|
||||
navigation.navigate("Management", { actionTab: item.tab });
|
||||
} else if (item.action === "TRANSACTION") {
|
||||
navigation.navigate("TransactionList" as never);
|
||||
} else if (item.action === "NAVIGATE_CREATE_GROUP") {
|
||||
switch (apiUser?.organizerStatus) {
|
||||
case 'NOT_APPLIED':
|
||||
setalartVisible(true);
|
||||
setAlartAction({
|
||||
case "NOT_APPLIED":
|
||||
setAlertAction({
|
||||
visible: true,
|
||||
title: "Become organizer",
|
||||
message: "You have to become organizer for creating groups",
|
||||
title: "Become an Organizer",
|
||||
message: "You need to be an organizer to create groups.",
|
||||
buttons: [
|
||||
{
|
||||
text: "Continue",
|
||||
onPress: () => {
|
||||
setalartVisible(false);
|
||||
setAlertVisible(false);
|
||||
navigation.navigate("BecomeOrg" as never);
|
||||
},
|
||||
style: "default",
|
||||
},
|
||||
{
|
||||
text: "Close",
|
||||
onPress: () => {
|
||||
setalartVisible(false);
|
||||
},
|
||||
style: "cancel",
|
||||
},
|
||||
{ text: "Close", onPress: () => setAlertVisible(false), style: "cancel" },
|
||||
],
|
||||
alertType: 'error',
|
||||
onClose: () => setAlartAction(null),
|
||||
alertType: "error",
|
||||
onClose: () => setAlertAction(null),
|
||||
});
|
||||
setAlertVisible(true);
|
||||
break;
|
||||
|
||||
case 'PENDING':
|
||||
setalartVisible(true);
|
||||
setAlartAction({
|
||||
visible: true,
|
||||
title: "Organizer Application Pending",
|
||||
message: "Your application to become an organizer is pending approval. You cannot create groups until it's approved.",
|
||||
buttons: [
|
||||
{
|
||||
text: "Close",
|
||||
onPress: () => {
|
||||
setalartVisible(false);
|
||||
},
|
||||
style: "cancel",
|
||||
},
|
||||
],
|
||||
alertType: 'info',
|
||||
onClose: () => setAlartAction(null),
|
||||
});
|
||||
case "PENDING":
|
||||
Alert.alert("Pending Approval", "Your organizer request is still pending.");
|
||||
break;
|
||||
case 'APPROVED':
|
||||
case "APPROVED":
|
||||
navigation.navigate("GroupCreation" as never);
|
||||
break;
|
||||
default:
|
||||
Alert.alert("Unknown action", item.title);
|
||||
Alert.alert("Unknown Status", "Could not determine your organizer status.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const unreadCount = notifications.filter((item: any) => !item.read).length;
|
||||
|
||||
const renderGridItem: ListRenderItem<ActionItem> = ({ item }) => (
|
||||
<View style={styles.cardWrapper}>
|
||||
<AnimatedCard
|
||||
key={item.id}
|
||||
title={item.title}
|
||||
subtitle={item.subtitle}
|
||||
iconName={item.iconName}
|
||||
backOne={item.backOne}
|
||||
backTwo={item.backTwo}
|
||||
onPress={() => handleActionPress(item)}
|
||||
/>
|
||||
</View>
|
||||
<AnimatedCard
|
||||
key={item.id}
|
||||
title={item.title}
|
||||
subtitle={item.subtitle}
|
||||
iconName={item.iconName}
|
||||
backOne={item.backOne}
|
||||
backTwo={item.backTwo}
|
||||
onPress={() => handleActionPress(item)}
|
||||
/>
|
||||
);
|
||||
|
||||
const getProfileImageUri = () => {
|
||||
const blob = user.imageBlob || apiUser?.imageBlob;
|
||||
return blob ? { uri: `data:image/jpeg;base64,${blob}` } : require('../../assets/images/placeholder.png');
|
||||
return blob ? { uri: `data:image/jpeg;base64,${blob}` } : undefined;
|
||||
};
|
||||
|
||||
return (
|
||||
// <AppView barStyle="dark-content" style={styles.container}>
|
||||
<ScrollView style={styles.container}>
|
||||
<View style={styles.header}>
|
||||
<View>
|
||||
<Text style={styles.greeting}>Hello,</Text>
|
||||
<Text style={styles.userName}>{user.firstName || apiUser?.firstName || 'User'}</Text>
|
||||
</View>
|
||||
<TouchableOpacity onPress={() => navigation.navigate("Notification" as never)}>
|
||||
<Text style={{ position: 'absolute', right: -6, top: -4, backgroundColor: colors.danger, color: colors.white, borderRadius: 8, width: 16, height: 16, textAlign: 'center', fontSize: 10, fontWeight: 'bold', lineHeight: 16, zIndex: 1 }}>{unreadCount > 0 ? unreadCount : ''}</Text>
|
||||
<Ionicons name="notifications-outline" size={30} color={colors.textDark} />
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
|
||||
<UserProfileStatus profileImage={getProfileImageUri()} />
|
||||
|
||||
<View style={{ justifyContent: 'space-between', flexDirection: 'row', alignItems: 'center', marginTop: 20, marginBottom: 10 }}>
|
||||
<Text style={styles.sectionTitle}>Quick Actions</Text>
|
||||
<TouchableOpacity style={{ padding: 8 , backgroundColor: colors.primary , marginRight: 15}} onPress={() => Alert.alert('Info', 'This will allow you to pay all pending contributions in your groups.')}>
|
||||
<Text style={{ fontSize: 14, color: '#fff', fontWeight: 'bold' }}>Pay All</Text>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
|
||||
<AppView barStyle="dark-content" style={styles.container}>
|
||||
<FlatList
|
||||
data={actions}
|
||||
numColumns={2}
|
||||
renderItem={renderGridItem}
|
||||
keyExtractor={(item) => item.id}
|
||||
numColumns={2}
|
||||
contentContainerStyle={{ paddingHorizontal: 8 }}
|
||||
ListHeaderComponent={
|
||||
<>
|
||||
<View style={styles.header}>
|
||||
<View>
|
||||
<Text style={styles.greeting}>
|
||||
Hello, <Text style={{ fontWeight: 'bold' }}>{user.firstName || apiUser?.firstName || "User"}</Text>
|
||||
</Text>
|
||||
</View>
|
||||
<TouchableOpacity onPress={() => navigation.navigate("Notification" as never)}>
|
||||
{unreadCount > 0 && (
|
||||
<View style={styles.badge}>
|
||||
<Text style={styles.badgeText}>{unreadCount}</Text>
|
||||
</View>
|
||||
)}
|
||||
<Ionicons name="notifications-outline" size={30} color={colors.textDark} />
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
|
||||
<UserProfileStatus
|
||||
profileImage={getProfileImageUri()}
|
||||
statusData={statusData}
|
||||
userDashboard={userDashboard}
|
||||
/>
|
||||
|
||||
<View style={styles.actionHeader}>
|
||||
<Text style={styles.sectionTitle}>Quick Actions</Text>
|
||||
|
||||
</View>
|
||||
</>
|
||||
}
|
||||
contentContainerStyle={{ paddingBottom: 100 }}
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
refreshing={refreshing}
|
||||
onRefresh={onRefresh}
|
||||
colors={[colors.primary]}
|
||||
tintColor={colors.primary}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</ScrollView>
|
||||
|
||||
{alertAction && (
|
||||
<CustomAlert
|
||||
visible={alertVisible}
|
||||
title={alertAction.title}
|
||||
buttons={alertAction.buttons}
|
||||
message={alertAction.message}
|
||||
alertType={"error"}
|
||||
onClose={() => setAlertVisible(false)}
|
||||
/>
|
||||
)}
|
||||
</AppView>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -221,9 +252,7 @@ export default Home;
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
backgroundColor: colors.white, // Set background to white
|
||||
marginBottom: 100,
|
||||
padding:10
|
||||
backgroundColor: colors.white,
|
||||
},
|
||||
header: {
|
||||
flexDirection: "row",
|
||||
@@ -233,25 +262,34 @@ const styles = StyleSheet.create({
|
||||
paddingTop: 24,
|
||||
paddingBottom: 16,
|
||||
},
|
||||
greeting: {
|
||||
fontSize: 22,
|
||||
color: colors.textDark,
|
||||
greeting: { fontSize: 22, color: colors.textDark },
|
||||
sectionTitle: { fontSize: 20, fontWeight: "600", color: colors.textDark, flex: 1 },
|
||||
actionHeader: {
|
||||
flexDirection: "row",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
marginHorizontal: 20,
|
||||
marginBottom: 10,
|
||||
marginTop: 16
|
||||
},
|
||||
userName: {
|
||||
fontSize: 28,
|
||||
fontWeight: 'bold',
|
||||
color: colors.textDark,
|
||||
payAllButton: {
|
||||
paddingHorizontal: 14,
|
||||
paddingVertical: 6,
|
||||
backgroundColor: colors.primary,
|
||||
borderRadius: 8,
|
||||
},
|
||||
sectionTitle: {
|
||||
fontSize: 20,
|
||||
fontWeight: '600',
|
||||
color: colors.textDark,
|
||||
paddingHorizontal: 20,
|
||||
marginBottom: 8,
|
||||
payAllText: { color: "#fff", fontWeight: "bold", fontSize: 14 },
|
||||
badge: {
|
||||
position: "absolute",
|
||||
right: -6,
|
||||
top: -4,
|
||||
backgroundColor: colors.danger,
|
||||
borderRadius: 8,
|
||||
width: 16,
|
||||
height: 16,
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
zIndex: 1,
|
||||
},
|
||||
cardWrapper: {
|
||||
flex: 1,
|
||||
// marginHorizontal: 8,
|
||||
// backgroundColor:'red'
|
||||
},
|
||||
});
|
||||
badgeText: { color: colors.white, fontSize: 10, fontWeight: "bold" },
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,256 +1,3 @@
|
||||
// import React, { useEffect, useState } from "react";
|
||||
// import {
|
||||
// StyleSheet,
|
||||
// Text,
|
||||
// View,
|
||||
// FlatList,
|
||||
// TouchableOpacity,
|
||||
// Alert,
|
||||
// RefreshControl,
|
||||
// ScrollView,
|
||||
// Button,
|
||||
// ToastAndroid,
|
||||
// } from "react-native";
|
||||
// import { useNavigation } from "@react-navigation/native";
|
||||
// import type { NativeStackNavigationProp } from "@react-navigation/native-stack";
|
||||
// import type { RootStackParamList } from "../../../navigation/AppNavigator";
|
||||
// import colors from "../../../components/colors";
|
||||
// import { Ionicons } from "@react-native-vector-icons/ionicons";
|
||||
// import { GET_JOINED_GROUP_URL } from "../../../utils/ApiUrls";
|
||||
// import * as Keychain from "react-native-keychain";
|
||||
// import AnimatedCard from "../../../components/common/AnimatedCard";
|
||||
|
||||
// type NavigationProp = NativeStackNavigationProp<
|
||||
// RootStackParamList,
|
||||
// "GroupDetails"
|
||||
// >;
|
||||
|
||||
// type Group = {
|
||||
// id: string;
|
||||
// groupName: string;
|
||||
// description: string;
|
||||
// currentParticipants: number;
|
||||
// maxParticipants: number;
|
||||
// contributionAmount: number;
|
||||
// status: string;
|
||||
// };
|
||||
|
||||
// const UserHome = () => {
|
||||
// const navigation = useNavigation<NavigationProp>();
|
||||
// const [groups, setGroups] = useState<Group[]>([]);
|
||||
// const [loading, setLoading] = useState<boolean>(false)
|
||||
// const [refreshing, setRefreshing] = useState<boolean>(false)
|
||||
|
||||
|
||||
// const activeGroups = groups.filter((g) => g.status === "ACTIVE");
|
||||
|
||||
// const totalGroups = activeGroups.length;
|
||||
|
||||
// const totalContribution = activeGroups.reduce(
|
||||
// (sum, g) => sum + g.contributionAmount,
|
||||
// 0
|
||||
// );
|
||||
|
||||
// const onRefresh = async () => {
|
||||
// setRefreshing(true)
|
||||
// await handleGroup()
|
||||
// setRefreshing(false)
|
||||
// }
|
||||
|
||||
// const handleGroup = async () => {
|
||||
// try {
|
||||
// setLoading(true)
|
||||
// const credentials = await Keychain.getGenericPassword();
|
||||
// if (!credentials) {
|
||||
// ToastAndroid.show('You are not logged in', ToastAndroid.SHORT);
|
||||
// return;
|
||||
// }
|
||||
// const token = credentials.password;
|
||||
|
||||
// const response = await fetch(GET_JOINED_GROUP_URL, {
|
||||
// method: "GET",
|
||||
// headers: {
|
||||
// Accept: "*/*",
|
||||
// Authorization: `Bearer ${token}`,
|
||||
// },
|
||||
// });
|
||||
|
||||
// const result = await response.json();
|
||||
// if (result.status === "success") {
|
||||
// console.log("GET_JOINED_GROUP_URL res : ", result);
|
||||
// setGroups(result.data); // save API data
|
||||
// setLoading(false)
|
||||
// } else {
|
||||
// ToastAndroid.show("Failed to fetch groups", ToastAndroid.SHORT);
|
||||
// setLoading(false)
|
||||
// }
|
||||
// } catch (error) {
|
||||
// console.error("❌ Error fetching groups:", error);
|
||||
// } finally {
|
||||
// setLoading(false)
|
||||
// }
|
||||
// };
|
||||
|
||||
// useEffect(() => {
|
||||
// handleGroup();
|
||||
// }, []);
|
||||
|
||||
// const renderItem = ({ item }: { item: Group }) => {
|
||||
// return (
|
||||
// <TouchableOpacity
|
||||
// style={styles.card}
|
||||
// onPress={() => navigation.navigate("GroupDetails", { item })}
|
||||
// >
|
||||
// <Text style={styles.groupName}>{item.groupName}</Text>
|
||||
// <Text style={styles.description} numberOfLines={1}>{item.description}</Text>
|
||||
// <View style={styles.statsRow}>
|
||||
// <Ionicons
|
||||
// name="person-circle-outline"
|
||||
// size={20}
|
||||
// color={colors.primary}
|
||||
// />
|
||||
// <Text style={styles.detail}>
|
||||
// {item.currentParticipants}/{item.maxParticipants} members
|
||||
// </Text>
|
||||
// </View>
|
||||
|
||||
// <Text style={styles.amount}>
|
||||
// Contribution: ₹{item.contributionAmount}
|
||||
// </Text>
|
||||
// <Text style={styles.status}>Status: {item.status}</Text>
|
||||
// </TouchableOpacity>
|
||||
// );
|
||||
// };
|
||||
|
||||
// return (
|
||||
// <ScrollView>
|
||||
// {/* Stats */}
|
||||
|
||||
// {/* <Button title="Transaction List" onPress={()=>navigation.navigate('TransactionList')}/> */}
|
||||
// <AnimatedCard
|
||||
// onPress={() => navigation.navigate("TransactionList")}
|
||||
// title={"transaction list"} iconName="calculator-outline"
|
||||
// subtitle="View your transaction history"
|
||||
// backOne={colors.Home}
|
||||
// backTwo={colors.pastelPink}
|
||||
// />
|
||||
// <AnimatedCard
|
||||
// onPress={() => navigation.navigate("Management" as never)}
|
||||
// title={"Group Management"}
|
||||
// iconName="person-outline"
|
||||
// subtitle="Manage your joined & requested groups"
|
||||
// backOne={colors.Settings}
|
||||
// backTwo={colors.pastelOrange}
|
||||
// />
|
||||
|
||||
// <View style={[styles.statsRow, { marginTop: 12 }]}>
|
||||
// <View style={styles.statBox}>
|
||||
// <Text style={styles.statValue}>{totalGroups}</Text>
|
||||
// <Text style={styles.statLabel}>Groups Joined</Text>
|
||||
// </View>
|
||||
// <View style={styles.statBox}>
|
||||
// <Text style={styles.statValue}>₹{totalContribution}</Text>
|
||||
// <Text style={styles.statLabel}>Cycle Contribution</Text>
|
||||
// </View>
|
||||
// </View>
|
||||
|
||||
|
||||
// {/* Groups List */}
|
||||
// <Text style={styles.sectionTitle}>Your Groups</Text>
|
||||
// <FlatList
|
||||
// data={groups.filter((status) => status.status === "ACTIVE")}
|
||||
// keyExtractor={(item) => item.id}
|
||||
// renderItem={renderItem}
|
||||
// contentContainerStyle={{ paddingBottom: 20 }}
|
||||
// onRefresh={onRefresh}
|
||||
// refreshing={refreshing}
|
||||
// />
|
||||
// </ScrollView>
|
||||
// );
|
||||
// };
|
||||
|
||||
// export default UserHome;
|
||||
|
||||
// const styles = StyleSheet.create({
|
||||
// statsRow: {
|
||||
// flexDirection: "row",
|
||||
// gap: 10,
|
||||
// },
|
||||
// statBox: {
|
||||
// flex: 1,
|
||||
// backgroundColor: "#fff",
|
||||
// padding: 16,
|
||||
// borderRadius: 12,
|
||||
// alignItems: "center",
|
||||
// shadowColor: "#000",
|
||||
// shadowOpacity: 0.05,
|
||||
// shadowOffset: { width: 0, height: 2 },
|
||||
// shadowRadius: 6,
|
||||
// elevation: 2,
|
||||
// borderWidth:1,
|
||||
// borderColor:colors.Home
|
||||
// },
|
||||
// statValue: {
|
||||
// fontSize: 18,
|
||||
// fontWeight: "700",
|
||||
// color: colors.Home,
|
||||
// },
|
||||
// statLabel: {
|
||||
// fontSize: 12,
|
||||
// color: "#64748b",
|
||||
// marginTop: 4,
|
||||
// },
|
||||
// sectionTitle: {
|
||||
// fontSize: 18,
|
||||
// fontWeight: "600",
|
||||
// color: colors.Home,
|
||||
// marginBottom: 12,
|
||||
// marginTop:15
|
||||
// },
|
||||
// card: {
|
||||
// backgroundColor: "#ffffff",
|
||||
// padding: 16,
|
||||
// marginBottom: 12,
|
||||
// borderRadius: 12,
|
||||
// shadowColor: "#000",
|
||||
// shadowOpacity: 0.05,
|
||||
// shadowOffset: { width: 0, height: 2 },
|
||||
// shadowRadius: 6,
|
||||
// elevation: 2,
|
||||
// borderLeftWidth: 5,
|
||||
// borderColor: colors.Home
|
||||
// },
|
||||
// groupName: {
|
||||
// fontSize: 16,
|
||||
// fontWeight: "600",
|
||||
// color: colors.Home,
|
||||
// marginBottom: 4,
|
||||
// },
|
||||
// description: {
|
||||
// fontSize: 13,
|
||||
// color: "#475569",
|
||||
// marginBottom: 8,
|
||||
// },
|
||||
// detail: {
|
||||
// fontSize: 13,
|
||||
// color: "#475569",
|
||||
// marginBottom: 8,
|
||||
// },
|
||||
// amount: {
|
||||
// fontSize: 13,
|
||||
// color: "#64748b",
|
||||
// marginTop: 4,
|
||||
// },
|
||||
// status: {
|
||||
// fontSize: 12,
|
||||
// fontWeight: "500",
|
||||
// color: colors.primary,
|
||||
// marginTop: 2,
|
||||
// },
|
||||
// });
|
||||
|
||||
|
||||
|
||||
import { StyleSheet, Text, View } from 'react-native'
|
||||
import React from 'react'
|
||||
|
||||
|
||||
@@ -863,7 +863,7 @@ const styles = StyleSheet.create({
|
||||
infoValue: { fontSize: 16, fontWeight: "600", color: "#111827", textTransform: "capitalize" },
|
||||
input: { backgroundColor: "#F9FAFB", borderWidth: 1, borderColor: "#D1D5DB", borderRadius: 10, padding: 14, fontSize: 16, color: "#111827" },
|
||||
textArea: { height: 100, textAlignVertical: "top" },
|
||||
picker: { backgroundColor: "#F9FAFB", borderWidth: 1, borderColor: "#D1D5DB", borderRadius: 10 },
|
||||
picker: { backgroundColor: "#F9FAFB", borderWidth: 1, borderColor: "#D1D5DB", borderRadius: 10 ,color:colors.black},
|
||||
participantRow: { flexDirection: "row", justifyContent: "space-between", alignItems: "center", paddingVertical: 12, borderBottomWidth: 1, borderBottomColor: "#F3F4F6" },
|
||||
participantName: { fontSize: 16, fontWeight: "600", color: "#111827" },
|
||||
participantMobile: { fontSize: 14, color: "#6B7280", marginTop: 4 },
|
||||
|
||||
@@ -23,7 +23,7 @@ import colors from "../../components/colors";
|
||||
import SwitchNavigator from "./SwitchNavigator";
|
||||
import { useFocusEffect, useNavigation } from "@react-navigation/native";
|
||||
import { ApiResponse } from "../home/UserProfileStatus";
|
||||
import { BASE_URL, PUT_USER_PROFILE, PUT_USER_PROFILE_IMG, PUT_USER_STATUS } from "../../utils/ApiUrls";
|
||||
import { BASE_URL, PUT_USER_PROFILE, PUT_USER_PROFILE_IMG, USER_STATUS } from "../../utils/ApiUrls";
|
||||
import AppView from "../../components/AppView";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { clearUser, setUserData } from "../../redux/userSlice";
|
||||
@@ -265,7 +265,7 @@ const Profile = () => {
|
||||
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
const response = await fetch(PUT_USER_STATUS, {
|
||||
const response = await fetch(USER_STATUS, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Accept: "*/*",
|
||||
|
||||
Reference in New Issue
Block a user