Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #189

Merged
merged 16 commits into from
May 28, 2024
Merged

Dev #189

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ As of the latest project update (May 27th, 2024), "Live Timeless" has successful

- **Coaching Chatbot:** Fully integrated with Google's gemini pro model, the AI coaching chatbot is operational, offering personalized plans and actionable steps to help users achieve their health goals.

- **User Account Management:**: All user account management features are complete and functioning as intended, making it GDPR (General data protection regulation) compliant. This includes:
- **User Account Management:** All user account management features are complete and functioning as intended, making it GDPR (General data protection regulation) compliant. This includes:

- Secure registration and login processes.
- Functionalities to delete accounts and download user data.
Expand Down
73 changes: 5 additions & 68 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 26 additions & 11 deletions src/components/CardPost.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import PropTypes from 'prop-types';
import { supabase } from '../config/supabaseClient';

const CardPost = (props) => {

Check failure on line 12 in src/components/CardPost.js

View workflow job for this annotation

GitHub Actions / format

'LinearGradient' is defined but never used

Check failure on line 12 in src/components/CardPost.js

View workflow job for this annotation

GitHub Actions / format

'LinearGradient' is defined but never used
const session = useSelector(({ user }) => user.session);
const user = session?.user;
const [showModalCardOptions, setShowModalCardOptions] = useState(false);
Expand All @@ -22,8 +22,8 @@
const [showLikesModal, setShowLikesModal] = useState(false);
const [likedUsers, setLikedUsers] = useState([]);

useEffect(() => {

Check failure on line 25 in src/components/CardPost.js

View workflow job for this annotation

GitHub Actions / format

'isDeletingPost' is assigned a value but never used

Check failure on line 25 in src/components/CardPost.js

View workflow job for this annotation

GitHub Actions / format

'setIsDeletingPost' is assigned a value but never used

Check failure on line 25 in src/components/CardPost.js

View workflow job for this annotation

GitHub Actions / format

'isDeletingPost' is assigned a value but never used

Check failure on line 25 in src/components/CardPost.js

View workflow job for this annotation

GitHub Actions / format

'setIsDeletingPost' is assigned a value but never used
if (!showModalCardOptions && successDeleting) {

Check failure on line 26 in src/components/CardPost.js

View workflow job for this annotation

GitHub Actions / format

'setSuccessDeleting' is assigned a value but never used

Check failure on line 26 in src/components/CardPost.js

View workflow job for this annotation

GitHub Actions / format

'setSuccessDeleting' is assigned a value but never used
Alert.alert('Success!', 'Your post was deleted!');
props.actions.onDeletePostSuccess(props.postId);
}
Expand Down Expand Up @@ -60,7 +60,7 @@

const fetchLikedUsers = async () => {
try {
// Get user_ids who liked the post
// grab user_ids who liked the post
const { data: likeData, error: likeError } = await supabase
.from('Like')
.select('user_id')
Expand All @@ -76,7 +76,7 @@

const userIds = likeData.map(like => like.user_id);

// Get user details from User table
// grab user details from User table
const { data: usersData, error: usersError } = await supabase
.from('User')
.select('user_id, username, profile_image')
Expand All @@ -92,23 +92,22 @@
};

const renderCardContent = () => (
fetchLikeCount(),
fetchLikeStatus(),
<View>
{props.post.habit_photo && (
<Image source={{ uri: props.post.habit_photo }} style={styles.habitImage} resizeMode="cover" />
)}
<View style={styles.cardPostDescriptionContainer}>
{/* <View style={styles.cardPostDescriptionContainer}> */}
<Text style={styles.postText}>{props.postDescription}</Text>
</View>
<TouchableOpacity onPress={fetchLikedUsers}>
<Text style={styles.textSubtitle}>{countLikes} likes</Text>
</TouchableOpacity>
</View>
<View style={styles.cardPostDescriptionContainer}>
<Text style={styles.textUserName}>{props.postUser?.name ?? 'Unknown User'} </Text>
<Text style={styles.postText}>{props.postDescription}</Text>
</View>
</View>

// </View>
);


const renderCardActions = () => (
<View style={styles.containerActions}>
Expand All @@ -130,7 +129,7 @@
</View>
);

const onPressLike = async () => {

Check failure on line 132 in src/components/CardPost.js

View workflow job for this annotation

GitHub Actions / format

'renderCardActions' is assigned a value but never used

Check failure on line 132 in src/components/CardPost.js

View workflow job for this annotation

GitHub Actions / format

'renderCardActions' is assigned a value but never used
try {
if (!user || !user.id) {
throw new Error('User is not defined or does not have an id');
Expand Down Expand Up @@ -204,7 +203,7 @@
setLikeFromUser(likeData.length > 0);
} catch (error) {
Alert.alert('Error', 'Failed to fetch like status');
}

Check failure on line 206 in src/components/CardPost.js

View workflow job for this annotation

GitHub Actions / format

'fetchLikeCount' is assigned a value but never used

Check failure on line 206 in src/components/CardPost.js

View workflow job for this annotation

GitHub Actions / format

'fetchLikeCount' is assigned a value but never used
};

const onPressComment = () => {
Expand All @@ -217,7 +216,7 @@
postData
});
};

Check failure on line 219 in src/components/CardPost.js

View workflow job for this annotation

GitHub Actions / format

'fetchLikeStatus' is assigned a value but never used

Check failure on line 219 in src/components/CardPost.js

View workflow job for this annotation

GitHub Actions / format

'fetchLikeStatus' is assigned a value but never used
const toggleModalOptions = () => {
if (isPostFromUserLoggedIn) {
props.setBlurActive(!showModalCardOptions);
Expand Down Expand Up @@ -251,7 +250,7 @@
<TouchableOpacity style={styles.buttonActions} onPress={onPressComment}>
<Image source={require('../../assets/icons/message-dots.png')} style={styles.icon} />
<Text style={styles.textPostActions}>{props.actions.countComments > 0 ? props.actions.countComments : null}</Text>
</TouchableOpacity>

Check failure on line 253 in src/components/CardPost.js

View workflow job for this annotation

GitHub Actions / format

'setBlurActive' is missing in props validation

Check failure on line 253 in src/components/CardPost.js

View workflow job for this annotation

GitHub Actions / format

'setBlurActive' is missing in props validation
</View>

<Modal
Expand Down Expand Up @@ -319,9 +318,12 @@
textUserName: {
fontWeight: 'bold',
color: Colors.text,
marginLeft: 10,
},
textSubtitle: {
color: '#FFFFFF',
marginLeft: 10,
marginTop: 5,
},
cardPostVerticalEllipsis: {
width: 24,
Expand All @@ -330,14 +332,19 @@
habitImage: {
width: '100%',
height: 400,
borderRadius: 20,
},
cardPostDescriptionContainer: {
flexDirection: 'row',
flexDirection: 'column',
alignItems: 'flex-start',
padding: 10,
},
postText: {
color: Colors.text,
marginLeft: 5,
marginBottom: 10,
marginTop: 5,
lineHeight: 25,
},
containerActions: {
flexDirection: 'row',
Expand All @@ -354,6 +361,13 @@
marginLeft: 5,
color: Colors.text,
},
cardShadow: {
marginBottom: 5,
borderTopWidth: 0.2,
// borderBottomWidth: 1,
borderColor: 'rgba(255, 255, 255, 0.6)',
paddingVertical: 5,
},
icon: {
width: 29,
height: 29,
Expand Down Expand Up @@ -392,7 +406,7 @@
},
closeButton: {
marginTop: 20,
padding: 10,
padding: 15,
backgroundColor: Colors.primary,
borderRadius: 5,
},
Expand All @@ -402,4 +416,5 @@
},
});


export default CardPost;
4 changes: 2 additions & 2 deletions src/components/CommentCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Colors from '../../assets/styles/Colors';
import { Image } from 'react-native';
import moment from 'moment';

export default function CommentCard({ commentData }) {
export default function CommentCard({ commentData}) {
return (
<View style={styles.container}>
<View style={styles.headerContainer}>
Expand All @@ -18,7 +18,7 @@ export default function CommentCard({ commentData }) {
<View>
<Text style={styles.textUserName}>{commentData.user_id.username}</Text>
<Text style={styles.textSubtitle}>
{moment(commentData.createdAt).local().startOf('second').fromNow()}
{moment(commentData.created_at).fromNow()}
</Text>
</View>
</View>
Expand Down
2 changes: 1 addition & 1 deletion src/screens/FollowScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ const styles = StyleSheet.create({
fontWeight: 'bold',
},
unfollowButton: {
color: Colors.secondary,
color: 'white',
fontWeight: 'bold',
},
alreadyFollowing: {
Expand Down
2 changes: 1 addition & 1 deletion src/screens/FollowersScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ const styles = StyleSheet.create({
fontWeight: 'bold',
},
unfollowButton: {
color: Colors.secondary,
color: 'white',
fontWeight: 'bold',
},
alreadyFollowing: {
Expand Down
Loading
Loading