merge code
This commit is contained in:
@@ -14,7 +14,8 @@ import { Ionicons } from "@react-native-vector-icons/ionicons"; // Assuming you
|
||||
import { apiCall } from '../../utils/ApiHelper'; // Adjust path to your apiCall utility
|
||||
import AppView from '../../components/AppView';
|
||||
import colors from '../../components/colors';
|
||||
import { useRoute } from '@react-navigation/native';
|
||||
import { RouteProp, useRoute } from '@react-navigation/native';
|
||||
import { BASE_URL } from '../../utils/ApiUrls';
|
||||
|
||||
// --- Type Definitions ---
|
||||
interface Member {
|
||||
@@ -36,10 +37,19 @@ interface ApiResponse {
|
||||
statusCode: number;
|
||||
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 ---
|
||||
// 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 [members, setMembers] = useState<Member[]>([]);
|
||||
@@ -51,12 +61,12 @@ const MemberScreen = ({ route }) => {
|
||||
setError('Group ID is missing.');
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
setLoading(true);
|
||||
try {
|
||||
const response = await apiCall<ApiResponse>(
|
||||
`http://192.168.1.5:9060/api/fund/group/all/member?groupId=${groupId}`,
|
||||
`${BASE_URL}fund/group/all/member?groupId=${groupId}`,
|
||||
'GET'
|
||||
);
|
||||
|
||||
@@ -90,13 +100,13 @@ const MemberScreen = ({ route }) => {
|
||||
<Text style={styles.avatarText}>{initial}</Text>
|
||||
</View>
|
||||
<View style={styles.infoContainer}>
|
||||
<View style={{flexDirection:"row",justifyContent:"space-between"}}>
|
||||
<Text style={styles.name}>{fullName}</Text>
|
||||
<View style={{ flexDirection: "row", justifyContent: "space-between" }}>
|
||||
<Text style={styles.name}>{fullName}</Text>
|
||||
{isOrganizer && (
|
||||
<View style={styles.organizerIcon}>
|
||||
<Text>Orginzer</Text>
|
||||
</View>
|
||||
)}
|
||||
<View style={styles.organizerIcon}>
|
||||
<Text>Orginzer</Text>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
<Text style={styles.username}>@{item.username}</Text>
|
||||
|
||||
@@ -126,9 +136,9 @@ const MemberScreen = ({ route }) => {
|
||||
if (members.length === 0) {
|
||||
return (
|
||||
<View style={styles.centered}>
|
||||
<Ionicons name="people-outline" size={60} color="#9CA3AF" />
|
||||
<Text style={styles.emptyTitle}>No Members Yet</Text>
|
||||
<Text style={styles.emptyText}>Invite people to join your group.</Text>
|
||||
<Ionicons name="people-outline" size={60} color="#9CA3AF" />
|
||||
<Text style={styles.emptyTitle}>No Members Yet</Text>
|
||||
<Text style={styles.emptyText}>Invite people to join your group.</Text>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@@ -145,7 +155,7 @@ const MemberScreen = ({ route }) => {
|
||||
};
|
||||
|
||||
return (
|
||||
<AppView>
|
||||
<AppView>
|
||||
<View style={styles.header}>
|
||||
<Text style={styles.headerTitle}>Group Members</Text>
|
||||
<Text style={styles.headerSubtitle}>{members.length} member(s)</Text>
|
||||
|
||||
Reference in New Issue
Block a user