From 19a1b8d08078cf9814afe7be22482756ee695b3d Mon Sep 17 00:00:00 2001 From: a-ill Date: Sat, 22 Jul 2023 13:27:43 +0300 Subject: [PATCH] Update --- .../app/svelte/src/landing-component.svelte | 31 ++++++++++++++++--- .../public/js/components/landing-component.js | 2 +- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/Server/app/svelte/src/landing-component.svelte b/Server/app/svelte/src/landing-component.svelte index 94c37a0..4f0b855 100644 --- a/Server/app/svelte/src/landing-component.svelte +++ b/Server/app/svelte/src/landing-component.svelte @@ -4,11 +4,11 @@ // Import statements import { onMount } from 'svelte' 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 { 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" @@ -18,6 +18,8 @@ let gridWidth let loaded = writable(0) let content = writable({}) + let groups + let groupsByCountry function changeWidth(locale) { 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,"communes-component",loaded) loadLocaleContent(content,"cooperatives-component",loaded) @@ -38,7 +61,7 @@ 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) @@ -58,7 +81,7 @@ {#key $loaded} - {#if $loaded==6} + {#if $loaded==7}
diff --git a/Server/public/js/components/landing-component.js b/Server/public/js/components/landing-component.js index 4873f60..01fc18b 100644 --- a/Server/public/js/components/landing-component.js +++ b/Server/public/js/components/landing-component.js @@ -1 +1 @@ -import{S as t,i,a as o,b as e,s as r,e as n,n as s,d as m,c as a,o as c,w as p,f as g,g as d,t as l,h as u,j as h,v as f,k as v,l as w,m as x}from"./index-4348483d.js";import{w as b}from"./index-71440b21.js";import{addMarkersGroups as j,groupsMarkersLayer as T}from"../../../../../../../../../js/groups.js";import{addMarkersCoops as k,coopsMarkersLayer as y}from"../../../../../../../../../js/coops.js";import{addMarkersCommunes as U,communesMarkersLayer as z}from"../../../../../../../../../js/communes.js";import{addMarkersParties as N,partiesMarkersLayer as C}from"../../../../../../../../../js/parties.js";import{loadLocaleContent as A}from"../../../../../../../../../js/libraries/serverTools.js";import"../../../../../../../../../js/components/map-component.js";function E(t){let i,o,r,n,s,a,c,p,b,j,T,k,y,U,z,N,C,L,A,E,F,H,M,R,W,B,D,K,Q,S,_,q,G,I,J,O,P,V,X,Y,Z,$,tt,it,ot,et,rt,nt,st,mt,at,ct,pt,gt,dt,lt,ut,ht,ft,vt,wt,xt,bt,jt,Tt,kt,yt,Ut=t[3].top+"",zt=t[3].groupsTitle+"",Nt=t[3].groupsText+"",Ct=t[3].communesTitle+"",Lt=t[3].communesText+"",At=t[3].cooperativesTitle+"",Et=t[3].cooperativesText+"",Ft=t[3].partiesTitle+"",Ht=t[3].partiesText+"",Mt=t[3].findUs+"",Rt=t[3].whatNow+"",Wt=t[3].joinUs+"",Bt=t[3].talkWithUs+"";return{c(){i=g("div"),o=g("picture"),o.innerHTML=' \n \n crowd',r=d(),n=g("div"),s=g("p"),a=l(Ut),c=d(),p=g("div"),b=g("div"),j=g("a"),T=g("h2"),k=l(zt),y=d(),U=g("img"),N=d(),C=g("p"),L=l(Nt),A=d(),E=g("div"),F=g("a"),H=g("h2"),M=l(Ct),R=d(),W=g("img"),D=d(),K=g("p"),Q=l(Lt),S=d(),_=g("div"),q=g("a"),G=g("h2"),I=l(At),J=d(),O=g("img"),V=d(),X=g("p"),Y=l(Et),Z=d(),$=g("div"),tt=g("a"),it=g("h2"),ot=l(Ft),et=d(),rt=g("img"),st=d(),mt=g("p"),at=l(Ht),ct=d(),pt=g("h1"),gt=l(Mt),dt=d(),lt=g("map-component"),ht=d(),ft=g("h1"),vt=l(Rt),wt=d(),xt=g("div"),bt=g("a"),jt=l(Wt),Tt=d(),kt=g("a"),yt=l(Bt),u(j,"href","/"+t[6]+"/groups"),u(U,"id","groups-img"),h(U.src,z="/img/common/groups.svg")||u(U,"src","/img/common/groups.svg"),u(U,"alt","groups"),u(F,"href","/"+t[6]+"/communes"),u(W,"id","communes-img"),h(W.src,B="/img/common/commune.svg")||u(W,"src","/img/common/commune.svg"),u(W,"alt","communes"),u(q,"href","/"+t[6]+"/coops"),u(O,"id","coops-img"),h(O.src,P="/img/common/coops.svg")||u(O,"src","/img/common/coops.svg"),u(O,"alt","coops"),u(tt,"href","/"+t[6]+"/parties"),u(rt,"id","parties-img"),h(rt.src,nt="/img/common/parties.svg")||u(rt,"src","/img/common/parties.svg"),u(rt,"alt","coops"),u(p,"id","container-grid"),f(p,"--grid-width",t[1]),u(pt,"id","find-us"),v(lt,"id","map"),v(lt,"callback",ut=t[9]),v(lt,"colors",["#23AC20","#CA2437","#217BC9","#FFD326"]),u(bt,"class","link-button"),u(bt,"href","/"+t[6]+"/join-us"),u(kt,"class","link-button"),u(kt,"href","https://discord.gg/Qk8KUk787z"),u(kt,"target","_blank"),u(kt,"rel","noreferrer"),u(xt,"id","action-container"),u(n,"id","text-container"),u(i,"id","container")},m(m,g){e(m,i,g),w(i,o),w(i,r),w(i,n),w(n,s),w(s,a),w(n,c),w(n,p),w(p,b),w(b,j),w(j,T),w(T,k),w(b,y),w(b,U),w(b,N),w(b,C),w(C,L),w(p,A),w(p,E),w(E,F),w(F,H),w(H,M),w(E,R),w(E,W),w(E,D),w(E,K),w(K,Q),w(p,S),w(p,_),w(_,q),w(q,G),w(G,I),w(_,J),w(_,O),w(_,V),w(_,X),w(X,Y),w(p,Z),w(p,$),w($,tt),w(tt,it),w(it,ot),w($,et),w($,rt),w($,st),w($,mt),w(mt,at),t[8](p),w(n,ct),w(n,pt),w(pt,gt),w(n,dt),w(n,lt),w(n,ht),w(n,ft),w(ft,vt),w(n,wt),w(n,xt),w(xt,bt),w(bt,jt),w(xt,Tt),w(xt,kt),w(kt,yt)},p(t,i){8&i&&Ut!==(Ut=t[3].top+"")&&x(a,Ut),8&i&&zt!==(zt=t[3].groupsTitle+"")&&x(k,zt),8&i&&Nt!==(Nt=t[3].groupsText+"")&&x(L,Nt),8&i&&Ct!==(Ct=t[3].communesTitle+"")&&x(M,Ct),8&i&&Lt!==(Lt=t[3].communesText+"")&&x(Q,Lt),8&i&&At!==(At=t[3].cooperativesTitle+"")&&x(I,At),8&i&&Et!==(Et=t[3].cooperativesText+"")&&x(Y,Et),8&i&&Ft!==(Ft=t[3].partiesTitle+"")&&x(ot,Ft),8&i&&Ht!==(Ht=t[3].partiesText+"")&&x(at,Ht),2&i&&f(p,"--grid-width",t[1]),8&i&&Mt!==(Mt=t[3].findUs+"")&&x(gt,Mt),8&i&&ut!==(ut=t[9])&&v(lt,"callback",ut),8&i&&Rt!==(Rt=t[3].whatNow+"")&&x(vt,Rt),8&i&&Wt!==(Wt=t[3].joinUs+"")&&x(jt,Wt),8&i&&Bt!==(Bt=t[3].talkWithUs+"")&&x(yt,Bt)},d(o){o&&m(i),t[8](null)}}}function F(t){let i,o=6==t[2]&&E(t);return{c(){o&&o.c(),i=n()},m(t,r){o&&o.m(t,r),e(t,i,r)},p(t,e){6==t[2]?o?o.p(t,e):(o=E(t),o.c(),o.m(i.parentNode,i)):o&&(o.d(1),o=null)},d(t){o&&o.d(t),t&&m(i)}}}function H(t){let i,o=t[2],a=F(t);return{c(){a.c(),i=n(),this.c=s},m(t,o){a.m(t,o),e(t,i,o)},p(t,[e]){4&e&&r(o,o=t[2])?(a.d(1),a=F(t),a.c(),a.m(i.parentNode,i)):a.p(t,e)},i:s,o:s,d(t){t&&m(i),a.d(t)}}}function M(t,i,o){let e,r,n,s,m=b(0);a(t,m,(t=>o(2,e=t)));let g=b({});function d(t){o(1,s="1fr 1fr")}a(t,g,(t=>o(3,r=t))),A(g,"groups-component",m),A(g,"communes-component",m),A(g,"cooperatives-component",m),A(g,"parties-component",m),A(g,"countries",m);let l=A(g,"landing-component",m,d);function u(t,i,o){let e=t([22,0],2);j(e,i,o),U(e,i,o),k(e,i,o),N(e,i,o);let r={};r[i.groups]=T,r[i.communes]=z,r[i.cooperatives]=y,r[i.parties]=C,L.control.layers(null,r).addTo(e)}d(),c((()=>{}));return[n,s,e,r,m,g,l,u,function(t){p[t?"unshift":"push"]((()=>{n=t,o(0,n)}))},t=>u(t,r,l)]}class R extends t{constructor(t){super(),this.shadowRoot.innerHTML="",i(this,{target:this.shadowRoot,props:o(this.attributes),customElement:!0},M,H,r,{},null),t&&t.target&&e(t.target,this,t.anchor)}}customElements.define("landing-component",R);export{R as default}; +import{S as t,i as o,a as i,b as e,s as r,e as n,n as s,d as m,c as a,o as c,w as p,f as g,g as d,t as l,h as u,j as h,v as f,k as v,l as w,m as x}from"./index-4348483d.js";import{w as b}from"./index-71440b21.js";import{addMarkersGroups as j,groupsMarkersLayer as T}from"../../../../../../../../../js/groups.js";import{addMarkersCoops as k,coopsMarkersLayer as y}from"../../../../../../../../../js/coops.js";import{addMarkersCommunes as U,communesMarkersLayer as z}from"../../../../../../../../../js/communes.js";import{addMarkersParties as N,partiesMarkersLayer as C}from"../../../../../../../../../js/parties.js";import{getData as A,loadLocaleContent as E}from"../../../../../../../../../js/libraries/serverTools.js";import"../../../../../../../../../js/components/map-component.js";function F(t){let o,i,r,n,s,a,c,p,b,j,T,k,y,U,z,N,C,L,A,E,F,H,K,M,Q,R,S,W,B,D,J,O,_,q,G,I,P,V,X,Y,Z,$,tt,ot,it,et,rt,nt,st,mt,at,ct,pt,gt,dt,lt,ut,ht,ft,vt,wt,xt,bt,jt,Tt,kt,yt,Ut=t[3].top+"",zt=t[3].groupsTitle+"",Nt=t[3].groupsText+"",Ct=t[3].communesTitle+"",Lt=t[3].communesText+"",At=t[3].cooperativesTitle+"",Et=t[3].cooperativesText+"",Ft=t[3].partiesTitle+"",Ht=t[3].partiesText+"",Kt=t[3].findUs+"",Mt=t[3].whatNow+"",Qt=t[3].joinUs+"",Rt=t[3].talkWithUs+"";return{c(){o=g("div"),i=g("picture"),i.innerHTML=' \n \n crowd',r=d(),n=g("div"),s=g("p"),a=l(Ut),c=d(),p=g("div"),b=g("div"),j=g("a"),T=g("h2"),k=l(zt),y=d(),U=g("img"),N=d(),C=g("p"),L=l(Nt),A=d(),E=g("div"),F=g("a"),H=g("h2"),K=l(Ct),M=d(),Q=g("img"),S=d(),W=g("p"),B=l(Lt),D=d(),J=g("div"),O=g("a"),_=g("h2"),q=l(At),G=d(),I=g("img"),V=d(),X=g("p"),Y=l(Et),Z=d(),$=g("div"),tt=g("a"),ot=g("h2"),it=l(Ft),et=d(),rt=g("img"),st=d(),mt=g("p"),at=l(Ht),ct=d(),pt=g("h1"),gt=l(Kt),dt=d(),lt=g("map-component"),ht=d(),ft=g("h1"),vt=l(Mt),wt=d(),xt=g("div"),bt=g("a"),jt=l(Qt),Tt=d(),kt=g("a"),yt=l(Rt),u(j,"href","/"+t[6]+"/groups"),u(U,"id","groups-img"),h(U.src,z="/img/common/groups.svg")||u(U,"src","/img/common/groups.svg"),u(U,"alt","groups"),u(F,"href","/"+t[6]+"/communes"),u(Q,"id","communes-img"),h(Q.src,R="/img/common/commune.svg")||u(Q,"src","/img/common/commune.svg"),u(Q,"alt","communes"),u(O,"href","/"+t[6]+"/coops"),u(I,"id","coops-img"),h(I.src,P="/img/common/coops.svg")||u(I,"src","/img/common/coops.svg"),u(I,"alt","coops"),u(tt,"href","/"+t[6]+"/parties"),u(rt,"id","parties-img"),h(rt.src,nt="/img/common/parties.svg")||u(rt,"src","/img/common/parties.svg"),u(rt,"alt","coops"),u(p,"id","container-grid"),f(p,"--grid-width",t[1]),u(pt,"id","find-us"),v(lt,"id","map"),v(lt,"callback",ut=t[9]),v(lt,"colors",["#23AC20","#CA2437","#217BC9","#FFD326"]),u(bt,"class","link-button"),u(bt,"href","/"+t[6]+"/join-us"),u(kt,"class","link-button"),u(kt,"href","https://discord.gg/Qk8KUk787z"),u(kt,"target","_blank"),u(kt,"rel","noreferrer"),u(xt,"id","action-container"),u(n,"id","text-container"),u(o,"id","container")},m(m,g){e(m,o,g),w(o,i),w(o,r),w(o,n),w(n,s),w(s,a),w(n,c),w(n,p),w(p,b),w(b,j),w(j,T),w(T,k),w(b,y),w(b,U),w(b,N),w(b,C),w(C,L),w(p,A),w(p,E),w(E,F),w(F,H),w(H,K),w(E,M),w(E,Q),w(E,S),w(E,W),w(W,B),w(p,D),w(p,J),w(J,O),w(O,_),w(_,q),w(J,G),w(J,I),w(J,V),w(J,X),w(X,Y),w(p,Z),w(p,$),w($,tt),w(tt,ot),w(ot,it),w($,et),w($,rt),w($,st),w($,mt),w(mt,at),t[8](p),w(n,ct),w(n,pt),w(pt,gt),w(n,dt),w(n,lt),w(n,ht),w(n,ft),w(ft,vt),w(n,wt),w(n,xt),w(xt,bt),w(bt,jt),w(xt,Tt),w(xt,kt),w(kt,yt)},p(t,o){8&o&&Ut!==(Ut=t[3].top+"")&&x(a,Ut),8&o&&zt!==(zt=t[3].groupsTitle+"")&&x(k,zt),8&o&&Nt!==(Nt=t[3].groupsText+"")&&x(L,Nt),8&o&&Ct!==(Ct=t[3].communesTitle+"")&&x(K,Ct),8&o&&Lt!==(Lt=t[3].communesText+"")&&x(B,Lt),8&o&&At!==(At=t[3].cooperativesTitle+"")&&x(q,At),8&o&&Et!==(Et=t[3].cooperativesText+"")&&x(Y,Et),8&o&&Ft!==(Ft=t[3].partiesTitle+"")&&x(it,Ft),8&o&&Ht!==(Ht=t[3].partiesText+"")&&x(at,Ht),2&o&&f(p,"--grid-width",t[1]),8&o&&Kt!==(Kt=t[3].findUs+"")&&x(gt,Kt),8&o&&ut!==(ut=t[9])&&v(lt,"callback",ut),8&o&&Mt!==(Mt=t[3].whatNow+"")&&x(vt,Mt),8&o&&Qt!==(Qt=t[3].joinUs+"")&&x(jt,Qt),8&o&&Rt!==(Rt=t[3].talkWithUs+"")&&x(yt,Rt)},d(i){i&&m(o),t[8](null)}}}function H(t){let o,i=7==t[2]&&F(t);return{c(){i&&i.c(),o=n()},m(t,r){i&&i.m(t,r),e(t,o,r)},p(t,e){7==t[2]?i?i.p(t,e):(i=F(t),i.c(),i.m(o.parentNode,o)):i&&(i.d(1),i=null)},d(t){i&&i.d(t),t&&m(o)}}}function K(t){let o,i=t[2],a=H(t);return{c(){a.c(),o=n(),this.c=s},m(t,i){a.m(t,i),e(t,o,i)},p(t,[e]){4&e&&r(i,i=t[2])?(a.d(1),a=H(t),a.c(),a.m(o.parentNode,o)):a.p(t,e)},i:s,o:s,d(t){t&&m(o),a.d(t)}}}function M(t,o,i){let e,r,n,s,m=b(0);a(t,m,(t=>i(2,e=t)));let g,d,l=b({});function u(t){i(1,s="1fr 1fr")}a(t,l,(t=>i(3,r=t)));A("/assets/groups.json",(t=>{g=JSON.parse(t),d={};for(let t of g){let o=t.country;null==t.contact&&(t.contact="https://discord.gg/Qk8KUk787z"),o in d?d[o].push(t):d[o]=[t]}m.update((t=>t+1))})),E(l,"groups-component",m),E(l,"communes-component",m),E(l,"cooperatives-component",m),E(l,"parties-component",m),E(l,"countries",m);let h=E(l,"landing-component",m,u);function f(t,o,i){let e=t([22,0],2);j(g,d,e,o,i),U(e,o,i),k(e,o,i),N(e,o,i);let r={};r[o.groups]=T,r[o.communes]=z,r[o.cooperatives]=y,r[o.parties]=C,L.control.layers(null,r).addTo(e)}u(),c((()=>{}));return[n,s,e,r,m,l,h,f,function(t){p[t?"unshift":"push"]((()=>{n=t,i(0,n)}))},t=>f(t,r,h)]}class Q extends t{constructor(t){super(),this.shadowRoot.innerHTML="",o(this,{target:this.shadowRoot,props:i(this.attributes),customElement:!0},M,K,r,{},null),t&&t.target&&e(t.target,this,t.anchor)}}customElements.define("landing-component",Q);export{Q as default};