diff --git a/src/app/api/matches/route.ts b/src/app/api/matches/route.ts index 849c1247..3326a865 100644 --- a/src/app/api/matches/route.ts +++ b/src/app/api/matches/route.ts @@ -79,7 +79,7 @@ export async function GET(request: NextRequest) { const currentUserData = await User.find( { _id: { $in: Array.from(allUserIds) } }, 'firstName lastName avatar' - ).lean(); + ).lean() as Array<{ _id: any; firstName?: string; lastName?: string; avatar?: string }>; // Create a map for quick lookup const userDataMap = new Map(); diff --git a/src/components/Dashboard/matches/MatchCard.tsx b/src/components/Dashboard/matches/MatchCard.tsx index d04c8100..215fb42d 100644 --- a/src/components/Dashboard/matches/MatchCard.tsx +++ b/src/components/Dashboard/matches/MatchCard.tsx @@ -243,7 +243,7 @@ const MatchCard: React.FC = ({ match, onClick }) => { {(otherUserKycStatus === 'Accepted' || otherUserKycStatus === 'Approved') ? ( ) : ( - + )} diff --git a/src/components/Dashboard/matches/MatchDetailsModal.tsx b/src/components/Dashboard/matches/MatchDetailsModal.tsx index 6355eac3..1b1bbf33 100644 --- a/src/components/Dashboard/matches/MatchDetailsModal.tsx +++ b/src/components/Dashboard/matches/MatchDetailsModal.tsx @@ -431,7 +431,7 @@ const MatchDetailsModal: React.FC = ({ match, currentUse {(otherUserKycStatus === 'Accepted' || otherUserKycStatus === 'Approved') ? ( ) : ( - + )}

Partner Profile

diff --git a/src/components/User/DashboardContent/MatchesContent.tsx b/src/components/User/DashboardContent/MatchesContent.tsx index 8c7a3ea4..3f877587 100644 --- a/src/components/User/DashboardContent/MatchesContent.tsx +++ b/src/components/User/DashboardContent/MatchesContent.tsx @@ -506,15 +506,13 @@ const MatchesPage = () => { {['pending', 'accepted', 'rejected'].map(status => { const statusMatches = matchesToShow.filter(match => match.status === status); if (statusMatches.length === 0) return null; - const statusConfig = { pending: { title: 'Pending Matches', icon: Clock, color: 'text-yellow-600', bg: 'bg-yellow-50', border: 'border-yellow-200' }, accepted: { title: 'Active Matches', icon: CheckCircle, color: 'text-green-600', bg: 'bg-green-50', border: 'border-green-200' }, rejected: { title: 'Declined Matches', icon: XCircle, color: 'text-gray-500', bg: 'bg-gray-50', border: 'border-gray-200' } }[status]; - + if (!statusConfig) return null; const StatusIcon = statusConfig.icon; - return (
diff --git a/src/components/User/DashboardContent/MySkillsContent.tsx b/src/components/User/DashboardContent/MySkillsContent.tsx index 08f08209..9c20cdb0 100644 --- a/src/components/User/DashboardContent/MySkillsContent.tsx +++ b/src/components/User/DashboardContent/MySkillsContent.tsx @@ -93,14 +93,14 @@ const SkillsPage = ({ onNavigateToSkillVerification }: MySkillsContentProps = {} }, [fetchUserData]); // Check if a skill is used in a listing - const isSkillUsedInListing = (skillId: string) => { + const isSkillUsedInListing = React.useCallback((skillId: string) => { return usedSkillIds.includes(skillId); - }; + }, [usedSkillIds]); // Check if a skill is used in active matches - const isSkillUsedInMatches = (skillId: string) => { + const isSkillUsedInMatches = React.useCallback((skillId: string) => { return matchUsedSkills?.usedSkillIds?.includes(skillId) || false; - }; + }, [matchUsedSkills]); // Get match details for a skill const getSkillMatchDetails = (skillTitle: string) => { @@ -187,7 +187,7 @@ const SkillsPage = ({ onNavigateToSkillVerification }: MySkillsContentProps = {} verified: verifiedSkills, unverified: unverifiedSkills }; - }, [skills, usedSkillIds, matchUsedSkills]); + }, [skills, isSkillUsedInListing, isSkillUsedInMatches]); // Get unique categories for filter dropdown const categories = useMemo(() => { @@ -252,7 +252,7 @@ const SkillsPage = ({ onNavigateToSkillVerification }: MySkillsContentProps = {} }); return filtered; - }, [skills, searchTerm, selectedCategory, selectedProficiency, selectedUsageStatus, selectedVerificationStatus, sortBy, usedSkillIds, matchUsedSkills]); + }, [skills, searchTerm, selectedCategory, selectedProficiency, selectedUsageStatus, selectedVerificationStatus, sortBy, isSkillUsedInListing, isSkillUsedInMatches]); // Group filtered skills by category const skillsByCategory = filteredAndSortedSkills.reduce((acc, skill) => { @@ -444,10 +444,10 @@ const SkillsPage = ({ onNavigateToSkillVerification }: MySkillsContentProps = {} {skill.skillTitle} {skill.isVerified ? ( - + ) : (
- +
{new Date(story.publishedAt).toLocaleDateString()}

- {story.rating && ( + {typeof story.rating === 'number' && (
{[...Array(5)].map((_, i) => ( ))} diff --git a/src/services/skillService.ts b/src/services/skillService.ts index 203793bb..b0a52e07 100644 --- a/src/services/skillService.ts +++ b/src/services/skillService.ts @@ -77,6 +77,7 @@ export const getUserSkills = async (): Promise> => { skillTitle: item.skillTitle, proficiencyLevel: item.proficiencyLevel, description: item.description, + isVerified: typeof item.isVerified === 'boolean' ? item.isVerified : false, createdAt: item.createdAt, updatedAt: item.updatedAt })); @@ -128,6 +129,7 @@ export const addUserSkill = async (skillData: NewSkillData): Promise