import { Badge } from "@repo/ui";

import { Award } from "lucide-react";
import { getServerSession } from "../../api/auth/[...nextauth]/auth";

export const Badges = async () => {
	const session = await getServerSession();
	if (!session) return null;

	return (
		<div className="card bg-base-200 shadow-xl mb-4 col-span-6 xl:col-span-3">
			<div className="card-body">
				<h2 className="card-title justify-between">
					<span className="card-title">
						<Award className="w-4 h-4" /> Verdiente Abzeichen
					</span>
				</h2>
				{session.user.badges.map((badge) => {
					return (
						<div className="badge badge-primary badge-outline">
							<Badge name={badge} />
						</div>
					);
				})}
			</div>
		</div>
	);
};
