Skip to content

Commit 30759af

Browse files
add lastest
1 parent e706d96 commit 30759af

File tree

18 files changed

+11301
-4347
lines changed

18 files changed

+11301
-4347
lines changed

package-lock.json

Lines changed: 11248 additions & 4294 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"eslint-plugin-react": "^7.32.2",
3535
"eslint-plugin-react-hooks": "^4.6.0",
3636
"eslint-plugin-react-refresh": "^0.4.3",
37+
"jest": "^29.7.0",
3738
"postcss": "^8.4.28",
3839
"prettier": "3.0.2",
3940
"tailwindcss": "^3.3.3",

src/Components/Home/FriendsList/Requests/RequestItem.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1+
import { useNavigate } from 'react-router-dom'
12
import { imgLink } from '../../../../api'
23
import { transferDate } from '../../../../Functions/transferDate'
34
import RespondToInvite from './RespondToInvite'
45
function RequestItem({request}) {
6+
const navigate=useNavigate()
57
return (
6-
<div className='flex justify-between items-center py-2 '>
8+
<div className='flex justify-between items-center py-2 ' >
79
<div className='flex gap-4'>
8-
<img src={`${imgLink}/${request.team.imageUrl}`} alt='profile img' className='align-middle justify-self-center w-14 h-14 rounded-full'/>
10+
<img src={`${imgLink}/${request.team.imageUrl}`} alt='profile img' className='align-middle cursor-pointer justify-self-center w-14 h-14 rounded-full'/>
911
<div>
10-
<h5 className='font-semibold text-sm mb-3'>you are invited to join {request.team.name}</h5>
12+
<h5 className='font-semibold text-sm mb-3 cursor-pointer' onClick={()=>navigate(`/teams/${request.team.id}`)}>you are invited to join {request.team.name}</h5>
1113
<p className='text-xs'>{transferDate(request.created_at)}</p>
1214
</div>
1315
</div>

src/Components/Individuals/Individual.jsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
/* eslint-disable react/prop-types */
22
import { imgLink } from '../../api'
33
import noImage from '../../assets/images/profile/no-profile-picture.svg'
4-
function Indivdual({name,img,followed,track}) {
4+
import {useNavigate} from 'react-router-dom'
5+
import { useSelector } from 'react-redux'
6+
function Indivdual({name,img,followed,track,id}) {
7+
const navigate=useNavigate()
8+
const user=useSelector(state=>state.auth).user
9+
if(user.id==id) return ;
510
return (
611
<div className='flex justify-between items-center'>
712
<div className='flex items-center gap-6'>
813
<img src={img?`${imgLink}/${img}`:noImage} alt="profile img" className='w-14' />
914
<div>
10-
<h3 className='text-base font-semibold'>{name}</h3>
15+
<h3 className='text-base font-semibold cursor-pointer' onClick={()=>navigate(`/visit/${id}`)}>{name}</h3>
1116
<p className='text-xs font-semibold'>{track}</p>
1217

1318
</div>

src/Components/Individuals/IndividualsList.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function IndividualsList() {
3535
width={40}
3636
/></div>:<div className='flex flex-col gap-4 w-full py-8 h-[calc(100vh_-_99px)]'>
3737
{ currentUsers.map(user=> <Indivdual key={user.id} name={user.name}
38-
img={user.imageUrl} track={user.track} followed={true}/>)}
38+
img={user.imageUrl} track={user.track} id={user.id} followed={true}/>)}
3939
</div>}
4040
</>
4141
)

src/Components/Posts/Post/PostDetails/PostDetails.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ function PostDetails({ post, openLikesList,openCommentsList,likesNumber,comments
1414
{ count: commentsNumber, icon: commentIcon, alt: 'Comment Icon',click:openCommentsList },
1515
{ count: post.shares_count, icon: sharIcon, alt: 'Share Icon' },
1616
])
17-
console.log(post)
1817
useEffect(()=>{
1918

2019

src/Components/Posts/Post/PostDetails/comment/CommentList.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ function CommentList({ closeCommentsList, comments, id }) {
1616
userName={comment.user_name}
1717
content={comment.content}
1818
date={comment.created_at}
19+
id={comment.user_id}
1920
/>
2021
))}
2122
</div>

src/Components/Posts/Post/PostDetails/comment/CommentListItem.jsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
/* eslint-disable react/prop-types */
2-
import profileimg from '../../../../../assets/images/posts/comments/Ellipse 27.svg';
32
import { transferDate } from '../../../../../Functions/transferDate';
3+
import noImage from '../../../../../assets/images/profile/no-profile-picture.svg'
4+
import { imgLink } from '../../../../../api';
5+
import { useNavigate } from 'react-router-dom';
46

57
// eslint-disable-next-line no-unused-vars
6-
function CommentListItem({ img, userName, content, date }) {
8+
function CommentListItem({ img, userName, content, date , id}) {
9+
const navigate=useNavigate()
710
return (
811
<div className="flex justify-between items-center">
912
<div className="flex gap-6 items-center">
10-
<img src={profileimg} alt="profile image" />
13+
<img src={img?`${imgLink}/${img}`:noImage} alt="profile image" className='w-14 h-14 rounded-full' />
1114
<div>
12-
<p className="text-[15px] font-semibold">{userName}</p>
15+
<p className="text-[15px] font-semibold cursor-pointer" onClick={()=>navigate(`/visit/${id}`)}>{userName}</p>
1316
<p className="text-sm">{content}</p>
1417
</div>
1518
</div>

src/Components/Posts/Post/PostDetails/likes/LikeListItem.jsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1+
/* eslint-disable react/prop-types */
2+
import { useSelector } from 'react-redux'
3+
import { useNavigate } from 'react-router-dom'
14
import { imgLink } from '../../../../../api'
25
import noImage from '../../../../../assets/images/profile/no-profile-picture.svg'
3-
function LikeListItem({name,img,followed}) {
6+
function LikeListItem({name,img,followed,id}) {
7+
const user=useSelector(state=>state.auth).user
8+
const navigate=useNavigate()
49
return (
510
<div className='flex justify-between items-center'>
611
<div className='flex items-center gap-6'>
712
<img src={img?`${imgLink}/${img}`:noImage} alt="profile img" className='w-14' />
813
<div>
9-
<h3 className='text-base font-semibold'>{name}</h3>
14+
<h3 className='text-base font-semibold ' onClick={()=>navigate(`/visit/${user.id}`)}>{name}</h3>
1015
</div>
1116
</div>
12-
<button className={`${followed?'bg-white !text-primary border-[1px] border-primary border-solid':'bg-primary text-white'} py-2 px-5 w-fit rounded-[10px] h-fit`}>Following</button>
17+
{id==user.id&&<button className={`${followed?'bg-white !text-primary border-[1px] border-primary border-solid':'bg-primary text-white'} py-2 px-5 w-fit rounded-[10px] h-fit`}>Following</button>}
1318
</div>
1419
)
1520
}

src/Components/Posts/Post/PostDetails/likes/LikesList.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
/* eslint-disable react/prop-types */
2-
import { getFriendsFakeData } from '../../../../../Functions/getFriendsFakeData'
32
import closeImg from '../../../../../assets/images/home/icons8-close-50 5.svg'
43
import LikeListItem from './LikeListItem'
54
// eslint-disable-next-line no-unused-vars
65
function LikesList({datalikes, closeLikesList}) {
7-
const fakeData=getFriendsFakeData(10)
8-
console.log(datalikes )
96
return (
107
<div className="absolute top-[35px] w-full h-[calc(100%_-_50px)] overflow-hidden shadow-lg scroll-y overflow-y-auto custom-scrollbar rounded-lg bg-[rgba(252,250,248,1)]">
118
<div className='border-b-[1.5px] border-b-solid border-b-[rgba(227,227,227,1)]'>
@@ -16,7 +13,7 @@ function LikesList({datalikes, closeLikesList}) {
1613
</div>
1714

1815
<div className='p-6 flex flex-col gap-6'>
19-
{datalikes &&datalikes[0].likesData.map((user)=> <LikeListItem key={user.user_id} name={user.user_name}
16+
{datalikes &&datalikes[0].likesData.map((user)=> <LikeListItem key={user.user_id} id={user.user_id} name={user.user_name}
2017
img={user.user_imageUrl} track={'frontend'} followed={true}/>)}
2118

2219
</div>

src/Components/Posts/Post/PostHeader.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
/* eslint-disable no-undef */
22
/* eslint-disable react/prop-types */
33
import { useSelector } from 'react-redux';
4+
import { useNavigate } from 'react-router-dom';
45
import { imgLink } from '../../../api';
56
import noPicture from '../../../assets/images/profile/no-profile-picture.svg';
67
import { transferDate } from '../../../Functions/transferDate';
78
import EditPost from './EditPost/EditPost';
89

910
function PostHeader({ post }) {
1011
const { user_name, created_at,user_id } = post;
12+
console.log(post)
13+
const navigate=useNavigate()
1114
const userData=useSelector(state=>state.auth).user
1215
return (
1316
<header className='flex items-center py-4 text-inter justify-between'>
1417
<div className='space-x-5 flex items-center'>
15-
<img src={userData.imageUrl?`${imgLink}/${userData.imageUrl}`:noPicture} alt='profile img' className='w-14 h-14 rounded-full' />
18+
<img src={post.user_imageUrl?`${imgLink}/${post.user_imageUrl}`:noPicture} alt='profile img' className='w-14 h-14 rounded-full' />
1619
<div className='flex flex-col'>
17-
<p className='text-base font-medium font-inter'>{user_name}</p>
18-
<p className='text-xs font-normal'>Front End developer</p>
20+
<p className='text-base font-medium cursor-pointer' onClick={()=>navigate(`/visit/${user_id}`)}>{user_name}</p>
1921
</div>
2022
</div>
2123
<div className='flex gap-4'>

src/Components/Posts/Post/PostListDetail.jsx

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/Components/Profile/InviteTeam.jsx/UserItem.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { useState } from "react"
33
import { imgLink } from "../../../api"
44
import InviteButton from "./InviteButton"
5-
5+
import noPic from '../../../assets/images/profile/no-profile-picture.svg'
66
function UserItem({userData,selectedTeam,teams}) {
77
const joinedTeam=teams.find(team=> team.id==selectedTeam.id).members.find(member=>{
88
return member.pivot.user_id==userData.id})
@@ -12,7 +12,7 @@ function UserItem({userData,selectedTeam,teams}) {
1212
return (
1313
<div className="flex items-center justify-between mx-auto w-[300px] my-4">
1414
<div className="flex item-center gap-2 justify-center">
15-
<img className="w-[50px] h-[50px] rounded-full" src={`${imgLink}/${userData.imageUrl}`} />
15+
<img className="w-[50px] h-[50px] rounded-full" src={userData.imageUrl?`${imgLink}/${userData.imageUrl}`:noPic} />
1616
<div>
1717
<h5 className="text-[13px] font-semibold">{userData.name}</h5>
1818
<p className="text-[10px]">{userData.track}</p>

src/Components/Profile/SideBar/DeleteAccount.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import ReactLoading from 'react-loading';
66
import {useNavigate} from 'react-router-dom'
77
import deleteAccountIcon from '../../../assets/images/profile/sidebar/deleteAccount.svg'
88

9-
function DeleteAccount({data,user}) {
9+
function DeleteAccount({user}) {
1010
const {fetchApi:deleteAccount,loading}=useFetch(`http://localhost:8000/api/profile/edit-profile/${user.id}`,postOptions)
1111
const navigate=useNavigate()
1212

1313
const deleteHandler =async ()=>{
1414

1515
if(confirm('are you sure you want to delete')){
16-
const resData=await DeleteAccount()
16+
const resData=await deleteAccount()
1717
if(resData.ok){
1818
localStorage.clear()
1919
navigate('/')

src/Components/Teams/JoinRequestList/JoinRequestListItem.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/* eslint-disable react/prop-types */
2-
import profileImage from '../../../assets/images/teams/Ellipse 26.svg'
2+
import noPicture from '../../../assets/images/profile/no-profile-picture.svg';
33
import RespondToRequest from './RespondToRequest'
44
function JoinRequestListItem({request,setJoinRequestsList}) {
55
return (
66
<div>
77
<div className='flex mb-5 items-center justify-center flex-wrap'>
8-
<img src={profileImage} alt='profile image' className='mr-3 mb-2 w-12 h-12'/>
8+
<img src={noPicture} alt='profile image' className='mr-3 mb-2 w-12 h-12'/>
99
<div className='flex-col mr-5 mb-2'>
1010
<h4 className='text-[12px] font-bold'>{request.user.name}</h4>
1111
<p className='text-[10px] font-semibold'>FrontEnd developer</p>

src/Components/Teams/TeamsDetails/TeamMember.jsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
1+
/* eslint-disable no-undef */
12
/* eslint-disable react/prop-types */
2-
import imgProfile from '../../../assets/images/posts/comments/Ellipse 27.svg'
3-
import {useSelector,useDispatch} from 'react-redux'
3+
import noImg from '../../../assets/images/profile/no-profile-picture.svg'
4+
import {useSelector} from 'react-redux'
45
import DeleteMember from './DeleteMember'
6+
import { imgLink } from '../../../api'
7+
import {useNavigate} from 'react-router-dom'
58

6-
function TeamMember({role,image,name,team,memberId}) {
9+
function TeamMember({role,image,name,team,memberId,member}) {
710
const userData=useSelector(state=>state.auth).user
8-
const dispatch=useDispatch()
9-
11+
const navigate=useNavigate()
1012

1113

1214

1315
return (
1416
<div className='bg-white border-[1px] border-[rgba(237,237,237,1)] w-[141px] min-h-[141px]
1517
center-element element-center rounded-2xl mb-0 flex-col gap-2 relative'>
16-
<img src={image?image:imgProfile} alt={image} />
17-
<p className='text-[13px] font-semibold text-center'>{name}</p>
18+
<img src={member.imageUrl?`${imgLink}/${member.imageUrl}`:noImg} alt={image} className='w-14 h-14 rounded-full'/>
19+
<p className='text-[13px] font-semibold text-center cursor-pointer' onClick={()=>navigate(`/visit/${member.pivot.user_id}`)}>{name}</p>
1820
<p className='text-[10px] text-center'>{role?role:''}</p>
1921
{team.leader_id ==userData.id&&userData.id !=memberId && <DeleteMember memberId={memberId} team={team}/>}
2022
</div>

src/Components/Teams/TeamsDetails/TeamMembers.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function TeamMembers({team}) {
1111
<h6 className="text-lg font-bold pt-5">Team members </h6>
1212
<div className='flex justify-center gap-12 flex-wrap mt-5 items-center '>
1313
{team.members.map((member, index) => (
14-
<TeamMember key={index} team={team} memberId={member.id} name={member.name} role={member.track} />
14+
<TeamMember member={member} key={index} team={team} memberId={member.id} name={member.name} role={member.track} />
1515
))}
1616
</div>
1717
</div>

src/store/posts/postsSlice.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { fetchPosts } from './fetchPosts';
66

77

88

9+
910
const postsSlice = createSlice({
1011
name: 'posts',
1112
initialState: {
@@ -42,21 +43,11 @@ const postsSlice = createSlice({
4243
state.postsCommentsData.push({ postid: postId, commentsData: comments });
4344
}
4445
},
45-
setLike:(state,action)=>{
46-
const {postId,userId}=action.payload;
47-
const post = state.postsCommentsData.find((post) => post.postid === postId);
48-
// if(like){
49-
// =post.likesData.filter(user=>user.user_id === userId)
50-
// }
51-
5246

53-
}
54-
// Define your other reducers here
5547
},
5648
extraReducers: (builder) => {
5749
builder.addCase(fetchPosts.fulfilled, (state, action) => {
5850
state.posts = action.payload.postData;
59-
console.log(action.payload.postData)
6051
});
6152

6253
builder.addCase(fetchLikesForPost.fulfilled, (state, action) => {

0 commit comments

Comments
 (0)