2023-07-12 05:42:33 +07:00
|
|
|
<svelte:options tag="communes-component" />
|
2023-06-24 04:39:41 +07:00
|
|
|
|
|
|
|
<script>
|
|
|
|
// Import statements
|
|
|
|
import { onMount } from 'svelte'
|
2023-07-03 03:07:45 +07:00
|
|
|
import { writable } from 'svelte/store';
|
2023-07-13 18:32:49 +07:00
|
|
|
import { communesByCountry, addMarkersCommunes } from '/js/communes.js'
|
2023-07-04 01:27:18 +07:00
|
|
|
import { loadLocaleContent } from "/js/libraries/serverTools.js"
|
2023-06-24 20:44:16 +07:00
|
|
|
|
2023-06-24 04:39:41 +07:00
|
|
|
// Import components
|
2023-06-24 20:44:16 +07:00
|
|
|
import "/js/components/map-component.js"
|
2023-06-24 04:39:41 +07:00
|
|
|
|
|
|
|
// Main code
|
2023-07-13 18:32:49 +07:00
|
|
|
let loaded = writable(0)
|
2023-07-03 03:07:45 +07:00
|
|
|
let content = writable({})
|
2023-06-24 04:39:41 +07:00
|
|
|
|
2023-07-13 18:32:49 +07:00
|
|
|
loadLocaleContent(content,"countries",loaded)
|
2023-07-12 05:42:33 +07:00
|
|
|
let locale = loadLocaleContent(content,"communes-component",loaded)
|
2023-07-03 03:07:45 +07:00
|
|
|
|
2023-07-20 04:15:12 +07:00
|
|
|
function mapCallbackCommunes(createMap,content,locale) {
|
2023-07-10 21:42:33 +07:00
|
|
|
let map = createMap([22, 0],2)
|
2023-07-20 04:15:12 +07:00
|
|
|
addMarkersCommunes(map,content,locale)
|
|
|
|
}
|
|
|
|
|
|
|
|
function getCountry(name) {
|
|
|
|
return locale=="en" ? name : $content[name]
|
|
|
|
}
|
|
|
|
|
|
|
|
function getAddress(group) {
|
|
|
|
return group.location[0].map(x => locale=="en" ? x : $content[x]).join(", ")
|
2023-06-24 20:44:16 +07:00
|
|
|
}
|
2023-06-24 04:39:41 +07:00
|
|
|
|
|
|
|
onMount(() => {
|
|
|
|
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
|
2023-07-13 18:32:49 +07:00
|
|
|
{#key $loaded}
|
|
|
|
{#if $loaded==2}
|
2023-07-03 03:07:45 +07:00
|
|
|
<div id="container">
|
|
|
|
<!--<img src="img/crowd.png" id="crowd" alt="crowd">-->
|
|
|
|
<div id="text-container">
|
2023-07-15 02:27:11 +07:00
|
|
|
<h1>{$content.communes}</h1>
|
2023-07-12 05:42:33 +07:00
|
|
|
<img id="commune-img" src="/img/common/commune.svg" alt="commune">
|
2023-07-16 20:56:28 +07:00
|
|
|
<p class="description">{$content.p1}</p>
|
2023-07-03 03:07:45 +07:00
|
|
|
<h3>{$content.subheading1}</h3>
|
2023-07-12 05:42:33 +07:00
|
|
|
<map-component id="map" callback={(createMap) => mapCallbackCommunes(createMap,$content,locale)}></map-component>
|
2023-07-16 20:56:28 +07:00
|
|
|
<p id="add-prompt">{$content["map-prompt"]}</p>
|
2023-07-13 18:32:49 +07:00
|
|
|
{#each Object.entries(communesByCountry) as [name,communes]}
|
2023-07-20 04:15:12 +07:00
|
|
|
<h4 class="country-name">{getCountry(name)}</h4>
|
2023-07-13 18:32:49 +07:00
|
|
|
<div class="country-block">
|
|
|
|
{#each communes as commune}
|
|
|
|
<div class="location-info">
|
2023-07-20 04:15:12 +07:00
|
|
|
<p><b>{$content.location}: </b>{getAddress(commune)}</p>
|
2023-07-13 18:32:49 +07:00
|
|
|
<p><b>{$content.status}: </b>{$content[commune.status]}</p>
|
|
|
|
<p><b>{$content.members}: </b>{commune.members}</p>
|
|
|
|
<p><b>{$content.contact}: </b><a href={commune.contact[0]} target=;_blank; rel=noreferrer>{$content[commune.contact[1]]}</a></p>
|
|
|
|
</div>
|
|
|
|
{/each}
|
2023-07-03 03:07:45 +07:00
|
|
|
</div>
|
|
|
|
{/each}
|
2023-06-24 20:44:16 +07:00
|
|
|
</div>
|
2023-07-03 03:07:45 +07:00
|
|
|
</div>
|
|
|
|
{/if}
|
|
|
|
{/key}
|
2023-06-24 04:39:41 +07:00
|
|
|
|
|
|
|
<style>
|
|
|
|
@import '/css/common.css';
|
|
|
|
|
2023-07-16 20:56:28 +07:00
|
|
|
.description {
|
|
|
|
margin-bottom: 1rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
#add-prompt {
|
|
|
|
margin-bottom: 2rem;
|
|
|
|
}
|
|
|
|
|
2023-07-12 05:42:33 +07:00
|
|
|
#commune-img {
|
2023-06-25 02:29:07 +07:00
|
|
|
position: absolute;
|
2023-06-28 21:17:51 +07:00
|
|
|
width: 11.5rem;
|
2023-06-25 02:29:07 +07:00
|
|
|
left: 50%;
|
|
|
|
transform: translate(-50%);
|
|
|
|
z-index: 0;
|
|
|
|
opacity: 0.2;
|
|
|
|
}
|
|
|
|
|
|
|
|
#text-container>:nth-child(3) {
|
|
|
|
margin-top: 8rem;
|
|
|
|
}
|
|
|
|
|
2023-07-13 18:32:49 +07:00
|
|
|
.country-name {
|
|
|
|
margin-bottom: 0.5rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.country-block {
|
2023-06-24 20:44:16 +07:00
|
|
|
margin-bottom: 2rem;
|
|
|
|
}
|
|
|
|
|
2023-07-13 18:32:49 +07:00
|
|
|
|
2023-06-24 20:44:16 +07:00
|
|
|
.location-info {
|
|
|
|
position: relative;
|
|
|
|
margin-bottom: 2rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.location-info p {
|
|
|
|
margin-bottom: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
a {
|
|
|
|
color: #DD1C1A;
|
|
|
|
}
|
|
|
|
|
|
|
|
#map {
|
|
|
|
--height: 30rem;
|
|
|
|
--width: 100%;
|
2023-07-16 20:56:28 +07:00
|
|
|
--margin-bottom: 0,5rem;
|
2023-06-24 20:44:16 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
#text-container {
|
|
|
|
max-width: calc(100vw - 4rem);
|
|
|
|
margin: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
h1 {
|
|
|
|
margin-bottom: 1rem;
|
2023-06-28 18:00:41 +07:00
|
|
|
font-size: 2.2rem;
|
2023-06-24 20:44:16 +07:00
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
h3 {
|
2023-07-16 20:56:28 +07:00
|
|
|
margin-top: 1rem;
|
2023-06-24 20:44:16 +07:00
|
|
|
margin-bottom: 1rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
#container {
|
|
|
|
margin: auto;
|
2023-07-03 03:07:45 +07:00
|
|
|
max-width: 800px;
|
2023-06-24 20:44:16 +07:00
|
|
|
margin-top: 1rem;
|
|
|
|
margin-bottom: 4rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
#container p {
|
|
|
|
text-align: justify;
|
|
|
|
}
|
2023-06-24 04:39:41 +07:00
|
|
|
|
|
|
|
</style>
|