import NavigationWrapper from "@/components/navigation/NavigationWrapper";
import LeaderboardSection from "@/components/leaderboard/LeaderboardSection";
import { userStatsService } from "@/services/users/user-stats.service";
import { getBackgroundImage } from "@/lib/preferences";

export const dynamic = "force-dynamic";

export default async function LeaderboardPage() {
  // Paralléliser les appels DB
  const [leaderboard, houseLeaderboard, backgroundImage] = await Promise.all([
    userStatsService.getLeaderboard(10),
    userStatsService.getHouseLeaderboard(10),
    getBackgroundImage("leaderboard", "/leaderboard-bg.jpg"),
  ]);

  return (
    <main className="min-h-screen bg-black relative">
      <NavigationWrapper />
      <LeaderboardSection
        leaderboard={leaderboard}
        houseLeaderboard={houseLeaderboard}
        backgroundImage={backgroundImage}
      />
    </main>
  );
}
