1 import { TravelDTO } from "../../shared/map";
3 export function travelButton(blockTime: number): string {
4 return `<button id="keep-walking" hx-post="/travel/step" class="${blockTime ? 'disabled': ''}" data-block="${blockTime}" ${blockTime ? 'disabled': ''}>Keep Walking</button>`;
7 export function renderTravel(data: TravelDTO): string {
9 let promptText = data.walkingText;
10 const blockTime = data.nextAction || 0;
18 let html = `<section id="explore" class="tab active" hx-swap-oob="true" style="background-image: url('/assets/img/map/${data.closestTown}.jpeg')">
20 <div id="travelling" class="city-details">`;
21 html += '<div id="travelling-actions">';
22 html += travelButton(blockTime);
23 if(data.things.length) {
24 // ok you found something, for now we only support
25 // monsters, but eventually that will change
26 promptText = `You see a ${data.things[0].name}`;
27 html += `<form hx-post="/fight" hx-target="#explore">
28 <input type="hidden" name="monsterId" value="${data.things[0].id}">
29 <button type="submit" class="red">Fight</button>
33 // end #travelling-actions
35 html += `<p>${promptText}</p>`;
37 html += '</div></section>';