fix logical and api integration issues
This commit is contained in:
@@ -22,6 +22,8 @@ const colors = {
|
|||||||
// Special background colors with transparency
|
// Special background colors with transparency
|
||||||
alertBackground: "rgba(255, 255, 255, 0.8)",
|
alertBackground: "rgba(255, 255, 255, 0.8)",
|
||||||
androidBackdrop: "rgba(0, 0, 0, 0.4)",
|
androidBackdrop: "rgba(0, 0, 0, 0.4)",
|
||||||
|
warning:'#b9b61cff',
|
||||||
|
danger:'#f04814ff'
|
||||||
};
|
};
|
||||||
|
|
||||||
export default colors;
|
export default colors;
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ export interface EditGroupPayload {
|
|||||||
groupName: string;
|
groupName: string;
|
||||||
description: string;
|
description: string;
|
||||||
maxParticipants: number;
|
maxParticipants: number;
|
||||||
|
minParticipants?:number;
|
||||||
contributionAmount: number;
|
contributionAmount: number;
|
||||||
customCycleDays: number | null;
|
customCycleDays: number | null;
|
||||||
cycleType: 'QUARTERLY' | 'MONTHLY' | 'WEEKLY' | 'CUSTOM';
|
cycleType: 'QUARTERLY' | 'MONTHLY' | 'WEEKLY' | 'CUSTOM';
|
||||||
@@ -288,7 +289,7 @@ const EditGroupScreen: React.FC<EditGroupScreenProps> = ({ route }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const renderField = (field: keyof EditGroupPayload, label: string, displayValue: string | number, isEditing: boolean, isEditable: boolean) => {
|
const renderField = (field: keyof EditGroupPayload, label: string, displayValue: string | number, isEditing: boolean, isEditable?: boolean) => {
|
||||||
const commonInputProps = { style: styles.input, placeholderTextColor: "#9CA3AF" };
|
const commonInputProps = { style: styles.input, placeholderTextColor: "#9CA3AF" };
|
||||||
|
|
||||||
const getInputForField = () => {
|
const getInputForField = () => {
|
||||||
@@ -426,12 +427,12 @@ const EditGroupScreen: React.FC<EditGroupScreenProps> = ({ route }) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("✅ Image selected:", {
|
// console.log("✅ Image selected:", {
|
||||||
uri: selectedImage.uri,
|
// uri: selectedImage.uri,
|
||||||
size: (selectedImage?.fileSize / 1024).toFixed(2) + "KB",
|
// size: (selectedImage?.fileSize / 1024).toFixed(2) + "KB",
|
||||||
width: selectedImage.width,
|
// width: selectedImage.width,
|
||||||
height: selectedImage.height
|
// height: selectedImage.height
|
||||||
});
|
// });
|
||||||
|
|
||||||
setSelectedImage(selectedImage.uri);
|
setSelectedImage(selectedImage.uri);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { Ionicons } from "@react-native-vector-icons/ionicons"; // Assuming you
|
|||||||
import { apiCall } from '../../utils/ApiHelper'; // Adjust path to your apiCall utility
|
import { apiCall } from '../../utils/ApiHelper'; // Adjust path to your apiCall utility
|
||||||
import AppView from '../../components/AppView';
|
import AppView from '../../components/AppView';
|
||||||
import colors from '../../components/colors';
|
import colors from '../../components/colors';
|
||||||
import { useRoute } from '@react-navigation/native';
|
import { RouteProp, useRoute } from '@react-navigation/native';
|
||||||
import { BASE_URL } from '../../utils/ApiUrls';
|
import { BASE_URL } from '../../utils/ApiUrls';
|
||||||
|
|
||||||
// --- Type Definitions ---
|
// --- Type Definitions ---
|
||||||
@@ -37,10 +37,19 @@ interface ApiResponse {
|
|||||||
statusCode: number;
|
statusCode: number;
|
||||||
data: Member[];
|
data: Member[];
|
||||||
}
|
}
|
||||||
|
type RootStackParamList = {
|
||||||
|
Member: { groupId: string }; // or number, depending on your data type
|
||||||
|
};
|
||||||
|
|
||||||
|
type MemberScreenRouteProp = RouteProp<RootStackParamList, 'Member'>;
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
route: MemberScreenRouteProp;
|
||||||
|
}
|
||||||
|
|
||||||
// --- Main Screen Component ---
|
// --- Main Screen Component ---
|
||||||
// This assumes the component receives `groupId` from a navigator (e.g., Tab Navigator)
|
// This assumes the component receives `groupId` from a navigator (e.g., Tab Navigator)
|
||||||
const MemberScreen = ({ route }) => {
|
const MemberScreen = ({ route }: Props) => {
|
||||||
|
|
||||||
const { groupId } = route.params;
|
const { groupId } = route.params;
|
||||||
const [members, setMembers] = useState<Member[]>([]);
|
const [members, setMembers] = useState<Member[]>([]);
|
||||||
@@ -52,7 +61,7 @@ const MemberScreen = ({ route }) => {
|
|||||||
setError('Group ID is missing.');
|
setError('Group ID is missing.');
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
@@ -91,13 +100,13 @@ const MemberScreen = ({ route }) => {
|
|||||||
<Text style={styles.avatarText}>{initial}</Text>
|
<Text style={styles.avatarText}>{initial}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.infoContainer}>
|
<View style={styles.infoContainer}>
|
||||||
<View style={{flexDirection:"row",justifyContent:"space-between"}}>
|
<View style={{ flexDirection: "row", justifyContent: "space-between" }}>
|
||||||
<Text style={styles.name}>{fullName}</Text>
|
<Text style={styles.name}>{fullName}</Text>
|
||||||
{isOrganizer && (
|
{isOrganizer && (
|
||||||
<View style={styles.organizerIcon}>
|
<View style={styles.organizerIcon}>
|
||||||
<Text>Orginzer</Text>
|
<Text>Orginzer</Text>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
<Text style={styles.username}>@{item.username}</Text>
|
<Text style={styles.username}>@{item.username}</Text>
|
||||||
|
|
||||||
@@ -132,9 +141,9 @@ const MemberScreen = ({ route }) => {
|
|||||||
if (members.length === 0) {
|
if (members.length === 0) {
|
||||||
return (
|
return (
|
||||||
<View style={styles.centered}>
|
<View style={styles.centered}>
|
||||||
<Ionicons name="people-outline" size={60} color="#9CA3AF" />
|
<Ionicons name="people-outline" size={60} color="#9CA3AF" />
|
||||||
<Text style={styles.emptyTitle}>No Members Yet</Text>
|
<Text style={styles.emptyTitle}>No Members Yet</Text>
|
||||||
<Text style={styles.emptyText}>Invite people to join your group.</Text>
|
<Text style={styles.emptyText}>Invite people to join your group.</Text>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -151,7 +160,7 @@ const MemberScreen = ({ route }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppView>
|
<AppView>
|
||||||
<View style={styles.header}>
|
<View style={styles.header}>
|
||||||
<Text style={styles.headerTitle}>Group Members</Text>
|
<Text style={styles.headerTitle}>Group Members</Text>
|
||||||
<Text style={styles.headerSubtitle}>{members.length} member(s)</Text>
|
<Text style={styles.headerSubtitle}>{members.length} member(s)</Text>
|
||||||
|
|||||||
@@ -5,17 +5,22 @@ import { Ionicons } from "@react-native-vector-icons/ionicons";
|
|||||||
import { useNavigation } from '@react-navigation/native';
|
import { useNavigation } from '@react-navigation/native';
|
||||||
import ContributionDetails from '../ContributionScreen';
|
import ContributionDetails from '../ContributionScreen';
|
||||||
import { BASE_URL } from '../../utils/ApiUrls';
|
import { BASE_URL } from '../../utils/ApiUrls';
|
||||||
|
import colors from '../../components/colors';
|
||||||
|
|
||||||
const { width } = Dimensions.get('window');
|
const { width } = Dimensions.get('window');
|
||||||
const NUM_COLUMNS = 3;
|
const NUM_COLUMNS = 3;
|
||||||
const ITEM_SIZE = width / NUM_COLUMNS - 20;
|
const ITEM_SIZE = width / NUM_COLUMNS - 20;
|
||||||
|
|
||||||
|
interface User {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
selected: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
const RandomSelectUserScreen: React.FC<{ route: any }> = ({ route }) => {
|
const RandomSelectUserScreen: React.FC<{ route: any }> = ({ route }) => {
|
||||||
const navigation = useNavigation()
|
const navigation = useNavigation<any>()
|
||||||
const { groupId, cycleNumber } = route.params;
|
const { groupId, cycleNumber } = route.params;
|
||||||
|
const [users, setUsers] = useState<User[]>([]);
|
||||||
|
|
||||||
const [users, setUsers] = useState<{ id: string; name: string }[]>([]);
|
|
||||||
const [highlightedIndex, setHighlightedIndex] = useState<number | null>(null);
|
const [highlightedIndex, setHighlightedIndex] = useState<number | null>(null);
|
||||||
const [winner, setWinner] = useState<{ id: string; name: string } | null>(null);
|
const [winner, setWinner] = useState<{ id: string; name: string } | null>(null);
|
||||||
const [isAnimating, setIsAnimating] = useState(false);
|
const [isAnimating, setIsAnimating] = useState(false);
|
||||||
@@ -134,7 +139,7 @@ const RandomSelectUserScreen: React.FC<{ route: any }> = ({ route }) => {
|
|||||||
} else {
|
} else {
|
||||||
Alert.alert('Error', 'Failed to determine a winner from the API.');
|
Alert.alert('Error', 'Failed to determine a winner from the API.');
|
||||||
}
|
}
|
||||||
navigation.replace('EditGroup', { groupId })
|
navigation.replace('EditGroup', { groupId })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Alert.alert('Error', 'Could not connect to the server to fetch the winner.');
|
// Alert.alert('Error', 'Could not connect to the server to fetch the winner.');
|
||||||
} finally {
|
} finally {
|
||||||
@@ -158,7 +163,7 @@ const RandomSelectUserScreen: React.FC<{ route: any }> = ({ route }) => {
|
|||||||
isHighlighted && styles.highlightedItem,
|
isHighlighted && styles.highlightedItem,
|
||||||
isWinner && styles.winnerItem,
|
isWinner && styles.winnerItem,
|
||||||
animatedStyle,
|
animatedStyle,
|
||||||
{ backgroundColor: item?.selected && 'green' }
|
{ backgroundColor: item?.selected ? colors.pastelGreen : '#fff' }
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Ionicons name="person" size={40} color={isHighlighted || isWinner ? '#000000ff' : '#4b5563'} />
|
<Ionicons name="person" size={40} color={isHighlighted || isWinner ? '#000000ff' : '#4b5563'} />
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ interface WinnerUserProps {
|
|||||||
}
|
}
|
||||||
visible: boolean
|
visible: boolean
|
||||||
onClose: () => void
|
onClose: () => void
|
||||||
groupId:string
|
groupId:string | number
|
||||||
}
|
}
|
||||||
|
|
||||||
const WinnerUser: React.FC<WinnerUserProps> = ({ data, visible, onClose, groupId }) => {
|
const WinnerUser: React.FC<WinnerUserProps> = ({ data, visible, onClose, groupId }) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user