2026-01-07 09:31:02 +00:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
|
|
interface XPBarProps {
|
|
|
|
|
currentXP: number;
|
|
|
|
|
nextLevelXP: number;
|
|
|
|
|
level: number;
|
|
|
|
|
size?: 'sm' | 'md' | 'lg';
|
|
|
|
|
showLabels?: boolean;
|
|
|
|
|
className?: string;
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
export const XPBar: React.FC<XPBarProps> = ({
|
|
|
|
|
currentXP,
|
|
|
|
|
nextLevelXP,
|
|
|
|
|
level,
|
|
|
|
|
size = 'md',
|
2026-01-07 09:31:02 +00:00
|
|
|
showLabels = true,
|
2026-01-13 18:47:57 +00:00
|
|
|
className = '',
|
2026-01-07 09:31:02 +00:00
|
|
|
}) => {
|
2026-01-13 18:47:57 +00:00
|
|
|
const percentage = Math.min(
|
|
|
|
|
100,
|
|
|
|
|
Math.max(0, (currentXP / nextLevelXP) * 100),
|
|
|
|
|
);
|
|
|
|
|
|
2026-01-07 09:31:02 +00:00
|
|
|
const heightClasses = {
|
|
|
|
|
sm: 'h-2',
|
|
|
|
|
md: 'h-4',
|
2026-01-13 18:47:57 +00:00
|
|
|
lg: 'h-6',
|
2026-01-07 09:31:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const textClasses = {
|
|
|
|
|
sm: 'text-[10px]',
|
|
|
|
|
md: 'text-xs',
|
2026-01-13 18:47:57 +00:00
|
|
|
lg: 'text-sm',
|
2026-01-07 09:31:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className={`w-full ${className}`}>
|
|
|
|
|
{showLabels && (
|
2026-01-13 18:47:57 +00:00
|
|
|
<div
|
|
|
|
|
className={`flex justify-between items-end mb-1 font-mono font-bold ${textClasses[size]}`}
|
|
|
|
|
>
|
2026-01-07 09:31:02 +00:00
|
|
|
<span className="text-kodo-gold">LVL {level}</span>
|
2026-01-16 00:59:31 +00:00
|
|
|
<span className="text-kodo-content-dim">
|
2026-01-07 09:31:02 +00:00
|
|
|
<span className="text-white">{currentXP}</span> / {nextLevelXP} XP
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2026-01-13 18:47:57 +00:00
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
className={`w-full bg-kodo-void rounded-full overflow-hidden border border-kodo-gold/30 ${heightClasses[size]} relative`}
|
|
|
|
|
>
|
2026-01-07 09:31:02 +00:00
|
|
|
{/* Background Pattern */}
|
|
|
|
|
<div className="absolute inset-0 bg-[url('https://www.transparenttextures.com/patterns/carbon-fibre.png')] opacity-20"></div>
|
2026-01-13 18:47:57 +00:00
|
|
|
|
2026-01-07 09:31:02 +00:00
|
|
|
{/* Progress Fill */}
|
2026-01-13 18:47:57 +00:00
|
|
|
<div
|
2026-01-07 09:31:02 +00:00
|
|
|
className="h-full bg-gradient-to-r from-kodo-gold/80 to-kodo-gold transition-all duration-500 shadow-[0_0_15px_rgba(234,179,8,0.4)] relative"
|
|
|
|
|
style={{ width: `${percentage}%` }}
|
|
|
|
|
>
|
2026-01-13 18:47:57 +00:00
|
|
|
{/* Shimmer Effect */}
|
|
|
|
|
<div className="absolute top-0 left-0 w-full h-full bg-gradient-to-r from-transparent via-white/20 to-transparent -skew-x-12 translate-x-[-100%] animate-shimmer"></div>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-01-13 18:47:57 +00:00
|
|
|
|
2026-01-07 09:31:02 +00:00
|
|
|
{showLabels && size === 'lg' && (
|
2026-01-16 00:59:31 +00:00
|
|
|
<div className="text-right text-[10px] text-kodo-content-dim mt-1 font-mono">
|
2026-01-07 09:31:02 +00:00
|
|
|
{Math.round(nextLevelXP - currentXP)} XP to next level
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|