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