@@ -21,8 +21,13 @@ interface ProfileProps {
21
21
interface Project {
22
22
description : string ;
23
23
repoLink : string ;
24
- tags : string ;
24
+ tags : string [ ] ;
25
25
title : string ;
26
+ repo ?: string ;
27
+ link ?: string ;
28
+ language ?: string ;
29
+ stars ?: number ;
30
+ forks ?: number ;
26
31
}
27
32
28
33
interface UserResponse {
@@ -50,28 +55,28 @@ interface Language {
50
55
percentage : string ;
51
56
}
52
57
53
- interface LeetCodeData {
54
- totalSolved : number ;
55
- totalSubmissions : number ;
56
- totalQuestions : number ;
57
- easySolved : number ;
58
- totalEasy : number ;
59
- mediumSolved : number ;
60
- totalMedium : number ;
61
- hardSolved : number ;
62
- totalHard : number ;
63
- ranking : number ;
64
- contributionPoint : number ;
65
- reputation : number ;
66
- submissionCalendar : string ;
67
- recentSubmissions : {
68
- title : string ;
69
- titleSlug : string ;
70
- timestamp : string ;
71
- statusDisplay : string ;
72
- lang : string ;
73
- } [ ] ;
74
- }
58
+ // interface LeetCodeData {
59
+ // totalSolved: number;
60
+ // totalSubmissions: number;
61
+ // totalQuestions: number;
62
+ // easySolved: number;
63
+ // totalEasy: number;
64
+ // mediumSolved: number;
65
+ // totalMedium: number;
66
+ // hardSolved: number;
67
+ // totalHard: number;
68
+ // ranking: number;
69
+ // contributionPoint: number;
70
+ // reputation: number;
71
+ // submissionCalendar: string;
72
+ // recentSubmissions: {
73
+ // title: string;
74
+ // titleSlug: string;
75
+ // timestamp: string;
76
+ // statusDisplay: string;
77
+ // lang: string;
78
+ // }[];
79
+ // }
75
80
76
81
const Profile : React . FC < ProfileProps > = ( { onLogout, username } ) => {
77
82
return (
@@ -94,16 +99,15 @@ const Dashboard: React.FC<DashboardProps> = ({ loggedInUsername }) => {
94
99
const { username } = useParams < { username : string } > ( ) ;
95
100
const dispatch = useDispatch < AppDispatch > ( ) ;
96
101
const friends = useSelector ( ( state : RootState ) => state . user . friends ) ;
97
- const friendStatus = useSelector (
98
- ( state : RootState ) => state . user . friendStatus
99
- ) ;
102
+ // const friendStatus = useSelector(
103
+ // (state: RootState) => state.user.friendStatus
104
+ // );
100
105
const [ profileData , setProfileData ] = useState < UserResponse > ( ) ;
101
106
const [ editing , setEditing ] = useState ( false ) ;
102
107
const [ githubData , setGithubData ] = useState < GitHubData | null > ( null ) ;
103
108
const [ languages , setLanguages ] = useState < Language [ ] > ( [ ] ) ;
104
109
const [ streakStats , setStreakStats ] = useState < string | null > ( null ) ;
105
110
const [ pinnedRepos , setPinnedRepos ] = useState < Project [ ] > ( [ ] ) ;
106
- const [ leetcodeData , setLeetcodeData ] = useState < LeetCodeData | null > ( null ) ;
107
111
const [ leetcodeSvg , setLeetcodeSvg ] = useState ( null ) ;
108
112
const [ githubStreakSvg , setGithubStreakSvg ] = useState ( null ) ;
109
113
@@ -248,13 +252,13 @@ const Dashboard: React.FC<DashboardProps> = ({ loggedInUsername }) => {
248
252
data : { friend_username : loggedInUsername } ,
249
253
} ) ;
250
254
setProfileData ( ( prev ) => ( prev ? { ...prev , isFriend : false } : prev ) ) ;
251
- dispatch ( setFriendStatus ( false ) ) ; // Update Redux state
255
+ dispatch ( setFriendStatus ( { username : loggedInUsername , isFriend : false } ) ) ; // Updated to pass an object
252
256
} else {
253
257
await axios . post ( `${ backendUrl } /profile/${ username } /friends` , {
254
258
friend_username : loggedInUsername ,
255
259
} ) ;
256
260
setProfileData ( ( prev ) => ( prev ? { ...prev , isFriend : true } : prev ) ) ;
257
- dispatch ( setFriendStatus ( true ) ) ; // Update Redux state
261
+ dispatch ( setFriendStatus ( { username : loggedInUsername , isFriend : true } ) ) ; // Updated to pass an object
258
262
}
259
263
} catch ( error ) {
260
264
console . error ( "Failed to update friend status:" , error ) ;
0 commit comments