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[]> = {
15 data.locations.forEach(l => {
16 servicesParsed[l.type].push(`<a href="#" hx-get="/city/${l.type.toLowerCase()}/${l.event_name}/${l.id}" hx-target="#explore">${l.name}</a>`);
20 <section id="explore" class="tab active" style="background-image: url('/assets/img/map/${closestTown}.jpeg')" hx-swap-oob="true">
21 <div class="city-title-wrapper"><div class="city-title">${data.city.name}</div></div>
22 <div class="city-details flex">`;
24 if(servicesParsed.SERVICES.length) {
25 html += `<div><h3>Services</h3>${servicesParsed.SERVICES.join("<br>")}</div>`
27 if(servicesParsed.STORES.length) {
28 html += `<div><h3>Stores</h3>${servicesParsed.STORES.join("<br>")}</div>`
30 if(servicesParsed.EXPLORE.length) {
31 html += `<div><h3>Explore</h3>${servicesParsed.EXPLORE.join("<br>")}</div>`
36 ${data.paths.map(path => {
37 return `<a href="#" hx-post="/travel/${path.ending_city}" hx-target="#explore">${path.ending_city_name}</a>`