From 909416fbe3eaf079b11d570333b9da3ad7603b40 Mon Sep 17 00:00:00 2001 From: a-ill Date: Fri, 21 Jul 2023 17:38:02 +0300 Subject: [PATCH] Update --- Server/app/resources/basic/BasicController.jl | 34 ++++++++++++++++--- Server/app/svelte/public/js/groups.js | 24 ++++++++++++- .../svelte/public/js/libraries/serverTools.js | 2 ++ .../svelte/public/locales/ru/countries.json | 1 + .../svelte/src/groups-add-component.svelte | 24 +++++++++++-- Server/app/svelte/src/groups-component.svelte | 10 +++--- Server/lib/DatabaseSupport.jl | 14 ++++++-- .../js/components/groups-add-component.js | 2 +- .../public/js/components/groups-component.js | 2 +- Server/public/js/groups.js | 24 ++++++++++++- Server/public/js/libraries/serverTools.js | 2 ++ Server/public/locales/ru/countries.json | 1 + 12 files changed, 121 insertions(+), 19 deletions(-) diff --git a/Server/app/resources/basic/BasicController.jl b/Server/app/resources/basic/BasicController.jl index 138d464..3642cda 100644 --- a/Server/app/resources/basic/BasicController.jl +++ b/Server/app/resources/basic/BasicController.jl @@ -212,10 +212,34 @@ function political_compass() end function groups_add_post() - data = collect(JSON3.read(rawpayload())) - push!(data,1) - dict = Dict(zip(["country","state","town","latitude","longitude","contact","members"],data)) - insert_into_table("groups",dict) + data = jsonpayload() + insert_into_table("groups",data) end +#= +function compile_groups() + function table_to_json(name,t) + ar = [] + for df_row in eachrow(t) + + df_row = first(eachrow(df)) + id = :town + location = String[] + for id in [:country,:state,:town] + if !isempty(df_row[id]) + push!(location,df_row[id]) + end + end + df = select_from_table(["groups" => ["*"]]) + dict = Dict( + "location" => [location,[df_row[:latitude],df_row[:longitude]]], + "members" => df_row[:members], + "contact" => df_row[:contact] + ) + end + return ar + end + df = select_from_table(["groups" => ["*"]]) -end \ No newline at end of file +end +=# +end diff --git a/Server/app/svelte/public/js/groups.js b/Server/app/svelte/public/js/groups.js index 95b2c52..eede38c 100644 --- a/Server/app/svelte/public/js/groups.js +++ b/Server/app/svelte/public/js/groups.js @@ -73,6 +73,16 @@ export let groups = [ location: [["USA","Ohio"], [40.18243610076637, -83.07800532738788]], members: 1, contact: ["https://discord.gg/Qk8KUk787z","DiscordInviteLink"] + }, + { + location: [["Thailand","Chiang Mai"], [18.788343253574393, 98.99423221087719]], + members: 1, + contact: ["https://discord.gg/Qk8KUk787z","DiscordInviteLink"] + }, + { + location: [["Switzerland","Cham"], [47.18298143153399, 8.460076421717238]], + members: 1, + contact: ["https://discord.gg/Qk8KUk787z","DiscordInviteLink"] } ] @@ -93,6 +103,18 @@ let groupsMarkersLayerIn = L.layerGroup() let contactGeneral =["https://discord.gg/4BUau4AZre","DiscordInviteLink"] +export function translate(content, x) { + let out = content[x] + if (out==undefined) { + return x + } + else { + return out + } +} + + + function addMarkersToLayer(g,layer,content,locale) { let coordinates let text = ""+content["Group"]+"
" @@ -108,7 +130,7 @@ function addMarkersToLayer(g,layer,content,locale) { locationString = location.map(x => x).join(", ") } else { - locationString = location.map(x => content[x]).join(", ") + locationString = location.map(x => translate(content, x)).join(", ") } text += fieldText + locationString + "
" coordinates = g[field][1] diff --git a/Server/app/svelte/public/js/libraries/serverTools.js b/Server/app/svelte/public/js/libraries/serverTools.js index 1fca108..2a9f54c 100644 --- a/Server/app/svelte/public/js/libraries/serverTools.js +++ b/Server/app/svelte/public/js/libraries/serverTools.js @@ -35,6 +35,7 @@ export function sendData(route,data,callback) { callback(xhr.responseText) } } else { + callback(false) console.log("Request gave an error") // Oh no! There has been an error with the request! } @@ -57,6 +58,7 @@ export function sendText(route,data,callback) { } } else { callback(false) + console.log("Request gave an error") // Oh no! There has been an error with the request! } } diff --git a/Server/app/svelte/public/locales/ru/countries.json b/Server/app/svelte/public/locales/ru/countries.json index 08eec1d..56dd33d 100644 --- a/Server/app/svelte/public/locales/ru/countries.json +++ b/Server/app/svelte/public/locales/ru/countries.json @@ -10,6 +10,7 @@ "Germany": "Германия", "USA": "CША", "Bulgaria": "Болгария", + "Thailand": "Тайланд", "Colorado": "Колорадо", "Georgia": "Джорджия", "Ohio": "Огайо", diff --git a/Server/app/svelte/src/groups-add-component.svelte b/Server/app/svelte/src/groups-add-component.svelte index 4f108da..0694b91 100644 --- a/Server/app/svelte/src/groups-add-component.svelte +++ b/Server/app/svelte/src/groups-add-component.svelte @@ -5,7 +5,7 @@ import { onMount } from 'svelte' import { writable } from 'svelte/store'; import { groupsByCountry, addMarkersGroups } from '/js/groups.js' - import { loadLocaleContent, getData, sendText } from "/js/libraries/serverTools.js" + import { loadLocaleContent, getData, sendData } from "/js/libraries/serverTools.js" // Import components import "/js/components/map-component.js" @@ -105,9 +105,27 @@ function submitLocation() { if (addressVec!=undefined) { - let data = [...addressVec,userPinLat,userPinLng,contactInput.value] + let data = { + country: addressVec[0], + state: addressVec[1], + town: addressVec[2], + latitude: userPinLat, + longitude: userPinLng, + contact: contactInput.value, + members: 1 + } + + if (data.state=="") { + data.state = null + } + if (data.town=="") { + data.town = null + } + if (data.contact=="") { + data.contact = null + } let url = "/" + locale + "/groups-add-post/" - sendText(url,JSON.stringify(data),updateConfirmationMsg) + sendData(url,data,updateConfirmationMsg) } } diff --git a/Server/app/svelte/src/groups-component.svelte b/Server/app/svelte/src/groups-component.svelte index d4b272e..abc7d22 100644 --- a/Server/app/svelte/src/groups-component.svelte +++ b/Server/app/svelte/src/groups-component.svelte @@ -4,7 +4,7 @@ // Import statements import { onMount } from 'svelte' import { writable } from 'svelte/store'; - import { groupsByCountry, addMarkersGroups } from '/js/groups.js' + import { groupsByCountry, addMarkersGroups, translate } from '/js/groups.js' import { loadLocaleContent, getData, sendData } from "/js/libraries/serverTools.js" // Import components @@ -22,14 +22,14 @@ addMarkersGroups(map,content,locale) } - function getCountry(name) { - return locale=="en" ? name : $content[name] + function getCountry(x) { + return locale=="en" ? x : translate($content,x) } function getAddress(group) { - return group.location[0].map(x => locale=="en" ? x : $content[x]).join(", ") + return group.location[0].map(x => locale=="en" ? x : translate($content,x)).join(", ") } - + onMount(() => { }) diff --git a/Server/lib/DatabaseSupport.jl b/Server/lib/DatabaseSupport.jl index 2149389..b1395ae 100644 --- a/Server/lib/DatabaseSupport.jl +++ b/Server/lib/DatabaseSupport.jl @@ -6,14 +6,24 @@ using DataFrames export exist_in_table, insert_into_table, update_table, select_from_table, add_foreign_key - options = SearchLight.Configuration.read_db_connection_data("db/connection.yml") conn = SearchLight.connect(options) +function format(x) + if (x isa String) || (x isa Symbol) + return string("'",x,"'") + elseif (isnothing(x)) + return "NULL" + else + return x + end +end + function insert_into_table(table_name,dict_values) names_string = join(keys(dict_values),", ") vals_raw = values(dict_values) - vals = map(x -> (x isa String) || (x isa Symbol) ? string("'",x,"'") : x,vals_raw) + + vals = map(x -> format(x),vals_raw) vals_string = join(values(vals),", ") query = "INSERT INTO $table_name ($names_string) VALUES ($vals_string)" SearchLight.query(query) diff --git a/Server/public/js/components/groups-add-component.js b/Server/public/js/components/groups-add-component.js index 27843e5..8ce69db 100644 --- a/Server/public/js/components/groups-add-component.js +++ b/Server/public/js/components/groups-add-component.js @@ -1 +1 @@ -import{S as t,i as n,a as e,b as i,s as o,e as r,n as a,d as s,c as l,o as m,w as p,f as c,g as u,h as d,j as g,k as h,l as f,q as b,r as w}from"./index-4348483d.js";import{w as y}from"./index-71440b21.js";import{addMarkersGroups as v}from"../../../../../../../../../js/groups.js";import{loadLocaleContent as x,getData as k,sendText as j}from"../../../../../../../../../js/libraries/serverTools.js";import"../../../../../../../../../js/components/map-component.js";function S(t){let n,e,o,r,a,l,m,p,y,v,x,k,j,L,S,z,C,T,H,M,N,O,A,q,E,D,I,J,R,U,$,G,P,V,Y;return{c(){n=c("div"),e=c("div"),o=c("h1"),o.textContent="Add a Group",r=u(),a=c("img"),m=u(),p=c("p"),p.textContent="If there are no groups in your town with whom you can organize then do the following:",y=u(),v=c("ol"),v.innerHTML="
  • Click on the map to show us where you are located;
  • \n
  • Add a way to contact you or leave blank for a pin to point to our discord;
  • \n
  • Press "Submit" to add yourself to our map;
  • \n
  • Verify yourself by having a chat with us at our Discord server to show on the map;
  • ",x=u(),k=c("div"),j=c("label"),j.textContent="Location:",L=u(),S=c("div"),z=c("input"),C=u(),T=c("div"),H=u(),M=c("div"),N=c("label"),N.textContent="Contact:",O=u(),A=c("div"),q=c("input"),E=u(),D=c("div"),I=u(),J=c("button"),J.textContent="Submit",R=u(),U=c("p"),$=u(),G=c("map-component"),d(a,"id","groups-img"),g(a.src,l="/img/common/groups.svg")||d(a,"src","/img/common/groups.svg"),d(a,"alt","groups"),d(p,"class","description"),d(j,"for","address-input"),d(z,"id","address-input"),d(z,"type","text"),z.readOnly=!0,d(T,"class","ghost-input"),d(S,"class","input-wrapper"),d(k,"id","address-input-wrapper"),d(k,"class","input-label-wrapper"),d(N,"for","contact-input"),d(q,"id","contact-input"),d(q,"type","text"),d(D,"class","ghost-input"),d(A,"class","input-wrapper"),d(M,"class","input-label-wrapper"),d(J,"id","submit-button"),d(U,"id","confirmation-msg"),h(G,"id","map"),h(G,"callback",P=t[15]),d(e,"id","text-container"),d(n,"id","container")},m(s,l){i(s,n,l),f(n,e),f(e,o),f(e,r),f(e,a),f(e,m),f(e,p),f(e,y),f(e,v),f(e,x),f(e,k),f(k,j),f(k,L),f(k,S),f(S,z),t[10](z),f(S,C),f(S,T),f(e,H),f(e,M),f(M,N),f(M,O),f(M,A),f(A,q),t[12](q),f(A,E),f(A,D),f(e,I),f(e,J),f(e,R),f(e,U),t[14](U),f(e,$),f(e,G),V||(Y=[b(z,"input",t[11]),b(q,"input",t[13]),b(J,"click",t[9])],V=!0)},p(t,n){16&n&&P!==(P=t[15])&&h(G,"callback",P)},d(e){e&&s(n),t[10](null),t[12](null),t[14](null),V=!1,w(Y)}}}function z(t){let n,e=2==t[3]&&S(t);return{c(){e&&e.c(),n=r()},m(t,o){e&&e.m(t,o),i(t,n,o)},p(t,i){2==t[3]?e?e.p(t,i):(e=S(t),e.c(),e.m(n.parentNode,n)):e&&(e.d(1),e=null)},d(t){e&&e.d(t),t&&s(n)}}}function C(t){let n,e=t[3],l=z(t);return{c(){l.c(),n=r(),this.c=a},m(t,e){l.m(t,e),i(t,n,e)},p(t,[i]){8&i&&o(e,e=t[3])?(l.d(1),l=z(t),l.c(),l.m(n.parentNode,n)):l.p(t,i)},i:a,o:a,d(t){t&&s(n),l.d(t)}}}function T(t){t.nextElementSibling.innerHTML=t.value}function H(t,n,e){let i,o,r=y(0);l(t,r,(t=>e(3,i=t)));let a,s,c,u,d=y({});l(t,d,(t=>e(4,o=t)));let g=0,h=0,f=function(t,n){let e=new L.Icon({iconUrl:"/img/common/markers/marker-black.png",shadowUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],shadowSize:[41,41]});return L.marker([t,n],{icon:e})}(0,0);f.setOpacity(0);let b=x(d,"groups-component",r);function w(t,n,i){let o=t([22,0],2);v(o,n,i),f.addTo(o),o.on("click",(function(t){let n=t.latlng.lat,i=t.latlng.lng;g=n,h=i,function(t,n,e){let i=L.latLng(n,e);t.setLatLng(i)}(f,n,i),f.setOpacity(1),k(`https://nominatim.openstreetmap.org/reverse?lat=${n}&lon=${i}&format=jsonv2`,(t=>{let n=(t=JSON.parse(t)).address,i=n.city||n.town||n.village||n.hamlet,o=n.state,r=n.country,a=r;null!=o?a+=", "+o:o="",null!=i?a+=", "+i:i="",e(1,s.value=a,s),T(s),u=[r,o,i]}))}))}function S(t){!1!==t?(e(0,a.innerHTML="You have been added to our database! Now go to our Discord to verify yourself.",a),e(0,a.style.color="green",a)):(e(0,a.innerHTML="Something went wrong.",a),e(0,a.style.color="red",a))}x(d,"countries",r),m((()=>{}));return[a,s,c,i,o,r,d,b,w,function(){if(null!=u){let t=[...u,g,h,c.value];j("/"+b+"/groups-add-post/",JSON.stringify(t),S)}},function(t){p[t?"unshift":"push"]((()=>{s=t,e(1,s)}))},()=>T(s),function(t){p[t?"unshift":"push"]((()=>{c=t,e(2,c)}))},()=>T(c),function(t){p[t?"unshift":"push"]((()=>{a=t,e(0,a)}))},t=>w(t,o,b)]}class M extends t{constructor(t){super(),this.shadowRoot.innerHTML="",n(this,{target:this.shadowRoot,props:e(this.attributes),customElement:!0},H,C,o,{},null),t&&t.target&&i(t.target,this,t.anchor)}}customElements.define("groups-add-component",M);export{M as default}; +import{S as t,i as n,a as e,b as o,s as i,e as r,n as a,d as s,c as l,o as m,w as p,f as c,g as u,h as d,j as g,k as h,l as f,q as b,r as w}from"./index-4348483d.js";import{w as y}from"./index-71440b21.js";import{addMarkersGroups as v}from"../../../../../../../../../js/groups.js";import{loadLocaleContent as x,getData as k,sendData as j}from"../../../../../../../../../js/libraries/serverTools.js";import"../../../../../../../../../js/components/map-component.js";function z(t){let n,e,i,r,a,l,m,p,y,v,x,k,j,L,z,S,C,T,H,M,A,N,O,q,E,D,I,R,U,$,G,J,P,V,Y;return{c(){n=c("div"),e=c("div"),i=c("h1"),i.textContent="Add a Group",r=u(),a=c("img"),m=u(),p=c("p"),p.textContent="If there are no groups in your town with whom you can organize then do the following:",y=u(),v=c("ol"),v.innerHTML="
  • Click on the map to show us where you are located;
  • \n
  • Add a way to contact you or leave blank for a pin to point to our discord;
  • \n
  • Press "Submit" to add yourself to our map;
  • \n
  • Verify yourself by having a chat with us at our Discord server to show on the map;
  • ",x=u(),k=c("div"),j=c("label"),j.textContent="Location:",L=u(),z=c("div"),S=c("input"),C=u(),T=c("div"),H=u(),M=c("div"),A=c("label"),A.textContent="Contact:",N=u(),O=c("div"),q=c("input"),E=u(),D=c("div"),I=u(),R=c("button"),R.textContent="Submit",U=u(),$=c("p"),G=u(),J=c("map-component"),d(a,"id","groups-img"),g(a.src,l="/img/common/groups.svg")||d(a,"src","/img/common/groups.svg"),d(a,"alt","groups"),d(p,"class","description"),d(j,"for","address-input"),d(S,"id","address-input"),d(S,"type","text"),S.readOnly=!0,d(T,"class","ghost-input"),d(z,"class","input-wrapper"),d(k,"id","address-input-wrapper"),d(k,"class","input-label-wrapper"),d(A,"for","contact-input"),d(q,"id","contact-input"),d(q,"type","text"),d(D,"class","ghost-input"),d(O,"class","input-wrapper"),d(M,"class","input-label-wrapper"),d(R,"id","submit-button"),d($,"id","confirmation-msg"),h(J,"id","map"),h(J,"callback",P=t[15]),d(e,"id","text-container"),d(n,"id","container")},m(s,l){o(s,n,l),f(n,e),f(e,i),f(e,r),f(e,a),f(e,m),f(e,p),f(e,y),f(e,v),f(e,x),f(e,k),f(k,j),f(k,L),f(k,z),f(z,S),t[10](S),f(z,C),f(z,T),f(e,H),f(e,M),f(M,A),f(M,N),f(M,O),f(O,q),t[12](q),f(O,E),f(O,D),f(e,I),f(e,R),f(e,U),f(e,$),t[14]($),f(e,G),f(e,J),V||(Y=[b(S,"input",t[11]),b(q,"input",t[13]),b(R,"click",t[9])],V=!0)},p(t,n){16&n&&P!==(P=t[15])&&h(J,"callback",P)},d(e){e&&s(n),t[10](null),t[12](null),t[14](null),V=!1,w(Y)}}}function S(t){let n,e=2==t[3]&&z(t);return{c(){e&&e.c(),n=r()},m(t,i){e&&e.m(t,i),o(t,n,i)},p(t,o){2==t[3]?e?e.p(t,o):(e=z(t),e.c(),e.m(n.parentNode,n)):e&&(e.d(1),e=null)},d(t){e&&e.d(t),t&&s(n)}}}function C(t){let n,e=t[3],l=S(t);return{c(){l.c(),n=r(),this.c=a},m(t,e){l.m(t,e),o(t,n,e)},p(t,[o]){8&o&&i(e,e=t[3])?(l.d(1),l=S(t),l.c(),l.m(n.parentNode,n)):l.p(t,o)},i:a,o:a,d(t){t&&s(n),l.d(t)}}}function T(t){t.nextElementSibling.innerHTML=t.value}function H(t,n,e){let o,i,r=y(0);l(t,r,(t=>e(3,o=t)));let a,s,c,u,d=y({});l(t,d,(t=>e(4,i=t)));let g=0,h=0,f=function(t,n){let e=new L.Icon({iconUrl:"/img/common/markers/marker-black.png",shadowUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],shadowSize:[41,41]});return L.marker([t,n],{icon:e})}(0,0);f.setOpacity(0);let b=x(d,"groups-component",r);function w(t,n,o){let i=t([22,0],2);v(i,n,o),f.addTo(i),i.on("click",(function(t){let n=t.latlng.lat,o=t.latlng.lng;g=n,h=o,function(t,n,e){let o=L.latLng(n,e);t.setLatLng(o)}(f,n,o),f.setOpacity(1),k(`https://nominatim.openstreetmap.org/reverse?lat=${n}&lon=${o}&format=jsonv2`,(t=>{let n=(t=JSON.parse(t)).address,o=n.city||n.town||n.village||n.hamlet,i=n.state,r=n.country,a=r;null!=i?a+=", "+i:i="",null!=o?a+=", "+o:o="",e(1,s.value=a,s),T(s),u=[r,i,o]}))}))}function z(t){!1!==t?(e(0,a.innerHTML="You have been added to our database! Now go to our Discord to verify yourself.",a),e(0,a.style.color="green",a)):(e(0,a.innerHTML="Something went wrong.",a),e(0,a.style.color="red",a))}x(d,"countries",r),m((()=>{}));return[a,s,c,o,i,r,d,b,w,function(){if(null!=u){let t={country:u[0],state:u[1],town:u[2],latitude:g,longitude:h,contact:c.value,members:1};""==t.state&&(t.state=null),""==t.town&&(t.town=null),""==t.contact&&(t.contact=null),j("/"+b+"/groups-add-post/",t,z)}},function(t){p[t?"unshift":"push"]((()=>{s=t,e(1,s)}))},()=>T(s),function(t){p[t?"unshift":"push"]((()=>{c=t,e(2,c)}))},()=>T(c),function(t){p[t?"unshift":"push"]((()=>{a=t,e(0,a)}))},t=>w(t,i,b)]}class M extends t{constructor(t){super(),this.shadowRoot.innerHTML="",n(this,{target:this.shadowRoot,props:e(this.attributes),customElement:!0},H,C,i,{},null),t&&t.target&&o(t.target,this,t.anchor)}}customElements.define("groups-add-component",M);export{M as default}; diff --git a/Server/public/js/components/groups-component.js b/Server/public/js/components/groups-component.js index 56b47ba..e8af626 100644 --- a/Server/public/js/components/groups-component.js +++ b/Server/public/js/components/groups-component.js @@ -1 +1 @@ -import{S as t,i as o,a as n,b as e,s as r,e as i,n as m,d as a,c as s,o as c,f as l,t as p,g,h as u,j as d,k as h,l as f,m as b,p as j}from"./index-4348483d.js";import{w as x}from"./index-71440b21.js";import{addMarkersGroups as v,groupsByCountry as w}from"../../../../../../../../../js/groups.js";import{loadLocaleContent as y}from"../../../../../../../../../js/libraries/serverTools.js";import"../../../../../../../../../js/components/map-component.js";function k(t,o,n){const e=t.slice();return e[9]=o[n][0],e[10]=o[n][1],e}function z(t,o,n){const e=t.slice();return e[13]=o[n],e}function D(t){let o,n,r,i,m,s,c,x,v,y,z,D,E,O,R,T,A,C,H,L,M=t[0].groups+"",S=t[0].p1+"",_=t[0].subheading1+"",q=t[0]["map-prompt"]+"",B=Object.entries(w),F=[];for(let o=0;on(1,r=t)));let m=x({});s(t,m,(t=>n(0,e=t)));let a=y(m,"groups-component",i);function l(t,o,n){let e=t([22,0],2);v(e,o,n)}y(m,"countries",i),c((()=>{}));return[e,r,i,m,a,l,function(t){return"en"==a?t:e[t]},function(t){return t.location[0].map((t=>"en"==a?t:e[t])).join(", ")},t=>l(t,e,a)]}class A extends t{constructor(t){super(),this.shadowRoot.innerHTML="",o(this,{target:this.shadowRoot,props:n(this.attributes),customElement:!0},T,R,r,{},null),t&&t.target&&e(t.target,this,t.anchor)}}customElements.define("groups-component",A);export{A as default}; +import{S as t,i as o,a as n,b as e,s as r,e as i,n as m,d as a,c as s,o as c,f as l,t as p,g,h as u,j as d,k as h,l as f,m as b,p as j}from"./index-4348483d.js";import{w as x}from"./index-71440b21.js";import{addMarkersGroups as v,translate as w,groupsByCountry as y}from"../../../../../../../../../js/groups.js";import{loadLocaleContent as k}from"../../../../../../../../../js/libraries/serverTools.js";import"../../../../../../../../../js/components/map-component.js";function z(t,o,n){const e=t.slice();return e[9]=o[n][0],e[10]=o[n][1],e}function D(t,o,n){const e=t.slice();return e[13]=o[n],e}function E(t){let o,n,r,i,m,s,c,x,v,w,k,D,E,N,R,T,A,C,H,L,M=t[0].groups+"",S=t[0].p1+"",_=t[0].subheading1+"",q=t[0]["map-prompt"]+"",B=Object.entries(y),F=[];for(let o=0;on(1,r=t)));let m=x({});s(t,m,(t=>n(0,e=t)));let a=k(m,"groups-component",i);function l(t,o,n){let e=t([22,0],2);v(e,o,n)}k(m,"countries",i),c((()=>{}));return[e,r,i,m,a,l,function(t){return"en"==a?t:w(e,t)},function(t){return t.location[0].map((t=>"en"==a?t:w(e,t))).join(", ")},t=>l(t,e,a)]}class C extends t{constructor(t){super(),this.shadowRoot.innerHTML="",o(this,{target:this.shadowRoot,props:n(this.attributes),customElement:!0},A,T,r,{},null),t&&t.target&&e(t.target,this,t.anchor)}}customElements.define("groups-component",C);export{C as default}; diff --git a/Server/public/js/groups.js b/Server/public/js/groups.js index 95b2c52..eede38c 100644 --- a/Server/public/js/groups.js +++ b/Server/public/js/groups.js @@ -73,6 +73,16 @@ export let groups = [ location: [["USA","Ohio"], [40.18243610076637, -83.07800532738788]], members: 1, contact: ["https://discord.gg/Qk8KUk787z","DiscordInviteLink"] + }, + { + location: [["Thailand","Chiang Mai"], [18.788343253574393, 98.99423221087719]], + members: 1, + contact: ["https://discord.gg/Qk8KUk787z","DiscordInviteLink"] + }, + { + location: [["Switzerland","Cham"], [47.18298143153399, 8.460076421717238]], + members: 1, + contact: ["https://discord.gg/Qk8KUk787z","DiscordInviteLink"] } ] @@ -93,6 +103,18 @@ let groupsMarkersLayerIn = L.layerGroup() let contactGeneral =["https://discord.gg/4BUau4AZre","DiscordInviteLink"] +export function translate(content, x) { + let out = content[x] + if (out==undefined) { + return x + } + else { + return out + } +} + + + function addMarkersToLayer(g,layer,content,locale) { let coordinates let text = ""+content["Group"]+"
    " @@ -108,7 +130,7 @@ function addMarkersToLayer(g,layer,content,locale) { locationString = location.map(x => x).join(", ") } else { - locationString = location.map(x => content[x]).join(", ") + locationString = location.map(x => translate(content, x)).join(", ") } text += fieldText + locationString + "
    " coordinates = g[field][1] diff --git a/Server/public/js/libraries/serverTools.js b/Server/public/js/libraries/serverTools.js index 1fca108..2a9f54c 100644 --- a/Server/public/js/libraries/serverTools.js +++ b/Server/public/js/libraries/serverTools.js @@ -35,6 +35,7 @@ export function sendData(route,data,callback) { callback(xhr.responseText) } } else { + callback(false) console.log("Request gave an error") // Oh no! There has been an error with the request! } @@ -57,6 +58,7 @@ export function sendText(route,data,callback) { } } else { callback(false) + console.log("Request gave an error") // Oh no! There has been an error with the request! } } diff --git a/Server/public/locales/ru/countries.json b/Server/public/locales/ru/countries.json index 08eec1d..56dd33d 100644 --- a/Server/public/locales/ru/countries.json +++ b/Server/public/locales/ru/countries.json @@ -10,6 +10,7 @@ "Germany": "Германия", "USA": "CША", "Bulgaria": "Болгария", + "Thailand": "Тайланд", "Colorado": "Колорадо", "Georgia": "Джорджия", "Ohio": "Огайо",