Skip to content

Commit

Permalink
nav from following and follower pages to profile
Browse files Browse the repository at this point in the history
  • Loading branch information
asa-siphuma committed Sep 27, 2024
1 parent 4bfd500 commit 425d84d
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 29 deletions.
4 changes: 2 additions & 2 deletions frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,10 @@ const ThemedStackNavigator = withTheme(({ theme }) => (
title: "movieHub.",
headerShadowVisible: false,
headerBackTitleVisible: false,
headerTintColor: "white",
headerTintColor: theme.textColor,
headerTransparent: true,
headerStyle: {
backgroundColor: theme.backgroundColor,
backgroundColor: "transparent",
},
})}
/>
Expand Down
6 changes: 0 additions & 6 deletions frontend/src/Components/MovieCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ export default function MovieCard({ movieId, imageUrl, title, rating, overview,
navigation.navigate("MovieDescriptionPage", { movieId: movieId, imageUrl: imageUrl, title: title, rating: rating, overview: overview, date: date, userInfo: userInfo });
};



const handleLikePress = () => {
setLiked(!liked);
};

return (
<View style={styles.container}>

Expand Down
1 change: 0 additions & 1 deletion frontend/src/Screens/ExplorePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ export default function ExplorePage({ route }) {
}
}, [userInfo]);


useEffect(() => {
if (userInfo) {
fetchFriendsContent();
Expand Down
26 changes: 14 additions & 12 deletions frontend/src/Screens/FollowersPage.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React, { useEffect, useState } from 'react';
import { View, FlatList, StyleSheet, Text, ActivityIndicator } from 'react-native';
import FollowList from '../Components/FollowList';
import { View, FlatList, StyleSheet, Text, ActivityIndicator, TouchableOpacity } from 'react-native';
import { getFollowers, isFollowed } from '../Services/UsersApiService';
import { useTheme } from "../styles/ThemeContext";
import FollowList from '../Components/FollowList';
import { useNavigation } from '@react-navigation/native';

const FollowersPage = ({ route }) => {
const { userInfo } = route.params;
console.log(userInfo)
const navigation = useNavigation();
const [followers, setFollowers] = useState([]);
const [loading, setLoading] = useState(true);
const {theme} = useTheme();
Expand All @@ -24,7 +25,6 @@ const FollowersPage = ({ route }) => {
isFollowing, // Add the isFollowing property
};
}));
console.log("followers", followersWithStatus)
setFollowers(followersWithStatus); // Set the updated followers list
} catch (error) {
console.error("Error fetching followers:", error);
Expand All @@ -38,14 +38,16 @@ const FollowersPage = ({ route }) => {
}, []);

const renderFollower = ({ item }) => (
<FollowList
route={route}
uid={item.uid}
username={item.username}
userHandle={item.name}
userAvatar={item.avatar}
isFollowing={item.isFollowing}
/>
<TouchableOpacity onPress={() => navigation.navigate('Profile', { userInfo, otherUserInfo: item })}>
<FollowList
route={route}
uid={item.uid}
username={item.username}
userHandle={item.name}
userAvatar={item.avatar}
isFollowing={item.isFollowing}
/>
</TouchableOpacity>
);

const styles = StyleSheet.create({
Expand Down
18 changes: 10 additions & 8 deletions frontend/src/Screens/FollowingPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,16 @@ const FollowingPage = ({ route }) => {


const renderFollower = ({ item }) => (
<FollowList
route={route}
uid={item.uid}
username={item.username}
userHandle={item.name}
userAvatar={item.avatar}
isFollowing={item.isFollowing}
/>
<TouchableOpacity onPress={() => navigation.navigate('Profile', { userInfo, otherUserInfo: item })}>
<FollowList
route={route}
uid={item.uid}
username={item.username}
userHandle={item.name}
userAvatar={item.avatar}
isFollowing={item.isFollowing}
/>
</TouchableOpacity>
);

const styles = StyleSheet.create({
Expand Down
1 change: 1 addition & 0 deletions frontend/src/Screens/GenrePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ const GenrePage = () => {

<MovieCard
key={index}
userInfo={userInfo}
movieId={movie.id}
imageUrl={`https://image.tmdb.org/t/p/w500${movie.poster_path}`}
title={movie.title}
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/Screens/Notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ const Notifications = ({ route }) => {
<Text style={styles.buttonText}>Read</Text>
</TouchableOpacity>
)}
<TouchableOpacity style={[styles.button, styles.deleteButton]} onPress={() => handleDeleteNotification(item.id, item.type)}>
<Text style={styles.buttonText}>Delete</Text>
</TouchableOpacity>
<TouchableOpacity style={[styles.button, styles.followButton]} onPress={() => handleFollow(item.isFollowing, item.followerId)}>
<Text style={styles.buttonText}>{item.isFollowing ? "Following" : "Follow"}</Text>
</TouchableOpacity>
Expand Down

0 comments on commit 425d84d

Please sign in to comment.