text: (this.webpackJsonpweb=this.webpackJsonpweb||[]).push([[0],{15:function(e,t,a){e.exports=a.p+"static/media/map-marker.658b8302.svg"},38:function(e,t,a){e.exports=a.p+"static/media/logo.1653c647.svg"},41:function(e,t,a){e.exports=a(76)},46:function(e,t,a){},48:function(e,t,a){},54:function(e,t,a){},72:function(e,t,a){},73:function(e,t,a){},75:function(e,t,a){},76:function(e,t,a){"use strict";a.r(t);var n=a(0),l=a.n(n),c=a(17),r=a.n(c),o=(a(46),a(47),a(13)),i=a(5),m=(a(48),a(9)),s=a(38),u=a.n(s);var p=function(){return l.a.createElement("div",{id:"page-landing"},l.a.createElement("div",{className:"content-wrapper"},l.a.createElement("img",{src:u.a,alt:"Happy"}),l.a.createElement("main",null,l.a.createElement("h1",null,"Leve Felicidade Para o mundo"),l.a.createElement("p",null,"Visite orfanatos e mue o dia de muitas crian\xe7as.")),l.a.createElement("div",{className:"location"},l.a.createElement("strong",null,"Canoas"),l.a.createElement("span",null,"Rio Grande do Sul")),l.a.createElement(o.b,{to:"/app",className:"enter-app"},l.a.createElement(m.b,{size:26,color:"rgba(0,0,0,0.6"}))))},d=a(7),E=a(78),g=a(79),b=a(77),h=a(80),f=a(15),v=a.n(f),N=(a(54),a(6)),j=a.n(N).a.icon({iconUrl:v.a,iconSize:[58,68],iconAnchor:[29,68],popupAnchor:[0,-60]}),k=a(39),y=a.n(k).a.create({baseURL:"http://localhost:3333"});var F=function(){var e=Object(n.useState)([]),t=Object(d.a)(e,2),a=t[0],c=t[1];return Object(n.useEffect)((function(){y.get("orphanages").then((function(e){c(e.data)}))}),[]),l.a.createElement("div",{id:"page-map"},l.a.createElement("aside",null,l.a.createElement("header",null,l.a.createElement("img",{src:v.a,alt:"Happy"}),l.a.createElement("h2",null,"Escolha um Orfanato no Mapa"),l.a.createElement("p",null,"Muitas crian\xe7as est\xe3o esperanddo a sua visita :)")),l.a.createElement("footer",null,l.a.createElement("strong",null,"Canoas"),l.a.createElement("span",null,"Rio Grande do Sul"))),l.a.createElement(E.a,{center:[-29.9149073,-51.231772],zoom:15,style:{width:"100%",height:"100%"}},l.a.createElement(g.a,{url:"https://api.mapbox.com/styles/v1/mapbox/light-v10/tiles/256/{z}/{x}/{y}@2x?access_token=".concat("pk.eyJ1IjoicmFmYWVsZmFudGluZWwiLCJhIjoiY2tnNzRzejZqMDN4YjJ5bXR0cTVwZGFoNCJ9.5fJAqJ2gNnVmygpfu7Hvzw")}),a.map((function(e){return l.a.createElement(b.a,{icon:j,position:[e.latitude,e.longitude],key:e.id},l.a.createElement(h.a,{closeButton:!1,minWidth:240,maxWidth:240,className:"map-popup"},e.name,l.a.createElement(o.b,{to:"/orphanages/".concat(e.id)},l.a.createElement(m.b,{size:20,color:"#FFF"}))))}))),l.a.createElement(o.b,{to:"/orphanages/create",className:"create-orphanage"},l.a.createElement(m.e,{size:32,color:"#FFF"})))};a(72),a(73);function O(){var e=Object(i.f)().goBack;return l.a.createElement("aside",{className:"app-sidebar"},l.a.createElement("img",{src:v.a,alt:"Happy"}),l.a.createElement("footer",null,l.a.createElement("button",{type:"button",onClick:e},l.a.createElement(m.a,{size:24,color:"#FFF"}))))}function w(){var e=Object(i.g)(),t=Object(n.useState)(),a=Object(d.a)(t,2),c=a[0],r=a[1],o=Object(n.useState)(0),s=Object(d.a)(o,2),u=s[0],p=s[1];return Object(n.useEffect)((function(){y.get("orphanages/".concat(e.id)).then((function(e){r(e.data)}))}),[e.id]),c?l.a.createElement("div",{id:"page-orphanage"},l.a.createElement(O,null),l.a.createElement("main",null,l.a.createElement("div",{className:"orphanage-details"},l.a.createElement("img",{src:c.images[u].url,alt:c.name}),l.a.createElement("div",{className:"images"},c.images.map((function(e,t){return l.a.createElement("button",{key:e.id,className:u===t?"active":"",type:"button",onClick:function(){p(t)}},l.a.createElement("img",{src:e.url,alt:c.name}))}))),l.a.createElement("div",{className:"orphanage-details-content"},l.a.createElement("h1",null,c.name),l.a.createElement("p",null,c.about,"."),l.a.createElement("div",{className:"map-container"},l.a.createElement(E.a,{center:[c.latitude,c.longitude],zoom:16,style:{width:"100%",height:280},dragging:!1,touchZoom:!1,zoomControl:!1,scrollWheelZoom:!1,doubleClickZoom:!1},l.a.createElement(g.a,{url:"https://api.mapbox.com/styles/v1/mapbox/light-v10/tiles/256/{z}/{x}/{y}@2x?access_token=".concat("pk.eyJ1IjoicmFmYWVsZmFudGluZWwiLCJhIjoiY2tnNzRzejZqMDN4YjJ5bXR0cTVwZGFoNCJ9.5fJAqJ2gNnVmygpfu7Hvzw")}),l.a.createElement(b.a,{interactive:!1,icon:j,position:[c.latitude,c.longitude]})),l.a.createElement("footer",null,l.a.createElement("a",{target:"_blank",rel:"noopener noreferrer",href:"https://www.google.com/maps/dir/?api=1&destination=".concat(c.latitude,",").concat(c.longitude)},"Ver rotas no Google Maps"))),l.a.createElement("hr",null),l.a.createElement("h2",null,"Instru\xe7\xf5es para visita"),l.a.createElement("p",null,c.instructions),l.a.createElement("div",{className:"open-details"},l.a.createElement("div",{className:"hour"},l.a.createElement(m.c,{size:32,color:"#15B6D6"}),"Segunda \xe0 Sexta ",l.a.createElement("br",null),c.opening_hours),c.open_on_weekends?l.a.createElement("div",{className:"open-on-weekends"},l.a.createElement(m.d,{size:32,color:"#39CC83"}),"Atendemos ",l.a.createElement("br",null),"fim de semana"):l.a.createElement("div",{className:"open-on-weekends dont-open"},l.a.createElement(m.d,{size:32,color:"#FF669D"}),"N\xe3o Atendemos ",l.a.createElement("br",null),"fim de semana")))))):l.a.createElement("p",null,"Carregando...")}var z=a(26),C=a.n(z),x=a(40);a(75);function S(){var e=Object(n.useState)({latitude:0,longitude:0}),t=Object(d.a)(e,2),a=t[0],c=t[1],r=Object(i.f)(),o=Object(n.useState)(""),s=Object(d.a)(o,2),u=s[0],p=s[1],h=Object(n.useState)(""),f=Object(d.a)(h,2),v=f[0],N=f[1],k=Object(n.useState)(""),F=Object(d.a)(k,2),w=F[0],z=F[1],S=Object(n.useState)(""),J=Object(d.a)(S,2),Z=J[0],_=J[1],R=Object(n.useState)(!0),V=Object(d.a)(R,2),A=V[0],G=V[1],I=Object(n.useState)([]),W=Object(d.a)(I,2),Y=W[0],D=W[1],L=Object(n.useState)([]),M=Object(d.a)(L,2),H=M[0],q=M[1];function B(){return(B=Object(x.a)(C.a.mark((function e(t){var n,l,c;return C.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.preventDefault(),n=a.latitude,l=a.longitude,(c=new FormData).append("name",u),c.append("about",v),c.append("latitude",String(n)),c.append("longitude",String(l)),c.append("instructions",w),c.append("opening_hours",Z),c.append("open_on_weekends",String(A)),Y.forEach((function(e){c.append("images",e)})),e.next=13,y.post("orphanages",c);case 13:alert("Cadastro Realizado com sucesso"),r.push("/app");case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}return l.a.createElement("div",{id:"page-create-orphanage"},l.a.createElement(O,null),l.a.createElement("main",null,l.a.createElement("form",{onSubmit:function(e){return B.apply(this,arguments)},className:"create-orphanage-form"},l.a.createElement("fieldset",null,l.a.createElement("legend",null,"Dados"),l.a.createElement(E.a,{center:[-29.9067581,-51.2299359],style:{width:"100%",height:280},zoom:15,onClick:function(e){var t=e.latlng,a=t.lat,n=t.lng;c({latitude:a,longitude:n})}},l.a.createElement(g.a,{url:"https://api.mapbox.com/styles/v1/mapbox/light-v10/tiles/256/{z}/{x}/{y}@2x?access_token=".concat("pk.eyJ1IjoicmFmYWVsZmFudGluZWwiLCJhIjoiY2tnNzRzejZqMDN4YjJ5bXR0cTVwZGFoNCJ9.5fJAqJ2gNnVmygpfu7Hvzw")}),0!==a.latitude&&l.a.createElement(b.a,{interactive:!1,icon:j,position:[a.latitude,a.longitude]})),l.a.createElement("div",{className:"input-block"},l.a.createElement("label",{htmlFor:"name"},"Nome"),l.a.createElement("input",{id:"name",value:u,onChange:function(e){return p(e.target.value)}})),l.a.createElement("div",{className:"input-block"},l.a.createElement("label",{htmlFor:"about"},"Sobre ",l.a.createElement("span",null,"M\xe1ximo de 300 caracteres")),l.a.createElement("textarea",{id:"about",maxLength:300,value:v,onChange:function(e){return N(e.target.value)}})),l.a.createElement("div",{className:"input-block"},l.a.createElement("label",{htmlFor:"images"},"Fotos"),l.a.createElement("div",{className:"images-container"},H.map((function(e){return l.a.createElement("img",{key:e,src:e,alt:u})})),l.a.createElement("label",{htmlFor:"image[]",className:"new-image"},l.a.createElement(m.e,{size:24,color:"#15b6d6"}))),l.a.createElement("input",{type:"file",multiple:!0,onChange:function(e){if(e.target.files){var t=Array.from(e.target.files);D(t);var a=t.map((function(e){return URL.createObjectURL(e)}));q(a)}},id:"image[]"}))),l.a.createElement("fieldset",null,l.a.createElement("legend",null,"Visita\xe7\xe3o"),l.a.createElement("div",{className:"input-block"},l.a.createElement("label",{htmlFor:"instructions"},"Instru\xe7\xf5es"),l.a.createElement("textarea",{id:"instructions",value:w,onChange:function(e){return z(e.target.value)}})),l.a.createElement("div",{className:"input-block"},l.a.createElement("label",{htmlFor:"opening_hours"},"Hor\xe1rio de Funcionamento"),l.a.createElement("input",{id:"opening_hours",value:Z,onChange:function(e){return _(e.target.value)}})),l.a.createElement("div",{className:"input-block"},l.a.createElement("label",{htmlFor:"open_on_weekends"},"Atende fim de semana"),l.a.createElement("div",{className:"button-select"},l.a.createElement("button",{type:"button",className:A?"active":"",onClick:function(){return G(!0)}},"Sim"),l.a.createElement("button",{type:"button",className:A?"":"active",onClick:function(){return G(!1)}},"N\xe3o")))),l.a.createElement("button",{className:"confirm-button",type:"submit"},"Confirmar"))))}var J=function(){return l.a.createElement(o.a,null,l.a.createElement(i.c,null,l.a.createElement(i.a,{path:"/",exact:!0,component:p}),l.a.createElement(i.a,{path:"/app",component:F}),l.a.createElement(i.a,{path:"/orphanages/create",component:S}),l.a.createElement(i.a,{path:"/orphanages/:id",component:w})))};var Z=function(){return l.a.createElement(J,null)};r.a.render(l.a.createElement(l.a.StrictMode,null,l.a.createElement(Z,null)),document.getElementById("root"))}},[[41,1,2]]]);
  //# sourceMappingURL=main.009c01b8.chunk.js.map