2 lines
5.3 KiB
JavaScript
2 lines
5.3 KiB
JavaScript
import{S as t,i as o,a as n,b as e,s as r,e as i,n as a,d as s,c as m,o as l,w as c,f as u,g as p,h as d,j as g,k as f,l as h,q as b}from"./index-4348483d.js";import{w}from"./index-71440b21.js";import{addMarkersGroups as y}from"../../../../../../../../../js/groups.js";import{loadLocaleContent as x,getData as v,sendText as k}from"../../../../../../../../../js/libraries/serverTools.js";import"../../../../../../../../../js/components/map-component.js";function j(t){let o,n,r,i,a,m,l,c,w,y,x,v,k,j,L,z,S,C,T,N,O,A,H,M,q,D;return{c(){o=u("div"),n=u("div"),r=u("h1"),r.textContent="Add a Group",i=p(),a=u("img"),l=p(),c=u("p"),c.textContent="If there are no groups in your town with whom you can organize then do the following:",w=p(),y=u("ol"),y.innerHTML="<li>Click on the map to show us where you are located;</li> \n <li>Add a way to contact you or leave blank for a pin to point to our discord;</li> \n <li>Press "Submit" to add yourself to our map;</li> \n <li>Verify yourself by having a chat with us at our Discord server to show on the map;</li>",x=p(),v=u("label"),v.textContent="Location: ",k=u("input"),j=u("br"),L=p(),z=u("label"),z.textContent="Contact: ",S=u("input"),C=p(),T=u("button"),T.textContent="Submit",N=p(),O=u("p"),A=p(),H=u("map-component"),d(a,"id","groups-img"),g(a.src,m="/img/common/groups.svg")||d(a,"src","/img/common/groups.svg"),d(a,"alt","groups"),d(c,"class","description"),d(v,"for","address-input"),d(k,"id","address-input"),d(k,"type","text"),k.readOnly=!0,d(z,"for","contact-input"),d(S,"id","contact-input"),d(S,"type","text"),d(T,"id","submit-button"),d(O,"id","confirmation-msg"),f(H,"id","map"),f(H,"callback",M=t[13]),d(n,"id","text-container"),d(o,"id","container")},m(s,m){e(s,o,m),h(o,n),h(n,r),h(n,i),h(n,a),h(n,l),h(n,c),h(n,w),h(n,y),h(n,x),h(n,v),h(n,k),t[10](k),h(n,j),h(n,L),h(n,z),h(n,S),t[11](S),h(n,C),h(n,T),h(n,N),h(n,O),t[12](O),h(n,A),h(n,H),q||(D=b(T,"click",t[9]),q=!0)},p(t,o){16&o&&M!==(M=t[13])&&f(H,"callback",M)},d(n){n&&s(o),t[10](null),t[11](null),t[12](null),q=!1,D()}}}function z(t){let o,n=2==t[3]&&j(t);return{c(){n&&n.c(),o=i()},m(t,r){n&&n.m(t,r),e(t,o,r)},p(t,e){2==t[3]?n?n.p(t,e):(n=j(t),n.c(),n.m(o.parentNode,o)):n&&(n.d(1),n=null)},d(t){n&&n.d(t),t&&s(o)}}}function S(t){let o,n=t[3],m=z(t);return{c(){m.c(),o=i(),this.c=a},m(t,n){m.m(t,n),e(t,o,n)},p(t,[e]){8&e&&r(n,n=t[3])?(m.d(1),m=z(t),m.c(),m.m(o.parentNode,o)):m.p(t,e)},i:a,o:a,d(t){t&&s(o),m.d(t)}}}function C(t,o,n){let e,r,i=w(0);m(t,i,(t=>n(3,e=t)));let a,s,u,p,d=w({});m(t,d,(t=>n(4,r=t)));let g=0,f=0,h=function(t,o){let n=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,o],{icon:n})}(0,0);h.setOpacity(0);let b=x(d,"groups-component",i);function j(t,o,e){let r=t([22,0],2);y(r,o,e),h.addTo(r),r.on("click",(function(t){let o=t.latlng.lat,e=t.latlng.lng;g=o,f=e,function(t,o,n){let e=L.latLng(o,n);t.setLatLng(e)}(h,o,e),h.setOpacity(1),v(`https://nominatim.openstreetmap.org/reverse?lat=${o}&lon=${e}&format=jsonv2`,(t=>{let o=(t=JSON.parse(t)).address,e=o.city||o.town||o.village||o.hamlet,r=o.state,i=o.country,a=i;null!=r?a+=", "+r:r="",null!=e?a+=", "+e:e="",n(1,s.value=a,s),p=[i,r,e]}))}))}function z(t){!1!==t?(n(0,a.innerHTML="You have been added to our database! Now go to our Discord to verify yourself.",a),n(0,a.style.color="green",a)):(n(0,a.innerHTML="Something went wrong.",a),n(0,a.style.color="red",a))}x(d,"countries",i),l((()=>{}));return[a,s,u,e,r,i,d,b,j,function(){if(null!=p){let t=[...p,g,f,u.value];k("/"+b+"/groups-add-post/",JSON.stringify(t),z)}},function(t){c[t?"unshift":"push"]((()=>{s=t,n(1,s)}))},function(t){c[t?"unshift":"push"]((()=>{u=t,n(2,u)}))},function(t){c[t?"unshift":"push"]((()=>{a=t,n(0,a)}))},t=>j(t,r,b)]}class T extends t{constructor(t){super(),this.shadowRoot.innerHTML="<style>@import '/css/common.css';#confirmation-msg{margin-top:0.5rem;margin-bottom:2rem}ol li{margin-left:3rem;margin-bottom:0.5rem}label{display:inline-block;font-family:var(--serif,serif);font-size:1.15rem;line-height:160%;color:#222222;width:5.5rem}input{font-size:1.15rem;font-family:var(--serif,serif);height:2.5rem}#address-input{margin-top:2rem;margin-bottom:1rem;width:min(30rem,calc(100% - 10rem))}#contact-input{width:min(20rem,calc(100% - 10rem))}.description{margin-bottom:1rem}#submit-button{display:block;margin:auto;margin-top:2rem;padding:1rem 2rem;font-size:1.4rem;font-family:var(--sans-serif,sans-serif);border:0rem solid black;border-radius:0.5rem;background:#cb1816;color:white}#groups-img{position:absolute;width:14rem;left:50%;transform:translate(-50%);z-index:0;opacity:0.2}#text-container>:nth-child(3){margin-top:8rem}#map{--height:30rem;--width:100%;--margin-top:2rem;--margin-bottom:0.5rem}#text-container{position:relative;max-width:calc(100vw - 4rem);margin:auto}h1{margin-bottom:1rem;font-size:2.2rem;text-align:center}#container{margin:auto;max-width:800px;margin-top:1rem;margin-bottom:4rem}#container p{text-align:justify}</style>",o(this,{target:this.shadowRoot,props:n(this.attributes),customElement:!0},C,S,r,{},null),t&&t.target&&e(t.target,this,t.anchor)}}customElements.define("groups-add-component",T);export{T as default};
|