"use client";
// 回响星核 / Echo Nexus — 成就系统面板
import { useGameStore } from "@/store/gameStore";
import { ACHIEVEMENTS } from "@/lib/game/achievements";
import { achievementBonuses } from "@/lib/game/achievements";
import { Trophy, Lock } from "lucide-react";
export function AchievementsPanel() {
const achievements = useGameStore((s) => s.achievements);
const unlockedCount = Object.values(achievements).filter(Boolean).length;
const bonus = achievementBonuses(achievements);
return (
{/* 顶部:进度 + 加成总览 */}
成就
{unlockedCount} / {ACHIEVEMENTS.length}
{/* 永久加成条 */}
永久加成
{bonus.crystalsPerSecPct > 0 && (
产能 +{bonus.crystalsPerSecPct}%
)}
{bonus.insightPct > 0 && (
洞见 +{bonus.insightPct}%
)}
{bonus.crystalsPerSecPct === 0 && bonus.insightPct === 0 && (
暂无(达成成就解锁)
)}
{/* 成就网格 — 移除固定 max-h,用 flex-1 min-h-0 自适应父容器,避免小屏挤压重叠 */}
{ACHIEVEMENTS.map((a) => {
const unlocked = !!achievements[a.id];
return (
{unlocked && (
)}
{/* 图标徽章 */}
{unlocked ? a.icon : }
{/* 文本 */}
{a.name}
{a.desc}
{unlocked && (
✦ {a.rewardText}
)}
);
})}
);
}