// components/MyGroupCard.tsx import React from "react"; import { View, Text, StyleSheet, TouchableOpacity, } from "react-native"; import { Ionicons } from "@react-native-vector-icons/ionicons"; import colors from "./colors"; interface MyGroup { id: string; groupName: string; description: string; visibility: "PUBLIC" | "PRIVATE"; createdByName: string; currentParticipants: number; maxParticipants: number; contributionAmount: number; cycleType: "MONTHLY" | "QUARTERLY" | "YEARLY"; status: "PENDING" | "ACTIVE" | "COMPLETED"; } interface Props { item: MyGroup; onManage: (group: MyGroup) => void; } export const MyGroupCard: React.FC = ({ item, onManage }) => { const getStatusColor = () => { switch (item.status) { case "ACTIVE": return colors.pastelGreen; case "PENDING": return colors.pastelOrange; // amber case "COMPLETED": return colors.pastelBlue; default: return "#adb5bd"; } }; return ( {/* Left Content */} {item.groupName} {item.status} {item.description} {item.currentParticipants}/{item.maxParticipants} ₹{item.contributionAmount} {item.cycleType} Created by {item.createdByName} {/* Manage Button */} onManage(item)}> Manage ); }; const styles = StyleSheet.create({ card: { backgroundColor: "#fff", borderRadius: 12, padding: 16, marginBottom: 12, flexDirection: "row", alignItems: "center", elevation: 2, shadowColor: "#000", shadowOpacity: 0.05, shadowRadius: 4, marginHorizontal:12 }, cardHeader: { flexDirection: "row", justifyContent: "space-between", alignItems: "center", marginBottom: 6, }, cardTitle: { fontSize: 17, fontWeight: "bold", color: "#343a40", flex: 1, marginRight: 10, }, cardSubtitle: { fontSize: 14, color: "#6c757d", marginBottom: 8, }, cardMetaContainer: { flexDirection: "row", alignItems: "center", flexWrap: "wrap", marginBottom: 6, }, manageButtonText: { fontSize: 12, color: colors.textDark, }, cardMetaText: { fontSize: 13, color: "#495057", fontWeight: "500", marginRight: 16, flexDirection: "row", alignItems: "center", }, statusBadge: { paddingHorizontal: 10, paddingVertical: 4, borderRadius: 5, elevation: 1, }, statusBadgeText: { color: colors.textDark, fontSize: 10, fontWeight: "bold", textTransform: "uppercase", }, manageButton: { width: 100, borderRadius:10, flexDirection:"row", alignItems: "center", justifyContent: "space-around", padding: 6, marginLeft: 10, elevation:2, backgroundColor: colors.pastelOrange, }, createdBy: { fontSize: 12, color: "#868e96", marginTop: 4, }, }); export default MyGroupCard;