import { useState } from "react"; import { useGame } from "../../context/GameContext.js"; import { ResourceBar } from "../ui/ResourceBar.js"; import { AchievementPanel } from "./AchievementPanel.js"; import { AchievementToast } from "./AchievementToast.js"; import { AdventurerPanel } from "./AdventurerPanel.js"; import { BattleModal } from "./BattleModal.js"; import { BossPanel } from "./BossPanel.js"; import { ClickArea } from "./ClickArea.js"; import { EditProfileModal } from "./EditProfileModal.js"; import { EquipmentPanel } from "./EquipmentPanel.js"; import { OfflineModal } from "./OfflineModal.js"; import { PrestigePanel } from "./PrestigePanel.js"; import { QuestPanel } from "./QuestPanel.js"; import { UpgradePanel } from "./UpgradePanel.js"; type Tab = "adventurers" | "upgrades" | "quests" | "bosses" | "equipment" | "achievements" | "prestige"; const TABS: { id: Tab; label: string }[] = [ { id: "adventurers", label: "⚔️ Adventurers" }, { id: "upgrades", label: "🔧 Upgrades" }, { id: "quests", label: "📜 Quests" }, { id: "bosses", label: "👹 Bosses" }, { id: "equipment", label: "🗡️ Equipment" }, { id: "achievements", label: "🏆 Achievements" }, { id: "prestige", label: "⭐ Prestige" }, ]; export const GameLayout = (): React.JSX.Element => { const { state, isLoading, error, battleResult, dismissBattle, lastSavedAt, isSyncing, forceSync } = useGame(); const [activeTab, setActiveTab] = useState("adventurers"); const [editingProfile, setEditingProfile] = useState(false); if (isLoading) { return (

Loading your adventure...

); } if (error) { return (

Error: {error}

); } if (!state) return

Loading...

; const profileUrl = `/profile/${state.player.discordId}`; return (
{ setEditingProfile(true); }} lastSavedAt={lastSavedAt} isSyncing={isSyncing} onForceSync={forceSync} /> {battleResult && ( )} {editingProfile && ( { setEditingProfile(false); }} /> )}
{activeTab === "adventurers" && } {activeTab === "upgrades" && } {activeTab === "quests" && } {activeTab === "bosses" && } {activeTab === "equipment" && } {activeTab === "achievements" && } {activeTab === "prestige" && }
); };