'use client';

import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { Badge } from '@/components/ui/badge';
import type { GameStore } from '@/lib/game/store';
import { AchievementsDisplay } from '@/components/game/AchievementsDisplay';

export interface AchievementsTabProps {
  store: GameStore;
}

export function AchievementsTab({ store }: AchievementsTabProps) {
  const achievements = store.achievements;
  const unlockedCount = achievements.unlocked.length;
  
  return (
    <div className="space-y-4">
      <Card className="bg-gray-900/80 border-gray-700">
        <CardHeader className="pb-2">
          <CardTitle className="text-amber-400 text-sm flex items-center gap-2">
            🏆 Achievements
            <Badge className="ml-auto bg-amber-900/50 text-amber-300">
              {unlockedCount} unlocked
            </Badge>
          </CardTitle>
        </CardHeader>
        <CardContent>
          <AchievementsDisplay
            achievements={achievements}
            gameState={{
              maxFloorReached: store.maxFloorReached,
              totalManaGathered: store.totalManaGathered,
              signedPacts: store.signedPacts,
              totalSpellsCast: store.totalSpellsCast,
              totalDamageDealt: store.totalDamageDealt,
              totalCraftsCompleted: store.totalCraftsCompleted,
            }}
          />
        </CardContent>
      </Card>
    </div>
  );
}
