diff --git a/mobile/__tests__/App.test.js b/mobile/__tests__/App.test.js index 75549be..789d27a 100644 --- a/mobile/__tests__/App.test.js +++ b/mobile/__tests__/App.test.js @@ -53,13 +53,18 @@ test('Renders Search Result Page Correctly', () => { expect(tree).toMatchSnapshot(); }); -test('Searches Correctly', async () => { /* TODO: Change the endpoints */ +test('Searches Correctly', async () => { const mockTitle = jest.fn(); const mockImage = jest.fn(); - const mockCreator = jest.fn(); - const mockType = jest.fn(); - - const response = await apiInstance().post("search", { mockTitle, mockImage, mockCreator, mockType }); + const mockExercies = jest.fn(); + const mockName = jest.fn(); + const mockEquipment = jest.fn(); + const mockBodyPart = jest.fn(); + const mockInstruction = jest.fn(); + const mockTargetMuscle = jest.fn(); + const mockSecondaryMuscles = jest.fn(); + + const response = await apiInstance().post("search", { mockTitle, mockImage, mockExercies, mockName, mockEquipment, mockBodyPart, mockInstruction, mockTargetMuscle, mockSecondaryMuscles }); expect(response).toBe( /* TODO: The Object That Returns */ ); }); @@ -72,11 +77,16 @@ test('Renders Create Post Page Correctly', () => { test('Create Post Correctly', async () => { const mockTitle = jest.fn(); + const mockPost = jest.fn(); const mockDescription = jest.fn(); + const mockImage = jest.fn(); const mockLabels = jest.fn(); const mockLabelTest = jest.fn(); + const mockProfile = jest.fn(); + const mockPassword = jest.fn(); + const mockSessionToken = jest.fn(); - const response = await apiInstance().post("createPost", { mockTitle, mockDescription, mockLabels, mockLabelTest }); + const response = await apiInstance().post("createPost", { mockTitle, mockPost, mockDescription, mockImage, mockLabels, mockLabelTest, mockProfile, mockPassword, mockSessionToken }); expect(response).toBe( /* TODO: The Object That Returns */ ); }); diff --git a/mobile/components/ProfilePage.js b/mobile/components/ProfilePage.js index 1ecc20d..53eb692 100644 --- a/mobile/components/ProfilePage.js +++ b/mobile/components/ProfilePage.js @@ -175,7 +175,14 @@ useEffect(() => { const programs = [ { id: 1, title: "Full Body Workout", description: "This is a comprehensive program targeting all major muscle groups.", - trainerUsername: "fitness_guru_123", + trainerUsername: "sametalan", + participants:[ + "sametalan2", + "Hanaaa", + "deno", + "fit_deniz" + ], + createdAt:'2024-11-25T13:52:56.512941', exercises: [ { exercise:{ name: "Push-Up", @@ -204,7 +211,14 @@ useEffect(() => { ]}, { id: 2, title: "Full Body Workout", description: "This is a comprehensive program targeting all major muscle groups.", - trainerUsername: "fitness_guru_123", + trainerUsername: "fit_deniz", + participants:[ + "sametalan2", + "Hanaaa", + "deno", + "fit_deniz" + ], + createdAt:'2024-11-25T13:52:56.512941', exercises: [ { exercise:{ name: "Push-Up", @@ -353,7 +367,7 @@ useEffect(() => { {/* Profile Header */} {username} diff --git a/mobile/components/ProgramCard.js b/mobile/components/ProgramCard.js index 796089a..431fed9 100644 --- a/mobile/components/ProgramCard.js +++ b/mobile/components/ProgramCard.js @@ -5,7 +5,7 @@ const ProgramCard = ({ trainerUsername, title, description, exercises, date, par return ( navigation.navigate('ProgramDetail', { trainerUsername, title, description, exercises, navigation })} + onPress={() => navigation.navigate('ProgramDetail', { trainerUsername, title, description, exercises, participants, date, navigation })} > navigation.navigate('UserProfile', { username: trainerUsername })}> {trainerUsername} diff --git a/mobile/components/ProgramDetail.js b/mobile/components/ProgramDetail.js index 9174d32..af32b09 100644 --- a/mobile/components/ProgramDetail.js +++ b/mobile/components/ProgramDetail.js @@ -11,7 +11,7 @@ import { } from 'react-native'; const ProgramDetail = ({ route }) => { - const { title, description, trainerUsername, exercises } = route.params; + const { trainerUsername, title, description, exercises, date, participants, navigation } = route.params; /*const {title, description, trainerUsername, exercises} = { title: "Full Body Workout", description: "This is a comprehensive program targeting all major muscle groups.", @@ -43,11 +43,19 @@ const ProgramDetail = ({ route }) => { } ], }*/ + console.log(participants); const [expandedExercise, setExpandedExercise] = useState(null); const toggleExerciseDetails = (index) => { setExpandedExercise(expandedExercise === index ? null : index); }; + const renderParticipant = ({ item, index }) => { + return( + navigation.navigate('UserProfile', { username: item })}> + {item} + + ); + } const renderExercise = ({ item, index }) => { const isExpanded = expandedExercise === index; @@ -100,11 +108,21 @@ const ProgramDetail = ({ route }) => { return ( - {/* Program Info */} + {/* Participant Info */} {title} {trainerUsername} {description} + + Participants: + index.toString()} + renderItem={renderParticipant} + contentContainerStyle={styles.participantsList} + /> + + {/* Exercises List */} Exercises: @@ -185,7 +203,26 @@ container: { shadowColor: '#000', shadowOpacity: 0.1, shadowRadius: 5, - marginBottom: 20}, + marginBottom: 20 + }, + participantListTitle: { + fontSize: 18, + fontWeight: 'bold', + color: '#333', + marginBottom: 10, + }, + participantsList: { + paddingBottom: 20, + }, + participantsContainer:{ + backgroundColor: '#FFFFFF', + borderRadius: 12, + padding: 15, + shadowColor: '#000', + shadowOpacity: 0.1, + shadowRadius: 5, + marginBottom: 20 + }, exerciseContainer: { backgroundColor: '#f9f9f9', borderRadius: 10, @@ -196,6 +233,7 @@ container: { shadowRadius: 5, elevation: 2, }, + exerciseHeader: { flexDirection: 'row', justifyContent: 'space-between',