import { lazy, Suspense, useEffect, useState } from "react"; import { classById } from "../app/characterCatalog"; import { beginMainMenuCharacterEditing } from "../app/mainMenuCharacterEditing"; import { selectedCharacter, useShellStore } from "../app/shellStore"; import { DualDisplayFrame } from "../components/DualDisplayFrame"; import { AbilityBindingsPanel } from "./AbilityBindingsPanel"; import { BrandMark, FrontSurface } from "./FrontSurface"; import { KeybindsPanel } from "./KeybindsPanel"; import { RomSkillsPanel } from "./RomSkillsPanel"; import { loadTalentGameplayPanel } from "./talentGameplayResources"; import "./mainMenuCharacterEditor.css"; const TalentGameplayPanel = lazy(loadTalentGameplayPanel); export type MainMenuEditor = "talents" | "keybinds" | "bindings"; export function MainMenuCharacterEditor({ editor, onClose }: { editor: MainMenuEditor; onClose: () => void; }) { const character = useShellStore(selectedCharacter); const ownerId = useShellStore((state) => state.session?.ownerId); const notice = useShellStore((state) => state.notice); const characterKey = `${ownerId ?? ""}:${character?.id ?? ""}`; const [readyKey, setReadyKey] = useState(null); useEffect(() => { const stop = beginMainMenuCharacterEditing(); setReadyKey(stop ? characterKey : null); return () => stop?.(); }, [characterKey]); const ready = readyKey === characterKey; return
{character?.name ?? "Character setup"} {character ? `Level ${character.level} ${classById(character.classId).name}` : "Select a character to edit."}
{notice &&

{notice}

}
{!ready ?

Preparing character…

: Opening talents…

}> {editor === "talents" && (character?.categoryId === "rom" ? : )} {editor === "keybinds" && } {editor === "bindings" && }
}
} />; }