feature/7-progress-bar #13

Merged
myrmidex merged 1 commit from refs/pull/13/head into releases/v0.1 2025-07-13 00:31:32 +02:00
2 changed files with 44 additions and 6 deletions
Showing only changes of commit 31c62b23e1 - Show all commits

View file

@ -1,28 +1,64 @@
import { cn } from '@/lib/utils'; import { cn } from '@/lib/utils';
interface Milestone {
target: number;
description: string;
created_at: string;
}
interface ProgressBarProps { interface ProgressBarProps {
currentShares: number;
milestones: Milestone[];
className?: string; className?: string;
onClick?: () => void; onClick?: () => void;
} }
export default function ProgressBar({ export default function ProgressBar({
currentShares,
milestones,
className, className,
onClick onClick
}: ProgressBarProps) { }: ProgressBarProps) {
// Get the first milestone (lowest target) for progress calculation
const firstMilestone = milestones.length > 0 ? milestones[0] : null;
// Calculate progress percentage
const progressPercentage = firstMilestone
? Math.min((currentShares / firstMilestone.target) * 100, 100)
: 0;
return ( return (
<div <div
className={cn( className={cn(
"bg-black border-4 border-gray-800 rounded-lg", "bg-black cursor-pointer",
"shadow-2xl shadow-red-500/20 cursor-pointer",
"transition-all duration-300", "transition-all duration-300",
"hover:shadow-red-500/40 hover:border-red-600", "p-8",
"p-8 text-center",
className className
)} )}
onClick={onClick} onClick={onClick}
> >
<div className="text-red-500 text-2xl font-mono tracking-wide"> {/* Progress Bar Container */}
PROGRESS BAR <div className="w-full">
{/* Old-school progress bar with overlaid text */}
<div className="w-full border-4 border-red-500 p-2 bg-black relative overflow-hidden">
{/* Inner container */}
<div className="relative h-8">
{/* Progress fill */}
<div
className="absolute top-0 left-0 h-full bg-red-500 transition-all duration-500 ease-out"
style={{ width: `${progressPercentage}%` }}
/>
{/* Text overlay */}
{firstMilestone && (
<div className="relative h-full flex items-center justify-center">
{/* Base text (red on black background) */}
<div className="text-red-500 font-mono text-sm font-bold mix-blend-difference relative z-10">
{progressPercentage.toFixed(1)}%
</div>
</div>
)}
</div>
</div>
</div> </div>
</div> </div>
); );

View file

@ -167,6 +167,8 @@ export default function Dashboard() {
{/* Box 2: Progress Bar (toggleable) */} {/* Box 2: Progress Bar (toggleable) */}
<div className="mt-4" style={{ display: showProgressBar ? 'block' : 'none' }}> <div className="mt-4" style={{ display: showProgressBar ? 'block' : 'none' }}>
<ProgressBar <ProgressBar
currentShares={purchaseData.total_shares}
milestones={milestones}
onClick={handleProgressClick} onClick={handleProgressClick}
/> />
</div> </div>