Update
This commit is contained in:
parent
3fff4545ea
commit
0c7ecef6c1
|
@ -40,8 +40,6 @@
|
|||
}
|
||||
getData("/assets/groups.json",callback)
|
||||
|
||||
|
||||
|
||||
function mapCallbackGroups(createMap,content,locale) {
|
||||
let map = createMap([22, 0],2)
|
||||
addMarkersGroups(groups,groupsByCountry,map,content,locale)
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import { addMarkersCoops, coopsMarkersLayer } from '/js/coops.js'
|
||||
import { addMarkersCommunes, communesMarkersLayer } from '/js/communes.js'
|
||||
import { addMarkersParties, partiesMarkersLayer } from '/js/parties.js'
|
||||
import { loadLocaleContent } from "/js/libraries/serverTools.js"
|
||||
import { loadLocaleContent, getData } from "/js/libraries/serverTools.js"
|
||||
|
||||
// Import components
|
||||
import "/js/components/map-component.js"
|
||||
|
@ -16,6 +16,8 @@
|
|||
// Main code
|
||||
let loaded = writable(0)
|
||||
let content = writable({})
|
||||
let groups
|
||||
let groupsByCountry
|
||||
|
||||
loadLocaleContent(content,"groups-component",loaded)
|
||||
loadLocaleContent(content,"communes-component",loaded)
|
||||
|
@ -24,9 +26,31 @@
|
|||
loadLocaleContent(content,"countries",loaded)
|
||||
let locale = loadLocaleContent(content,"join-us-component",loaded)
|
||||
|
||||
|
||||
let callback = (response) => {
|
||||
groups = JSON.parse(response)
|
||||
groupsByCountry = {}
|
||||
for (let g of groups) {
|
||||
let country = g.country
|
||||
if (g.contact==null) {
|
||||
g.contact = "https://discord.gg/Qk8KUk787z"
|
||||
}
|
||||
if (country in groupsByCountry) {
|
||||
groupsByCountry[country].push(g)
|
||||
}
|
||||
else {
|
||||
groupsByCountry[country] = [g]
|
||||
}
|
||||
}
|
||||
loaded.update((val) => {
|
||||
return val + 1
|
||||
})
|
||||
}
|
||||
getData("/assets/groups.json",callback)
|
||||
|
||||
function mapCallback(createMap,content,locale) {
|
||||
let map = createMap([22, 0],2)
|
||||
addMarkersGroups(map,content,locale)
|
||||
addMarkersGroups(groups,groupsByCountry,map,content,locale)
|
||||
addMarkersCommunes(map,content,locale)
|
||||
addMarkersCoops(map,content,locale)
|
||||
addMarkersParties(map,content,locale)
|
||||
|
@ -46,7 +70,7 @@
|
|||
</script>
|
||||
|
||||
{#key $loaded}
|
||||
{#if $loaded==6}
|
||||
{#if $loaded==7}
|
||||
<div id="container">
|
||||
<div id="text-container">
|
||||
<h1>{$content.heading}</h1>
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue