Skip to content

Commit

Permalink
Merge pull request #908 from bounswe/905-issue-title-redirect-the-use…
Browse files Browse the repository at this point in the history
…r-to-the-comment-authors-profile-page

MOBILE: Redirect the user to comment author's profile page when the username is clicked in Forum Post Comments.
  • Loading branch information
YavizGuldalf authored Dec 15, 2024
2 parents ff0a01f + 908a213 commit f386c28
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions mobile/bulingo/app/components/commentcard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
import { View, Text, TouchableOpacity, StyleSheet, Image } from 'react-native';
import { FontAwesome } from '@expo/vector-icons';
import PressableText from '../pressableText';
import {router} from 'expo-router';
import { fetchCommentAuthorImage } from '../api/forum';
import { bookmarkComment, unbookmarkComment } from '../api/forum';

Expand Down Expand Up @@ -50,9 +51,18 @@ const toggleBookmark = async () => {
console.log(isBookmarked)
};

const redirectToAuthorProfilePage = () =>{
router.navigate('/(tabs)/profile')
setTimeout(() => {
router.push(`/(tabs)/profile/users/${username}`);
}, 0);
}

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

<TouchableOpacity onPress={redirectToAuthorProfilePage}>
<View style={styles.profileSection}>
<View style={styles.profileIcon}>
{imageLink ? (
Expand All @@ -64,6 +74,7 @@ const toggleBookmark = async () => {
</View>
<Text style={styles.userName}>{username}</Text>
</View>
</TouchableOpacity>

<View style={styles.commentSection}>
<PressableText style={styles.commentText} text={comment} />
Expand Down

0 comments on commit f386c28

Please sign in to comment.