import { Converter } from "showdown"; import l from "./locales"; let converter = new Converter(); export function countryPopup(country, properties) { return `
${img(country.img)} ${title(country.name)} ${tags(properties.tags)}
${l("founded")}: ${new Date(country.date).toLocaleDateString()}
${ country.description ? `
${converter.makeHtml(country.description)}
` : "" }
${l("area")}: ${properties.area} ${l("km")}²
${ country.about ? `${l("about")}` : "" }
`; } function tags(tags) { let tagstxt = JSON.parse(tags || "[]").join(", "); return tagstxt ? `
${tagstxt}
` : ""; } function img(url) { return `
`; } function title(name) { return `
${name}
`; } export function markerPopup(properties) { return ` ${ properties?.amount ? `
${l( "population" )} - ${properties.amount} ${l("people")}.
` : "" }
${properties?.img ? img(properties.img) : ""} ${title( `${properties.name} ${ properties.translated_name ? `- ${properties.translated_name}` : "" }` )} ${ properties.description ? `
${converter.makeHtml( properties.description )}
` : "" }
`; }