2026-01-07 09:31:02 +00:00
|
|
|
import React from 'react';
|
|
|
|
|
import { Card } from '../ui/card';
|
|
|
|
|
import { Achievement } from '../../types';
|
|
|
|
|
import { Lock, CheckCircle } from 'lucide-react';
|
|
|
|
|
|
|
|
|
|
interface AchievementCardProps {
|
|
|
|
|
achievement: Achievement;
|
|
|
|
|
compact?: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
export const AchievementCard: React.FC<AchievementCardProps> = ({
|
|
|
|
|
achievement,
|
|
|
|
|
compact = false,
|
|
|
|
|
}) => {
|
2026-01-07 09:31:02 +00:00
|
|
|
const isUnlocked = achievement.progress >= achievement.maxProgress;
|
2026-01-13 18:47:57 +00:00
|
|
|
const percentage = Math.min(
|
|
|
|
|
100,
|
|
|
|
|
(achievement.progress / achievement.maxProgress) * 100,
|
|
|
|
|
);
|
2026-01-07 09:31:02 +00:00
|
|
|
|
|
|
|
|
return (
|
2026-01-13 18:47:57 +00:00
|
|
|
<Card
|
|
|
|
|
variant={isUnlocked ? 'gaming' : 'default'}
|
|
|
|
|
className={`relative overflow-hidden transition-all group ${isUnlocked ? 'border-kodo-gold/30 bg-kodo-gold/5' : 'opacity-80 grayscale hover:grayscale-0 hover:opacity-100'}`}
|
2026-01-07 09:31:02 +00:00
|
|
|
>
|
2026-01-13 18:47:57 +00:00
|
|
|
{isUnlocked && (
|
|
|
|
|
<div className="absolute top-2 right-2 text-kodo-gold animate-pulse">
|
|
|
|
|
<CheckCircle className="w-5 h-5" />
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
{!isUnlocked && (
|
2026-01-16 00:59:31 +00:00
|
|
|
<div className="absolute top-2 right-2 text-kodo-content-dim">
|
2026-01-13 18:47:57 +00:00
|
|
|
<Lock className="w-4 h-4" />
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
className={`flex ${compact ? 'flex-row items-center gap-4' : 'flex-col items-center text-center gap-3'}`}
|
|
|
|
|
>
|
|
|
|
|
<div
|
2026-01-16 00:59:31 +00:00
|
|
|
className={`rounded-full bg-gradient-to-br from-kodo-graphite to-black flex items-center justify-center border-2 ${isUnlocked ? 'border-kodo-gold w-16 h-16 text-3xl shadow-[0_0_15px_rgba(234,179,8,0.3)]' : 'border-kodo-steel w-12 h-12 text-xl text-kodo-content-dim'}`}
|
2026-01-13 18:47:57 +00:00
|
|
|
>
|
|
|
|
|
{achievement.icon}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="flex-1 min-w-0">
|
|
|
|
|
<h4
|
2026-01-16 00:59:31 +00:00
|
|
|
className={`font-bold truncate ${isUnlocked ? 'text-white' : 'text-kodo-content-dim'}`}
|
2026-01-13 18:47:57 +00:00
|
|
|
>
|
|
|
|
|
{achievement.name}
|
|
|
|
|
</h4>
|
2026-01-16 00:59:31 +00:00
|
|
|
<p className="text-xs text-kodo-content-dim line-clamp-2 mb-2">
|
2026-01-13 18:47:57 +00:00
|
|
|
{achievement.description}
|
|
|
|
|
</p>
|
2026-01-07 09:31:02 +00:00
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
{/* Progress */}
|
2026-01-16 00:59:31 +00:00
|
|
|
<div className="w-full bg-kodo-graphite h-1.5 rounded-full overflow-hidden">
|
2026-01-13 18:47:57 +00:00
|
|
|
<div
|
2026-01-16 00:59:31 +00:00
|
|
|
className={`h-full transition-all duration-500 ${isUnlocked ? 'bg-kodo-gold' : 'bg-kodo-steel'}`}
|
2026-01-13 18:47:57 +00:00
|
|
|
style={{ width: `${percentage}%` }}
|
|
|
|
|
></div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="flex justify-between text-[10px] mt-1 font-mono">
|
2026-01-16 00:59:31 +00:00
|
|
|
<span className={isUnlocked ? 'text-kodo-gold' : 'text-kodo-content-dim'}>
|
2026-01-13 18:47:57 +00:00
|
|
|
{achievement.progress} / {achievement.maxProgress}
|
|
|
|
|
</span>
|
|
|
|
|
<span className="text-kodo-cyan">+{achievement.xpReward} XP</span>
|
|
|
|
|
</div>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
2026-01-13 18:47:57 +00:00
|
|
|
</div>
|
2026-01-07 09:31:02 +00:00
|
|
|
</Card>
|
|
|
|
|
);
|
|
|
|
|
};
|