Update
This commit is contained in:
parent
242c50043d
commit
3fff4545ea
|
@ -4,11 +4,11 @@
|
||||||
// Import statements
|
// Import statements
|
||||||
import { onMount } from 'svelte'
|
import { onMount } from 'svelte'
|
||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
import { addMarkersGroups, groupsMarkersLayer } from '/js/groups.js'
|
import { addMarkersGroups, groupsMarkersLayer, translate } from '/js/groups.js'
|
||||||
import { addMarkersCoops, coopsMarkersLayer } from '/js/coops.js'
|
import { addMarkersCoops, coopsMarkersLayer } from '/js/coops.js'
|
||||||
import { addMarkersCommunes, communesMarkersLayer } from '/js/communes.js'
|
import { addMarkersCommunes, communesMarkersLayer } from '/js/communes.js'
|
||||||
import { addMarkersParties, partiesMarkersLayer } from '/js/parties.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 components
|
||||||
import "/js/components/map-component.js"
|
import "/js/components/map-component.js"
|
||||||
|
@ -18,6 +18,8 @@
|
||||||
let gridWidth
|
let gridWidth
|
||||||
let loaded = writable(0)
|
let loaded = writable(0)
|
||||||
let content = writable({})
|
let content = writable({})
|
||||||
|
let groups
|
||||||
|
let groupsByCountry
|
||||||
|
|
||||||
function changeWidth(locale) {
|
function changeWidth(locale) {
|
||||||
if (locale=="ru") {
|
if (locale=="ru") {
|
||||||
|
@ -28,6 +30,27 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
loadLocaleContent(content,"groups-component",loaded)
|
loadLocaleContent(content,"groups-component",loaded)
|
||||||
loadLocaleContent(content,"communes-component",loaded)
|
loadLocaleContent(content,"communes-component",loaded)
|
||||||
loadLocaleContent(content,"cooperatives-component",loaded)
|
loadLocaleContent(content,"cooperatives-component",loaded)
|
||||||
|
@ -38,7 +61,7 @@
|
||||||
|
|
||||||
function mapCallback(createMap,content,locale) {
|
function mapCallback(createMap,content,locale) {
|
||||||
let map = createMap([22, 0],2)
|
let map = createMap([22, 0],2)
|
||||||
addMarkersGroups(map,content,locale)
|
addMarkersGroups(groups,groupsByCountry,map,content,locale)
|
||||||
addMarkersCommunes(map,content,locale)
|
addMarkersCommunes(map,content,locale)
|
||||||
addMarkersCoops(map,content,locale)
|
addMarkersCoops(map,content,locale)
|
||||||
addMarkersParties(map,content,locale)
|
addMarkersParties(map,content,locale)
|
||||||
|
@ -58,7 +81,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#key $loaded}
|
{#key $loaded}
|
||||||
{#if $loaded==6}
|
{#if $loaded==7}
|
||||||
<div id="container">
|
<div id="container">
|
||||||
<picture>
|
<picture>
|
||||||
<source srcset="/img/crowd.webp">
|
<source srcset="/img/crowd.webp">
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue