tomadoro/static/js/main.bca74514.chunk.js

2 lines
6.6 KiB
JavaScript

(this.webpackJsonptomadoro=this.webpackJsonptomadoro||[]).push([[0],{11:function(e,t,n){e.exports=n.p+"static/media/sound.ec792557.mp3"},15:function(e,t,n){e.exports=n.p+"static/media/logo.08ea9508.svg"},19:function(e,t,n){e.exports=n(30)},27:function(e,t,n){},29:function(e,t,n){},30:function(e,t,n){"use strict";n.r(t);var a=n(1),o=n.n(a),i=n(13),r=n.n(i),s=(n(24),n(7)),c=n(8),l=n(10),d=n(9),u=n(33),m=n(31),h=n(32),f=n(4),p=n(14),E=n.n(p),S=n(11),g=n.n(S),b=function(e){Object(l.a)(n,e);var t=Object(d.a)(n);function n(e){var a;return Object(s.a)(this,n),(a=t.call(this,e)).state={ignore:!0,title:""},a.handlePermissionGranted=a.handlePermissionGranted.bind(Object(f.a)(a)),a.handlePermissionDenied=a.handlePermissionDenied.bind(Object(f.a)(a)),a.handleNotSupported=a.handleNotSupported.bind(Object(f.a)(a)),a.sendNotification=a.sendNotification.bind(Object(f.a)(a)),a.handleNotificationOnShow=a.handleNotificationOnShow.bind(Object(f.a)(a)),a.playSound=a.playSound.bind(Object(f.a)(a)),a}return Object(c.a)(n,[{key:"componentDidUpdate",value:function(){this.props.send&&(this.sendNotification(),this.props.handleNotification(!1))}},{key:"handlePermissionGranted",value:function(){this.setState({ignore:!1})}},{key:"handlePermissionDenied",value:function(){this.setState({ignore:!0})}},{key:"handleNotSupported",value:function(){this.setState({ignore:!0})}},{key:"handleNotificationOnError",value:function(e,t){console.log(e,"Notification error tag:"+t)}},{key:"handleNotificationOnShow",value:function(){this.playSound()}},{key:"sendNotification",value:function(){if(!this.state.ignore){var e={tag:Date.now(),body:"Time is Up! \ud83c\udf45",lang:"en",sound:{sound:g.a}};this.setState({title:"tomadoro",options:e})}}},{key:"playSound",value:function(){document.getElementById("sound").play()}},{key:"render",value:function(){return o.a.createElement("div",null,o.a.createElement(E.a,{ignore:this.state.ignore,onPermissionGranted:this.handlePermissionGranted,onPermissionDenied:this.handlePermissionDenied,notSupported:this.handleNotSupported,onError:this.onError,timeout:5e3,title:this.state.title,options:this.state.options,onShow:this.handleNotificationOnShow}),o.a.createElement("audio",{id:"sound",preload:"auto"},o.a.createElement("source",{src:g.a,type:"audio/mpeg"}),o.a.createElement("embed",{hidden:!0,src:g.a})))}}]),n}(a.Component),v=function(){return o.a.createElement("div",{style:{display:"flex",minHeight:"5vh",flexDirection:"column",textAlign:"left",alignItems:"center",justifyContent:"center",fontSize:"44px",color:"white",textShadow:"0 2px 4px #909090",marginBottom:"6px"}},"tomadoro")},O=function(e){return(e-(e%=60))/60+(9<e?":":":0")+e},x=function(e){return o.a.createElement("div",{style:{fontSize:"110px",fontWeight:"normal",color:"white",textShadow:"0 2px 3px #8a8888"}},O(e.seconds))},k=n(15),N=n.n(k),y=(n(27),function(e){return o.a.createElement("img",{className:"App-logo ".concat(e.isStarted?"App-logo-rotation":""),src:N.a,alt:"Tomato",title:"Click on the tomato to change modes",onClick:e.click})}),P=n(34),w=function(e){var t={fontSize:"16px",fontWeight:"lighter",height:"50px",borderRadius:"30px",width:"100%",margin:"4px 0px 4px 0px"};return o.a.createElement("div",{style:{padding:"6px",backgroundColor:"white",borderRadius:"6px",borderBottom:"16px solid #c84132",boxShadow:"0 2px 3px #8a8888"}},o.a.createElement(m.a,null,o.a.createElement(h.a,{xs:"12"},o.a.createElement(P.a,{style:t,block:!0,size:"lg",color:"success",onClick:e.startButton,disabled:e.isStarted||0===e.seconds},"START"))),o.a.createElement(m.a,null,o.a.createElement(h.a,{xs:"6"},o.a.createElement(P.a,{style:t,color:"danger",size:"lg",onClick:e.stopButton,disabled:!e.isStarted},"STOP")),o.a.createElement(h.a,{xs:"6"},o.a.createElement(P.a,{style:t,color:"secondary",size:"lg",onClick:e.resetButton,disabled:e.isStarted},"RESET"))))},j=function(){return o.a.createElement("div",{style:{fontFamily:"Arial, Helvetica, sans-serif",marginTop:"8px",color:"#ffffff",textShadow:"0 2px 3px #a3a3a3"}},o.a.createElement("p",null,o.a.createElement("a",{href:"https://github.com/franjsco/tomadoro"},"tomadoro")," ","by ",o.a.createElement("a",{href:"https://github.com/franjsco"},"Francesco Esposito")))},D=(n(29),function(e){Object(l.a)(n,e);var t=Object(d.a)(n);function n(e){var a;return Object(s.a)(this,n),(a=t.call(this,e)).tick=function(){a.setState((function(e){return{seconds:e.seconds-1}})),document.title="(".concat(O(a.state.seconds),") ").concat(a.APP_NAME),0===a.state.seconds&&(a.stopTimer(),a.finishedTimer())},a.startTimer=function(){a.setState({started:!0,activePopupNotification:!0}),a.interval=setInterval((function(){return a.tick()}),1e3)},a.stopTimer=function(){a.setState({started:!1}),clearInterval(a.interval)},a.resetTimer=function(){a.state.break?a.breakMode():a.pomodoroMode(),document.title=a.APP_NAME},a.finishedTimer=function(){a.setState({sendNotificationFlag:!0}),a.changeMode()},a.changeMode=function(){a.state.break&&!a.state.started?a.pomodoroMode():a.state.break||a.state.started||a.breakMode()},a.pomodoroMode=function(){a.setState({seconds:a.POMODORO_SECONDS,break:!1})},a.breakMode=function(){a.setState({seconds:a.BREAK_SECONDS,break:!0})},a.handleNotification=function(e){a.setState({sendNotificationFlag:e})},a.APP_NAME="tomadoro",a.POMODORO_SECONDS=1500,a.BREAK_SECONDS=300,a.state={seconds:a.POMODORO_SECONDS,started:!1,break:!1,activePopupNotification:!1,sendNotificationFlag:!1},a}return Object(c.a)(n,[{key:"render",value:function(){var e=null;return this.state.activePopupNotification&&(e=o.a.createElement(b,{send:this.state.sendNotificationFlag,handleNotification:this.handleNotification})),o.a.createElement("div",null,e,o.a.createElement(v,null),o.a.createElement(u.a,null,o.a.createElement(m.a,null,o.a.createElement(h.a,null,o.a.createElement(y,{isStarted:this.state.started,click:this.changeMode}))),o.a.createElement(m.a,null,o.a.createElement(h.a,null,o.a.createElement(x,{seconds:this.state.seconds}))),o.a.createElement(m.a,null,o.a.createElement(h.a,{sm:{size:10,offset:1},md:{size:8,offset:2},lg:{size:6,offset:3}},o.a.createElement(w,{startButton:this.startTimer,stopButton:this.stopTimer,resetButton:this.resetTimer,isStarted:this.state.started,seconds:this.state.seconds}))),o.a.createElement(m.a,null,o.a.createElement(h.a,null,o.a.createElement(j,null)))))}}]),n}(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}$/));r.a.render(o.a.createElement(D,null),document.getElementById("root")),"serviceWorker"in navigator&&navigator.serviceWorker.ready.then((function(e){e.unregister()}))}},[[19,1,2]]]);
//# sourceMappingURL=main.bca74514.chunk.js.map