diff --git a/package-lock.json b/package-lock.json index 3520f01..6d6a306 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2792,6 +2792,7 @@ "version": "0.344.0", "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.344.0.tgz", "integrity": "sha512-6YyBnn91GB45VuVT96bYCOKElbJzUHqp65vX8cDcu55MQL9T969v4dhGClpljamuI/+KMO9P6w9Acq1CVQGvIQ==", + "license": "ISC", "peerDependencies": { "react": "^16.5.1 || ^17.0.0 || ^18.0.0" } diff --git a/src/components/BadgeIcon.tsx b/src/components/BadgeIcon.tsx new file mode 100644 index 0000000..2b05250 --- /dev/null +++ b/src/components/BadgeIcon.tsx @@ -0,0 +1,73 @@ +import * as React from "react"; + +export type BadgeKey = + | "first-challenge" + | "design-master" + | "code-warrior" + | "community-helper" + | "streak-master" + | "all-rounder"; // optional fallback + +type Props = { kind: BadgeKey; className?: string }; + +export const BadgeIcon: React.FC = ({ kind, className = "h-4 w-4" }) => { + // IMPORTANT: boolean values + proper typing + const common: React.SVGProps = { + className, + viewBox: "0 0 24 24", + "aria-hidden": true, + focusable: false, + fill: "none", + stroke: "currentColor", + strokeWidth: 1.75, + strokeLinecap: "round", + strokeLinejoin: "round", + }; + + switch (kind) { + case "first-challenge": // 🥇 medal + return ( + + + + + ); + case "design-master": // 🎨 palette + return ( + + + + + + + + ); + case "code-warrior": // ⟨/⟩ + return ( + + + + ); + case "community-helper": // 💬 + return ( + + + + + ); + case "streak-master": // 🔥 + return ( + + + + + ); + default: // all-rounder fallback + return ( + + + + + ); + } +}; diff --git a/src/components/Profile/Profile.tsx b/src/components/Profile/Profile.tsx index 36af307..69127d3 100644 --- a/src/components/Profile/Profile.tsx +++ b/src/components/Profile/Profile.tsx @@ -1,6 +1,7 @@ import React from 'react'; import StreakCalendar from "./StreakCalendar"; -import { Award, BookOpen, Star, TrendingUp, Calendar, Target } from 'lucide-react'; +import { BookOpen, Star, TrendingUp, Calendar, Target } from 'lucide-react'; +import { BadgeIcon, type BadgeKey } from "../BadgeIcon"; export const Profile: React.FC = () => { const completedChallenges = [ @@ -40,13 +41,13 @@ export const Profile: React.FC = () => { { label: 'Avg Rating', value: '4.6', icon: Star, color: 'text-yellow-600 bg-yellow-100 dark:text-yellow-400 dark:bg-yellow-900' } ]; - const achievements = [ - { title: 'First Challenge', description: 'Completed your first challenge', earned: true }, - { title: 'Design Master', description: 'Completed 10 design challenges', earned: true }, - { title: 'Code Warrior', description: 'Completed 10 development challenges', earned: true }, - { title: 'Community Helper', description: 'Provided feedback on 25 submissions', earned: false }, - { title: 'Streak Master', description: 'Completed challenges for 7 days straight', earned: false }, - { title: 'All Rounder', description: 'Completed challenges in all domains', earned: false } + const achievements: Array<{ key: BadgeKey; title: string; description: string; earned: boolean }> = [ + { key: 'first-challenge', title: 'First Challenge', description: 'Completed your first challenge', earned: true }, + { key: 'design-master', title: 'Design Master', description: 'Completed 10 design challenges', earned: true }, + { key: 'code-warrior', title: 'Code Warrior', description: 'Completed 10 development challenges', earned: true }, + { key: 'community-helper', title: 'Community Helper', description: 'Provided feedback on 25 submissions', earned: false }, + { key: 'streak-master', title: 'Streak Master', description: 'Completed challenges for 7 days straight', earned: false }, + { key: 'all-rounder', title: 'All Rounder', description: 'Completed challenges in all domains', earned: false }, ]; return ( @@ -149,27 +150,31 @@ export const Profile: React.FC = () => {

250 XP needed for Level 4: Advanced

+ {/* 30-Day Streak */} -
-

- 30-Day Streak -

- -
+
+

30-Day Streak

+ +
{/* Achievements */}

Achievements

{achievements.map((achievement, index) => ( -
-
- +
+ {/* Icon inherits current text color for light/dark */} +
+
+

{achievement.title} @@ -200,8 +205,8 @@ export const Profile: React.FC = () => { {item.completed}

-