1 import { LocationType, Location, Path, City } from "../../shared/map";
3 export async function renderMap(data: { city: City, locations: Location[], paths: Path[]}, closestTown: number): Promise<string> {
6 console.error('oh no.. this got triggered without any city data');
9 const servicesParsed: Record<LocationType, string[]> = {
16 data.locations.forEach(l => {
17 servicesParsed[l.type].push(`<a href="#" hx-get="/city/${l.type.toLowerCase()}/${l.event_name}/${l.id}" hx-target="#explore">${l.name}</a>`);
21 <section id="explore" class="tab active" style="background-image: url('/assets/img/map/${closestTown}.jpeg')" hx-swap-oob="true">
22 <div class="city-title-wrapper"><div class="city-title">${data.city.name}</div></div>
23 <div class="city-details flex">`;
25 if(servicesParsed.SERVICES.length) {
26 html += `<div><h3>Services</h3>${servicesParsed.SERVICES.join("<br>")}</div>`
28 if(servicesParsed.STORES.length) {
29 html += `<div><h3>Stores</h3>${servicesParsed.STORES.join("<br>")}</div>`
31 if(servicesParsed.EXPLORE.length) {
33 <div><h3>Explore</h3>${servicesParsed.EXPLORE.join("<br>")}
34 ${servicesParsed.DUNGEON.length ? `<br>${servicesParsed.DUNGEON.join("<br>")}` : ''}
40 ${data.paths.map(path => {
41 return `<a href="#" hx-post="/travel/${path.ending_city}" hx-target="#explore">${path.ending_city_name}</a>`