1 import { Monster, MonsterForFight } from "../../shared/monsters";
3 export function renderMonsterSelector(monsters: Monster[] | MonsterForFight[], activeMonsterId: number = 0): string {
4 let html = `<form id="fight-selector" hx-post="/fight" hx-target="#explore">
5 <input type="hidden" name="fightTrigger" value="explore">
6 <select id="monsterId" name="monsterId">
7 ${monsters.map((monster) => {
8 return `<option value="${monster.id}" ${monster.id === activeMonsterId ? 'selected': ''}>${monster.name}</option>`;
10 </select> <button type="submit">Fight</button></form>`;