Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/api/matches/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dashboard/matches/MatchCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ const MatchCard: React.FC<MatchCardProps> = ({ match, onClick }) => {
{(otherUserKycStatus === 'Accepted' || otherUserKycStatus === 'Approved') ? (
<BadgeCheck className="w-4 h-4 ml-1 text-blue-500 flex-shrink-0" />
) : (
<AlertCircle className="w-4 h-4 ml-1 text-orange-500 flex-shrink-0" title="Not Verified" />
<AlertCircle className="w-4 h-4 ml-1 text-orange-500 flex-shrink-0" aria-label="Not Verified" />
)}
</h3>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dashboard/matches/MatchDetailsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ const MatchDetailsModal: React.FC<MatchDetailsModalProps> = ({ match, currentUse
{(otherUserKycStatus === 'Accepted' || otherUserKycStatus === 'Approved') ? (
<BadgeCheck className="w-4 h-4 ml-1 text-blue-500" />
) : (
<AlertCircle className="w-4 h-4 ml-1 text-orange-500" title="Not Verified" />
<AlertCircle className="w-4 h-4 ml-1 text-orange-500" aria-label="Not Verified" />
)}
</h3>
<p className="text-xs text-gray-600">Partner Profile</p>
Expand Down
4 changes: 1 addition & 3 deletions src/components/User/DashboardContent/MatchesContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div key={status} className={`rounded-lg border ${statusConfig.border} ${statusConfig.bg} p-4`}>
<div className="flex items-center mb-4">
Expand Down
20 changes: 10 additions & 10 deletions src/components/User/DashboardContent/MySkillsContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -444,10 +444,10 @@ const SkillsPage = ({ onNavigateToSkillVerification }: MySkillsContentProps = {}
{skill.skillTitle}
</h3>
{skill.isVerified ? (
<BadgeCheck className="w-5 h-5 text-green-500 flex-shrink-0" title="Verified Skill" />
<BadgeCheck className="w-5 h-5 text-green-500 flex-shrink-0" aria-label="Verified Skill" />
) : (
<div className="flex items-center gap-1">
<AlertCircle className="w-5 h-5 text-orange-400 flex-shrink-0" title="Skill Not Verified" />
<AlertCircle className="w-5 h-5 text-orange-400 flex-shrink-0" aria-label="Skill Not Verified" />
<button
onClick={navigateToSkillVerification}
className="w-4 h-4 text-blue-500 hover:text-blue-700 flex-shrink-0"
Expand Down Expand Up @@ -937,9 +937,9 @@ const SkillsPage = ({ onNavigateToSkillVerification }: MySkillsContentProps = {}
<div className="flex items-center gap-2">
<h3 className="text-xl font-semibold text-blue-700">{viewingSkill.skillTitle}</h3>
{viewingSkill.isVerified ? (
<BadgeCheck className="w-6 h-6 text-green-500" title="Verified Skill" />
<BadgeCheck className="w-6 h-6 text-green-500" aria-label="Verified Skill" />
) : (
<AlertCircle className="w-6 h-6 text-orange-400" title="Skill Not Verified" />
<AlertCircle className="w-6 h-6 text-orange-400" aria-label="Skill Not Verified" />
)}
</div>
<span className={`px-3 py-1 text-sm rounded-full font-medium ${
Expand Down
4 changes: 2 additions & 2 deletions src/components/homepage/SuccessStoriesCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,13 @@ export default function SuccessStoriesCarousel() {
<p className="text-xs text-blue-200">
{new Date(story.publishedAt).toLocaleDateString()}
</p>
{story.rating && (
{typeof story.rating === 'number' && (
<div className="flex items-center mt-1">
{[...Array(5)].map((_, i) => (
<Star
key={i}
className={`w-3 h-3 ${
i < story.rating ? 'text-yellow-300 fill-current' : 'text-gray-400'
i < (story.rating ?? 0) ? 'text-yellow-300 fill-current' : 'text-gray-400'
}`}
/>
))}
Expand Down
3 changes: 3 additions & 0 deletions src/services/skillService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export const getUserSkills = async (): Promise<ApiResponse<UserSkill[]>> => {
skillTitle: item.skillTitle,
proficiencyLevel: item.proficiencyLevel,
description: item.description,
isVerified: typeof item.isVerified === 'boolean' ? item.isVerified : false,
createdAt: item.createdAt,
updatedAt: item.updatedAt
}));
Expand Down Expand Up @@ -128,6 +129,7 @@ export const addUserSkill = async (skillData: NewSkillData): Promise<ApiResponse
skillTitle: item.skillTitle,
proficiencyLevel: item.proficiencyLevel,
description: item.description,
isVerified: typeof item.isVerified === 'boolean' ? item.isVerified : false,
createdAt: item.createdAt,
updatedAt: item.updatedAt
}
Expand Down Expand Up @@ -188,6 +190,7 @@ export const updateUserSkill = async (
skillTitle: item.skillTitle,
proficiencyLevel: item.proficiencyLevel,
description: item.description,
isVerified: typeof item.isVerified === 'boolean' ? item.isVerified : false,
createdAt: item.createdAt,
updatedAt: item.updatedAt
}
Expand Down
Loading