pay indivisual
This commit is contained in:
@@ -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'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user