text: (window["webpackJsonpmental-health"]=window["webpackJsonpmental-health"]||[]).push([[0],{143:function(e,t,a){e.exports=a(309)},287:function(e,t,a){},305:function(e,t,a){},306:function(e,t,a){},309:function(e,t,a){"use strict";a.r(t);var n=a(0),o=a.n(n),r=a(34),c=a.n(r),i=a(9),l=a(10),s=a(12),u=a(11),d=a(13),b=a(27),p=a(89),h=a(3),m=a(38),x=a.n(m),g=a(131),f=a(132),y=a(133),k=a(134),j=a(135),v=a(136),E=a.n(v),C=function(e){function t(e){var a;return Object(i.a)(this,t),(a=Object(s.a)(this,Object(u.a)(t).call(this,e))).onChange=function(e){var t=e.value;a.setState({value:t}),console.log(a.state.value)},a.onKeyDown=function(e,t){if(e.ctrlKey)switch(e.preventDefault(),e.key){case"b":return t.toggleMark("bold"),!0;case"i":return t.toggleMark("italic"),!0;case"c":return t.toggleMark("code"),!0;case"l":return t.toggleMark("list"),!0;case"u":return t.toggleMark("underline"),!0;default:return}},a.renderMark=function(e){switch(e.mark.type){case"bold":return o.a.createElement(O,e);case"italic":return o.a.createElement(w,e);case"code":return o.a.createElement("code",e.attributes,e.children);case"list":return o.a.createElement("ul",e.attributes,o.a.createElement("li",null,e.children));case"underline":return o.a.createElement("u",e.attributes,e.children);default:return}},a.onMarkClick=function(e,t){e.preventDefault();var n=a.state.value.change().toggleMark(t);a.onChange(n)},a.state={value:h.n.fromJSON(a.props.jsonData)},a.submitEntry=a.submitEntry.bind(Object(b.a)(a)),a}return Object(d.a)(t,e),Object(l.a)(t,[{key:"submitEntry",value:function(){var e=new XMLHttpRequest;e.addEventListener("load",(function(){})),e.open("POST","/new_post?title=testTitle&content="+this.state.value.document.text),console.log(this.state.value.document.text),e.send(),window.location.reload()}},{key:"render",value:function(){var e=this;return"True"==this.props.editable?o.a.createElement("div",null,o.a.createElement(n.Fragment,null,o.a.createElement(S,null,o.a.createElement("button",{onPointerDown:function(t){return e.onMarkClick(t,"bold")},className:"tooltip-icon-button"},o.a.createElement(x.a,{icon:g.bold})),o.a.createElement("button",{onPointerDown:function(t){return e.onMarkClick(t,"italic")},className:"tooltip-icon-button"},o.a.createElement(x.a,{icon:f.italic})),o.a.createElement("button",{onPointerDown:function(t){return e.onMarkClick(t,"code")},className:"tooltip-icon-button"},o.a.createElement(x.a,{icon:y.code})),o.a.createElement("button",{onPointerDown:function(t){return e.onMarkClick(t,"list")},className:"tooltip-icon-button"},o.a.createElement(x.a,{icon:k.list})),o.a.createElement("button",{onPointerDown:function(t){return e.onMarkClick(t,"underline")},className:"tooltip-icon-button"},o.a.createElement(x.a,{icon:j.underline}))),o.a.createElement(p.a,{value:this.state.value,onChange:this.onChange,onKeyDown:this.onKeyDown,renderMark:this.renderMark}),o.a.createElement(E.a,{variant:"success",onClick:this.submitEntry,style:{margin:"20px"}},"Submit"))):o.a.createElement(n.Fragment,null,o.a.createElement(p.a,{value:this.state.value,onChange:this.onChange,onKeyDown:this.onKeyDown,renderMark:this.renderMark,readOnly:!0}))}}]),t}(n.Component),O=function(e){return o.a.createElement("strong",null,e.children)},w=function(e){return o.a.createElement("em",{property:"italic",style:{fontSize:28}},e.children)},S=function(e){return o.a.createElement("div",{className:"format-toolbar"},e.children)},D=function(e){function t(){var e,a;Object(i.a)(this,t);for(var n=arguments.length,o=new Array(n),r=0;r<n;r++)o[r]=arguments[r];return(a=Object(s.a)(this,(e=Object(u.a)(t)).call.apply(e,[this].concat(o)))).state={editing:!1,jsonData:{object:"value",document:{object:"document",nodes:[{object:"block",type:"paragraph",nodes:[{object:"text",text:"This is editable "},{object:"text",text:"rich",marks:[{type:"bold"}]},{object:"text",text:" text, "},{object:"text",text:"much",marks:[{type:"italic"}]},{object:"text",text:" better than a "},{object:"text",text:"<textarea>",marks:[{type:"code"}]},{object:"text",text:"!"}]},{object:"block",type:"paragraph",nodes:[{object:"text",text:"Since it's rich text, you can do things like turn a selection of text "},{object:"text",text:"bold",marks:[{type:"bold"}]},{object:"text",text:", or add a semantically rendered block quote in the middle of the page, like this:"}]},{object:"block",type:"block-quote",nodes:[{object:"text",text:"A wise quote."}]},{object:"block",type:"paragraph",nodes:[{object:"text",text:"Try it out for yourself!"}]}]}}},a.myFunction=function(e){a.setState({editing:!0})},a}return Object(d.a)(t,e),Object(l.a)(t,[{key:"render",value:function(){return this.state.editing?o.a.createElement("div",{style:{color:"rgb(17, 17, 17)",maxWidth:"740px",backgroundColor:"rgb(255, 255, 255)",boxShadow:"rgba(118, 143, 255, 0.1) 0px 16px 24px 0px",padding:"20px",margin:"25px auto 25px",borderRadius:"4.5px"}},o.a.createElement(C,{editable:this.props.editable,jsonData:{object:"value",document:{object:"document",nodes:[{object:"block",type:"paragraph",nodes:[{object:"text",text:"This is editable "},{object:"text",text:"rich",marks:[{type:"bold"}]},{object:"text",text:" text, "},{object:"text",text:"much",marks:[{type:"italic"}]},{object:"text",text:" better than a "},{object:"text",text:"<textarea>",marks:[{type:"code"}]},{object:"text",text:"!"}]},{object:"block",type:"paragraph",nodes:[{object:"text",text:"Since it's rich text, you can do things like turn a selection of text "},{object:"text",text:"bold",marks:[{type:"bold"}]},{object:"text",text:", or add a semantically rendered block quote in the middle of the page, like this:"}]},{object:"block",type:"block-quote",nodes:[{object:"text",text:"A wise quote."}]},{object:"block",type:"paragraph",nodes:[{object:"text",text:"Try it out for yourself!"}]}]}}})):o.a.createElement("div",{style:{color:"rgb(17, 17, 17)",maxWidth:"740px",backgroundColor:"rgb(255, 255, 255)",boxShadow:"rgba(118, 143, 255, 0.1) 0px 16px 24px 0px",padding:"20px",margin:"25px auto 25px",borderRadius:"4.5px"},onClick:this.myFunction},o.a.createElement("h1",null,this.props.title," | ",this.props.rating),o.a.createElement("h3",null,this.props.date))}}]),t}(n.Component),M=a(137),F=(a(287),function(e){function t(e){var a;return Object(i.a)(this,t),(a=Object(s.a)(this,Object(u.a)(t).call(this,e))).state={options:{legend:{display:!1}},posts:[],entryDate:[],entryScore:[]},a}return Object(d.a)(t,e),Object(l.a)(t,[{key:"componentDidMount",value:function(){var e=this;fetch("http://mental-health-api.herokuapp.com/get_calendar").then((function(e){return e.json()})).then((function(t){for(var a=t.posts,n=[],o=[],r=0;r<a.length;r++)console.log(a[r].date),console.log(a[r].score),n.push(a[r].date),o.push(a[r].score);e.setState({posts:a,entryDate:n,entryScore:o})}))}},{key:"render",value:function(){var e=this;return o.a.createElement("div",null,o.a.createElement("h1",{className:"text-center"},"Your mood graph!"),o.a.createElement(M.a,{data:function(t){var a=t.getContext("2d").createLinearGradient(500,0,100,0);return a.addColorStop(0,"#80b6f4"),a.addColorStop(.2,"#94d973"),a.addColorStop(.5,"#fad874"),a.addColorStop(1,"#f49080"),{labels:e.state.entryDate,datasets:[{label:"Mood Chart",fill:!1,lineTension:.1,backgroundColor:a,borderColor:a,borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",pointBorderColor:a,pointBackgroundColor:a,pointBorderWidth:1,pointHoverRadius:5,pointHoverBackgroundColor:a,pointHoverBorderColor:"rgba(220,220,220,1)",pointHoverBorderWidth:2,pointRadius:1,pointHitRadius:10,data:e.state.entryScore}]}},options:this.state.options,redraw:!0}))}}]),t}(n.Component)),N=a(139),W=a.n(N),H=(a(305),function(e){function t(e){var a;return Object(i.a)(this,t),(a=Object(s.a)(this,Object(u.a)(t).call(this,e))).state={today:new Date,selectedDate:new Date,posts:[]},a.onClickDay=a.onClickDay.bind(Object(b.a)(a)),a.setMoodColor=a.setMoodColor.bind(Object(b.a)(a)),a}return Object(d.a)(t,e),Object(l.a)(t,[{key:"componentDidMount",value:function(){var e=this;fetch("http://mental-health-api.herokuapp.com/get_calendar").then((function(e){return e.json()})).then((function(t){var a=t.posts;e.setState({posts:a})}))}},{key:"onClickDay",value:function(e){this.setState({selectedDate:e})}},{key:"setMoodColor",value:function(e){for(var t,a=e.date,n=new Date(a).toISOString().substr(0,10),o=0;o<this.state.posts.length;o++)if(console.log(this.state.posts[o].date),this.state.posts[o].date===n){t=this.state.posts[o].score;break}return t>=85?"great-mood":t>=65?"good-mood":t>=45?"ok-mood":"bad-mood"}},{key:"render",value:function(){return o.a.createElement("div",null,o.a.createElement("h1",{className:"text-center"},"Your mood calendar!"),o.a.createElement(W.a,{key:Math.random().toString(),maxDate:this.state.today,onClickDay:this.onClickDay,tileClassName:this.setMoodColor,className:"w-100"}))}}]),t}(n.Component)),R=function(e){function t(e){var a;return Object(i.a)(this,t),(a=Object(s.a)(this,Object(u.a)(t).call(this,e))).state={entries:[]},a}return Object(d.a)(t,e),Object(l.a)(t,[{key:"componentDidMount",value:function(){var e=this;fetch("/user").then((function(e){return e.json()})).then((function(t){console.log(t);for(var a=[],n=0;n<t.posts.length;n++){console.log(t.posts[n]);var o={title:t.posts[n].entry.substring(0,50),date:t.posts[n].date,score:t.posts[n].score};a.unshift(o)}console.log(a),e.setState({entries:a})}))}},{key:"render",value:function(){var e=this.state.entries.map((function(e){return o.a.createElement(D,{title:e.title,rating:e.score+"%",date:e.date,editable:"False"})}));return o.a.createElement("div",null,e)}}]),t}(o.a.Component),T=function(e){function t(){return Object(i.a)(this,t),Object(s.a)(this,Object(u.a)(t).apply(this,arguments))}return Object(d.a)(t,e),Object(l.a)(t,[{key:"render",value:function(){return o.a.createElement("div",null,o.a.createElement("div",{style:{width:"40%",padding:"5%",float:"left"}},o.a.createElement("div",{style:{color:"rgb(17, 17, 17)",maxWidth:"740px",backgroundColor:"rgb(255, 255, 255)",boxShadow:"rgba(118, 143, 255, 0.1) 0px 16px 24px 0px",padding:"20px",margin:"25px auto 25px",borderRadius:"4.5px"}},o.a.createElement(F,null)),o.a.createElement("div",{style:{color:"rgb(17, 17, 17)",maxWidth:"740px",backgroundColor:"rgb(255, 255, 255)",boxShadow:"rgba(118, 143, 255, 0.1) 0px 16px 24px 0px",padding:"20px",margin:"25px auto 25px",borderRadius:"4.5px"}},o.a.createElement(H,null))),o.a.createElement("div",{style:{width:"40%",padding:"5%",float:"left"}},o.a.createElement(D,{title:"+ Create New Post",editable:"True"}),o.a.createElement(R,null),o.a.createElement(D,{title:"Went to my First Hackathon!",rating:"84%",date:"September 3rd, 2018",editable:"False"}),o.a.createElement(D,{title:"Won my First Hackathon",rating:"100%",date:"September 3rd, 2018",editable:"False"}),o.a.createElement(D,{title:"School is hard",rating:"22%",date:"September 3rd, 2018",editable:"False"}),o.a.createElement(D,{title:"Went to my First Hackathon!",rating:"84%",date:"September 3rd, 2018",editable:"False"}),o.a.createElement(D,{title:"Won my First Hackathon",rating:"100%",date:"September 3rd, 2018",editable:"False"}),o.a.createElement(D,{title:"School is hard",rating:"22%",date:"September 3rd, 2018",editable:"False"})))}}]),t}(o.a.Component);Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));var B=a(140),q=a(25),P=function(e){function t(){return Object(i.a)(this,t),Object(s.a)(this,Object(u.a)(t).apply(this,arguments))}return Object(d.a)(t,e),Object(l.a)(t,[{key:"render",value:function(){return o.a.createElement("div",null,o.a.createElement("h1",null,"Login"))}}]),t}(o.a.Component),K=function(e){function t(){return Object(i.a)(this,t),Object(s.a)(this,Object(u.a)(t).apply(this,arguments))}return Object(d.a)(t,e),Object(l.a)(t,[{key:"render",value:function(){return o.a.createElement("div",null,o.a.createElement("h1",null,"Register"))}}]),t}(o.a.Component),J=(a(306),o.a.createElement(B.a,{basename:"#"},o.a.createElement(q.a,{exact:!0,path:"/",component:T}),o.a.createElement(q.a,{path:"/login",component:P}),o.a.createElement(q.a,{path:"/register",component:K})));c.a.render(J,document.getElementById("root")),"serviceWorker"in navigator&&navigator.serviceWorker.ready.then((function(e){e.unregister()}))}},[[143,1,2]]]);
  //# sourceMappingURL=main.82da902d.chunk.js.map