From 23729b3be44f72d54e485af3ca40ffe70a4f2b13 Mon Sep 17 00:00:00 2001 From: Francesco Esposito <33671357+frab1t@users.noreply.github.com> Date: Tue, 16 Apr 2019 12:57:36 +0200 Subject: [PATCH] Updates --- asset-manifest.json | 6 +++--- index.html | 2 +- ... precache-manifest.1628b4be8c3fed43f1860f019a5bf46c.js | 8 ++++---- service-worker.js | 2 +- static/js/main.38d995b8.chunk.js | 2 -- static/js/main.38d995b8.chunk.js.map | 1 - static/js/main.fa5d27bb.chunk.js | 2 ++ static/js/main.fa5d27bb.chunk.js.map | 1 + 8 files changed, 12 insertions(+), 12 deletions(-) rename precache-manifest.8e6c81b713fa0113e90671963c102cde.js => precache-manifest.1628b4be8c3fed43f1860f019a5bf46c.js (78%) delete mode 100644 static/js/main.38d995b8.chunk.js delete mode 100644 static/js/main.38d995b8.chunk.js.map create mode 100644 static/js/main.fa5d27bb.chunk.js create mode 100644 static/js/main.fa5d27bb.chunk.js.map diff --git a/asset-manifest.json b/asset-manifest.json index 20c3533..06e4959 100644 --- a/asset-manifest.json +++ b/asset-manifest.json @@ -1,14 +1,14 @@ { "main.css": "/tomadoro/static/css/main.d0aea8b6.chunk.css", - "main.js": "/tomadoro/static/js/main.38d995b8.chunk.js", - "main.js.map": "/tomadoro/static/js/main.38d995b8.chunk.js.map", + "main.js": "/tomadoro/static/js/main.fa5d27bb.chunk.js", + "main.js.map": "/tomadoro/static/js/main.fa5d27bb.chunk.js.map", "runtime~main.js": "/tomadoro/static/js/runtime~main.c4673ac0.js", "runtime~main.js.map": "/tomadoro/static/js/runtime~main.c4673ac0.js.map", "static/css/2.e75e5890.chunk.css": "/tomadoro/static/css/2.e75e5890.chunk.css", "static/js/2.6c737709.chunk.js": "/tomadoro/static/js/2.6c737709.chunk.js", "static/js/2.6c737709.chunk.js.map": "/tomadoro/static/js/2.6c737709.chunk.js.map", "index.html": "/tomadoro/index.html", - "precache-manifest.8e6c81b713fa0113e90671963c102cde.js": "/tomadoro/precache-manifest.8e6c81b713fa0113e90671963c102cde.js", + "precache-manifest.1628b4be8c3fed43f1860f019a5bf46c.js": "/tomadoro/precache-manifest.1628b4be8c3fed43f1860f019a5bf46c.js", "service-worker.js": "/tomadoro/service-worker.js", "static/css/2.e75e5890.chunk.css.map": "/tomadoro/static/css/2.e75e5890.chunk.css.map", "static/css/main.d0aea8b6.chunk.css.map": "/tomadoro/static/css/main.d0aea8b6.chunk.css.map", diff --git a/index.html b/index.html index 6e939d4..2be8a06 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -tomadoro
\ No newline at end of file +tomadoro
\ No newline at end of file diff --git a/precache-manifest.8e6c81b713fa0113e90671963c102cde.js b/precache-manifest.1628b4be8c3fed43f1860f019a5bf46c.js similarity index 78% rename from precache-manifest.8e6c81b713fa0113e90671963c102cde.js rename to precache-manifest.1628b4be8c3fed43f1860f019a5bf46c.js index 15b9c3d..49878e8 100644 --- a/precache-manifest.8e6c81b713fa0113e90671963c102cde.js +++ b/precache-manifest.1628b4be8c3fed43f1860f019a5bf46c.js @@ -12,15 +12,15 @@ self.__precacheManifest = [ "url": "/tomadoro/static/js/runtime~main.c4673ac0.js" }, { - "revision": "fdf76d6f6f075290a219", - "url": "/tomadoro/static/js/main.38d995b8.chunk.js" + "revision": "0f98716f7aa0a3779edd", + "url": "/tomadoro/static/js/main.fa5d27bb.chunk.js" }, { "revision": "1833adb1901133b31eae", "url": "/tomadoro/static/js/2.6c737709.chunk.js" }, { - "revision": "fdf76d6f6f075290a219", + "revision": "0f98716f7aa0a3779edd", "url": "/tomadoro/static/css/main.d0aea8b6.chunk.css" }, { @@ -28,7 +28,7 @@ self.__precacheManifest = [ "url": "/tomadoro/static/css/2.e75e5890.chunk.css" }, { - "revision": "9b069a5398d4ffcd79dddda411f461e2", + "revision": "f1c8a9441dad97b32a43a2f28ca4d689", "url": "/tomadoro/index.html" } ]; \ No newline at end of file diff --git a/service-worker.js b/service-worker.js index e493156..e9eea50 100644 --- a/service-worker.js +++ b/service-worker.js @@ -14,7 +14,7 @@ importScripts("https://storage.googleapis.com/workbox-cdn/releases/3.6.3/workbox-sw.js"); importScripts( - "/tomadoro/precache-manifest.8e6c81b713fa0113e90671963c102cde.js" + "/tomadoro/precache-manifest.1628b4be8c3fed43f1860f019a5bf46c.js" ); workbox.clientsClaim(); diff --git a/static/js/main.38d995b8.chunk.js b/static/js/main.38d995b8.chunk.js deleted file mode 100644 index 3da4f39..0000000 --- a/static/js/main.38d995b8.chunk.js +++ /dev/null @@ -1,2 +0,0 @@ -(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{12:function(e,t,a){e.exports=a.p+"static/media/sound.ec792557.mp3"},19:function(e,t,a){e.exports=a.p+"static/media/logo.08ea9508.svg"},21:function(e,t,a){e.exports=a(33)},29:function(e,t,a){},30:function(e,t,a){},31:function(e,t,a){},32:function(e,t,a){},33:function(e,t,a){"use strict";a.r(t);var n=a(1),i=a.n(n),o=a(15),s=a.n(o),r=(a(26),a(4)),c=a(5),l=a(7),d=a(6),u=a(8),h=a(2),m=a(36),p=a(34),b=a(35),f=a(16),O=a.n(f),j=a(12),k=a.n(j),v=function(e){function t(e){var a;return Object(r.a)(this,t),(a=Object(l.a)(this,Object(d.a)(t).call(this,e))).state={ignore:!0,title:""},a.handlePermissionGranted=a.handlePermissionGranted.bind(Object(h.a)(Object(h.a)(a))),a.handlePermissionDenied=a.handlePermissionDenied.bind(Object(h.a)(Object(h.a)(a))),a.handleNotSupported=a.handleNotSupported.bind(Object(h.a)(Object(h.a)(a))),a.sendNotification=a.sendNotification.bind(Object(h.a)(Object(h.a)(a))),a.handleNotificationOnShow=a.handleNotificationOnShow.bind(Object(h.a)(Object(h.a)(a))),a.playSound=a.playSound.bind(Object(h.a)(Object(h.a)(a))),a}return Object(u.a)(t,e),Object(c.a)(t,[{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:k.a}};this.setState({title:"tomadoro",options:e})}}},{key:"playSound",value:function(){document.getElementById("sound").play()}},{key:"render",value:function(){return i.a.createElement("div",null,i.a.createElement(O.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}),i.a.createElement("audio",{id:"sound",preload:"auto"},i.a.createElement("source",{src:k.a,type:"audio/mpeg"}),i.a.createElement("embed",{hidden:!0,src:k.a})))}}]),t}(n.Component),E=a(37),N=(a(29),function(e){function t(e){var a;return Object(r.a)(this,t),(a=Object(l.a)(this,Object(d.a)(t).call(this,e))).state={},a}return Object(u.a)(t,e),Object(c.a)(t,[{key:"render",value:function(){return i.a.createElement("div",{className:"box"},i.a.createElement(p.a,null,i.a.createElement(b.a,{xs:"12"},i.a.createElement(E.a,{className:"button",block:!0,size:"lg",color:"success",onClick:this.props.startTimer,disabled:this.props.isStarted||0===this.props.seconds},"START"))),i.a.createElement(p.a,null,i.a.createElement(b.a,{xs:"6",md:"6"},i.a.createElement(E.a,{className:"button",color:"danger",size:"lg",onClick:this.props.stopTimer,disabled:!this.props.isStarted},"STOP")),i.a.createElement(b.a,{xs:"6",md:"6"},i.a.createElement(E.a,{className:"button",color:"secondary",size:"lg",onClick:this.props.resetTimer,disabled:this.props.isStarted},"RESET"))))}}]),t}(n.Component)),y=a(19),S=a.n(y),T=(a(30),function(e){function t(e){var a;return Object(r.a)(this,t),(a=Object(l.a)(this,Object(d.a)(t).call(this,e))).defaultClassName="App-logo-rotation",a}return Object(u.a)(t,e),Object(c.a)(t,[{key:"render",value:function(){return i.a.createElement("img",{className:"App-logo ".concat(this.props.isStarted?this.defaultClassName:""),src:S.a,alt:"Tomato",title:"Click on the tomato to change modes",onClick:this.props.switchMode})}}]),t}(n.Component)),g=(a(31),function(e){function t(e){var a;return Object(r.a)(this,t),(a=Object(l.a)(this,Object(d.a)(t).call(this,e))).appName="tomadoro",a.state={seconds:0,started:!1,break:!1,sendNotification:!1},a.handleNotification=a.handleNotification.bind(Object(h.a)(Object(h.a)(a))),a.startTimer=a.startTimer.bind(Object(h.a)(Object(h.a)(a))),a.stopTimer=a.stopTimer.bind(Object(h.a)(Object(h.a)(a))),a.resetTimer=a.resetTimer.bind(Object(h.a)(Object(h.a)(a))),a.finishedTimer=a.finishedTimer.bind(Object(h.a)(Object(h.a)(a))),a.switchMode=a.switchMode.bind(Object(h.a)(Object(h.a)(a))),a.pomodoroMode=a.pomodoroMode.bind(Object(h.a)(Object(h.a)(a))),a.breakMode=a.breakMode.bind(Object(h.a)(Object(h.a)(a))),a}return Object(u.a)(t,e),Object(c.a)(t,[{key:"componentWillMount",value:function(){this.pomodoroMode()}},{key:"handleNotification",value:function(e){this.setState({sendNotification:e})}},{key:"formatMinute",value:function(e){return(e-(e%=60))/60+(9\n \n \n\n \n \n );\n }\n}\n\nexport default Notification;","import React, { Component } from 'react';\nimport { Button, Row, Col } from 'reactstrap';\nimport './Box.css';\n\nclass Box extends Component {\n\n constructor(props) {\n super(props);\n this.state = {};\n }\n\n render() {\n return (\n
\n \n \n \n START\n \n \n \n \n \n \n STOP\n \n \n \n \n RESET\n \n \n \n
\n );\n }\n }\n \n export default Box;","import React, { Component } from 'react';\nimport logoSVG from '../logo.svg';\nimport './Logo.css';\n\nclass Logo extends Component {\n constructor(props) {\n super(props);\n this.defaultClassName = 'App-logo-rotation';\n }\n\n render() {\n return (\n \n )\n }\n\n}\n\nexport default Logo;","import React, { Component } from 'react';\nimport { Container, Row, Col } from 'reactstrap';\nimport Notification from './Notification';\nimport Box from './Box';\nimport Logo from './Logo';\nimport './Timer.css';\n\nclass Timer extends Component {\n constructor(props) {\n super(props);\n this.appName = 'tomadoro';\n this.state = {\n seconds: 0,\n started: false,\n break: false,\n sendNotification: false\n };\n\n this.handleNotification = this.handleNotification.bind(this);\n this.startTimer = this.startTimer.bind(this);\n this.stopTimer = this.stopTimer.bind(this);\n this.resetTimer = this.resetTimer.bind(this);\n this.finishedTimer = this.finishedTimer.bind(this);\n this.switchMode = this.switchMode.bind(this);\n this.pomodoroMode = this.pomodoroMode.bind(this);\n this.breakMode = this.breakMode.bind(this);\n\n }\n\n componentWillMount() {\n this.pomodoroMode();\n }\n\n\n handleNotification(flag) {\n this.setState({\n sendNotification: flag\n });\n }\n\n formatMinute(s) {\n return (s - (s %= 60)) / 60 + (9 < s ? ':' : ':0') + s;\n }\n \n tick() {\n this.setState(state => ({\n seconds: state.seconds - 1\n }));\n\n document.title=`(${this.formatMinute(this.state.seconds)}) ${this.appName}`; \n\n if (this.state.seconds === 0) {\n this.stopTimer();\n this.finishedTimer();\n }\n }\n\n startTimer() {\n this.setState({\n started: true\n });\n\n this.interval = setInterval(() => this.tick(), 1000);\n }\n\n stopTimer() {\n this.setState({\n started: false\n });\n\n clearInterval(this.interval);\n }\n\n resetTimer() {\n if(this.state.break) {\n this.breakMode();\n } else {\n this.pomodoroMode();\n }\n\n document.title = this.appName;\n }\n\n finishedTimer() {\n this.setState({\n sendNotification: true,\n });\n this.switchMode();\n }\n\n switchMode() {\n if(this.state.break && !this.state.started) {\n this.pomodoroMode();\n } else if(!this.state.break && !this.state.started) {\n this.breakMode();\n }\n }\n\n\n pomodoroMode() {\n const pomodoroSeconds = 1500;\n this.setState({\n seconds: pomodoroSeconds,\n break: false\n });\n }\n\n breakMode() {\n const breakSeconds = 300\n this.setState({\n seconds: breakSeconds,\n break: true\n })\n }\n\n render() { \n return (\n
\n \n \n \n \n \n \n \n \n \n {this.formatMinute(this.state.seconds)}\n

\n \n
\n \n \n \n \n \n
\n\n \n
\n );\n }\n}\n\nexport default Timer;\n","import React, { Component } from 'react';\nimport Timer from './components/Timer';\nimport './App.css';\n\nclass App extends Component {\n render() {\n return (\n
\n \n tomadoro\n
\n \n
\n \n
\n\n \n

\n tomadoro{` `}\n by @frab1t (Francesco Esposito)\n

\n \n \n );\n }\n}\n\nexport default App;\n","// This optional code is used to register a service worker.\n// register() is not called by default.\n\n// This lets the app load faster on subsequent visits in production, and gives\n// it offline capabilities. However, it also means that developers (and users)\n// will only see deployed updates on subsequent visits to a page, after all the\n// existing tabs open on the page have been closed, since previously cached\n// resources are updated in the background.\n\n// To learn more about the benefits of this model and instructions on how to\n// opt-in, read https://bit.ly/CRA-PWA\n\nconst isLocalhost = Boolean(\n window.location.hostname === 'localhost' ||\n // [::1] is the IPv6 localhost address.\n window.location.hostname === '[::1]' ||\n // 127.0.0.1/8 is considered localhost for IPv4.\n window.location.hostname.match(\n /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\n )\n);\n\nexport function register(config) {\n if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\n // The URL constructor is available in all browsers that support SW.\n const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);\n if (publicUrl.origin !== window.location.origin) {\n // Our service worker won't work if PUBLIC_URL is on a different origin\n // from what our page is served on. This might happen if a CDN is used to\n // serve assets; see https://github.com/facebook/create-react-app/issues/2374\n return;\n }\n\n window.addEventListener('load', () => {\n const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\n\n if (isLocalhost) {\n // This is running on localhost. Let's check if a service worker still exists or not.\n checkValidServiceWorker(swUrl, config);\n\n // Add some additional logging to localhost, pointing developers to the\n // service worker/PWA documentation.\n navigator.serviceWorker.ready.then(() => {\n console.log(\n 'This web app is being served cache-first by a service ' +\n 'worker. To learn more, visit https://bit.ly/CRA-PWA'\n );\n });\n } else {\n // Is not localhost. Just register service worker\n registerValidSW(swUrl, config);\n }\n });\n }\n}\n\nfunction registerValidSW(swUrl, config) {\n navigator.serviceWorker\n .register(swUrl)\n .then(registration => {\n registration.onupdatefound = () => {\n const installingWorker = registration.installing;\n if (installingWorker == null) {\n return;\n }\n installingWorker.onstatechange = () => {\n if (installingWorker.state === 'installed') {\n if (navigator.serviceWorker.controller) {\n // At this point, the updated precached content has been fetched,\n // but the previous service worker will still serve the older\n // content until all client tabs are closed.\n console.log(\n 'New content is available and will be used when all ' +\n 'tabs for this page are closed. See https://bit.ly/CRA-PWA.'\n );\n\n // Execute callback\n if (config && config.onUpdate) {\n config.onUpdate(registration);\n }\n } else {\n // At this point, everything has been precached.\n // It's the perfect time to display a\n // \"Content is cached for offline use.\" message.\n console.log('Content is cached for offline use.');\n\n // Execute callback\n if (config && config.onSuccess) {\n config.onSuccess(registration);\n }\n }\n }\n };\n };\n })\n .catch(error => {\n console.error('Error during service worker registration:', error);\n });\n}\n\nfunction checkValidServiceWorker(swUrl, config) {\n // Check if the service worker can be found. If it can't reload the page.\n fetch(swUrl)\n .then(response => {\n // Ensure service worker exists, and that we really are getting a JS file.\n const contentType = response.headers.get('content-type');\n if (\n response.status === 404 ||\n (contentType != null && contentType.indexOf('javascript') === -1)\n ) {\n // No service worker found. Probably a different app. Reload the page.\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister().then(() => {\n window.location.reload();\n });\n });\n } else {\n // Service worker found. Proceed as normal.\n registerValidSW(swUrl, config);\n }\n })\n .catch(() => {\n console.log(\n 'No internet connection found. App is running in offline mode.'\n );\n });\n}\n\nexport function unregister() {\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister();\n });\n }\n}\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport 'bootstrap/dist/css/bootstrap.min.css';\nimport App from './App';\nimport * as serviceWorker from './serviceWorker';\n\nReactDOM.render(, document.getElementById('root'));\n\n// If you want your app to work offline and load faster, you can change\n// unregister() to register() below. Note this comes with some pitfalls.\n// Learn more about service workers: https://bit.ly/CRA-PWA\nserviceWorker.unregister();\n"],"sourceRoot":""} \ No newline at end of file diff --git a/static/js/main.fa5d27bb.chunk.js b/static/js/main.fa5d27bb.chunk.js new file mode 100644 index 0000000..b8d339e --- /dev/null +++ b/static/js/main.fa5d27bb.chunk.js @@ -0,0 +1,2 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{12:function(e,t,a){e.exports=a.p+"static/media/sound.ec792557.mp3"},19:function(e,t,a){e.exports=a.p+"static/media/logo.08ea9508.svg"},21:function(e,t,a){e.exports=a(33)},29:function(e,t,a){},30:function(e,t,a){},31:function(e,t,a){},32:function(e,t,a){},33:function(e,t,a){"use strict";a.r(t);var n=a(1),i=a.n(n),o=a(15),s=a.n(o),r=(a(26),a(4)),c=a(5),l=a(7),d=a(6),u=a(8),h=a(2),m=a(36),p=a(34),b=a(35),f=a(16),O=a.n(f),j=a(12),k=a.n(j),v=function(e){function t(e){var a;return Object(r.a)(this,t),(a=Object(l.a)(this,Object(d.a)(t).call(this,e))).state={ignore:!0,title:""},a.handlePermissionGranted=a.handlePermissionGranted.bind(Object(h.a)(Object(h.a)(a))),a.handlePermissionDenied=a.handlePermissionDenied.bind(Object(h.a)(Object(h.a)(a))),a.handleNotSupported=a.handleNotSupported.bind(Object(h.a)(Object(h.a)(a))),a.sendNotification=a.sendNotification.bind(Object(h.a)(Object(h.a)(a))),a.handleNotificationOnShow=a.handleNotificationOnShow.bind(Object(h.a)(Object(h.a)(a))),a.playSound=a.playSound.bind(Object(h.a)(Object(h.a)(a))),a}return Object(u.a)(t,e),Object(c.a)(t,[{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:k.a}};this.setState({title:"tomadoro",options:e})}}},{key:"playSound",value:function(){document.getElementById("sound").play()}},{key:"render",value:function(){return i.a.createElement("div",null,i.a.createElement(O.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}),i.a.createElement("audio",{id:"sound",preload:"auto"},i.a.createElement("source",{src:k.a,type:"audio/mpeg"}),i.a.createElement("embed",{hidden:!0,src:k.a})))}}]),t}(n.Component),E=a(37),N=(a(29),function(e){function t(e){var a;return Object(r.a)(this,t),(a=Object(l.a)(this,Object(d.a)(t).call(this,e))).state={},a}return Object(u.a)(t,e),Object(c.a)(t,[{key:"render",value:function(){return i.a.createElement("div",{className:"box"},i.a.createElement(p.a,null,i.a.createElement(b.a,{xs:"12"},i.a.createElement(E.a,{className:"button",block:!0,size:"lg",color:"success",onClick:this.props.startTimer,disabled:this.props.isStarted||0===this.props.seconds},"START"))),i.a.createElement(p.a,null,i.a.createElement(b.a,{xs:"6"},i.a.createElement(E.a,{className:"button",color:"danger",size:"lg",onClick:this.props.stopTimer,disabled:!this.props.isStarted},"STOP")),i.a.createElement(b.a,{xs:"6"},i.a.createElement(E.a,{className:"button",color:"secondary",size:"lg",onClick:this.props.resetTimer,disabled:this.props.isStarted},"RESET"))))}}]),t}(n.Component)),y=a(19),S=a.n(y),g=(a(30),function(e){function t(e){var a;return Object(r.a)(this,t),(a=Object(l.a)(this,Object(d.a)(t).call(this,e))).defaultClassName="App-logo-rotation",a}return Object(u.a)(t,e),Object(c.a)(t,[{key:"render",value:function(){return i.a.createElement("img",{className:"App-logo ".concat(this.props.isStarted?this.defaultClassName:""),src:S.a,alt:"Tomato",title:"Click on the tomato to change modes",onClick:this.props.switchMode})}}]),t}(n.Component)),T=(a(31),function(e){function t(e){var a;return Object(r.a)(this,t),(a=Object(l.a)(this,Object(d.a)(t).call(this,e))).appName="tomadoro",a.state={seconds:0,started:!1,break:!1,sendNotification:!1},a.handleNotification=a.handleNotification.bind(Object(h.a)(Object(h.a)(a))),a.startTimer=a.startTimer.bind(Object(h.a)(Object(h.a)(a))),a.stopTimer=a.stopTimer.bind(Object(h.a)(Object(h.a)(a))),a.resetTimer=a.resetTimer.bind(Object(h.a)(Object(h.a)(a))),a.finishedTimer=a.finishedTimer.bind(Object(h.a)(Object(h.a)(a))),a.switchMode=a.switchMode.bind(Object(h.a)(Object(h.a)(a))),a.pomodoroMode=a.pomodoroMode.bind(Object(h.a)(Object(h.a)(a))),a.breakMode=a.breakMode.bind(Object(h.a)(Object(h.a)(a))),a}return Object(u.a)(t,e),Object(c.a)(t,[{key:"componentWillMount",value:function(){this.pomodoroMode()}},{key:"handleNotification",value:function(e){this.setState({sendNotification:e})}},{key:"formatMinute",value:function(e){return(e-(e%=60))/60+(9\n \n \n\n \n \n );\n }\n}\n\nexport default Notification;","import React, { Component } from 'react';\nimport { Button, Row, Col } from 'reactstrap';\nimport './Box.css';\n\nclass Box extends Component {\n\n constructor(props) {\n super(props);\n this.state = {};\n }\n\n render() {\n return (\n
\n \n \n \n START\n \n \n \n \n \n \n STOP\n \n \n \n \n RESET\n \n \n \n
\n );\n }\n }\n \n export default Box;","import React, { Component } from 'react';\nimport logoSVG from '../logo.svg';\nimport './Logo.css';\n\nclass Logo extends Component {\n constructor(props) {\n super(props);\n this.defaultClassName = 'App-logo-rotation';\n }\n\n render() {\n return (\n \n )\n }\n\n}\n\nexport default Logo;","import React, { Component } from 'react';\nimport { Container, Row, Col } from 'reactstrap';\nimport Notification from './Notification';\nimport Box from './Box';\nimport Logo from './Logo';\nimport './Timer.css';\n\nclass Timer extends Component {\n constructor(props) {\n super(props);\n this.appName = 'tomadoro';\n this.state = {\n seconds: 0,\n started: false,\n break: false,\n sendNotification: false\n };\n\n this.handleNotification = this.handleNotification.bind(this);\n this.startTimer = this.startTimer.bind(this);\n this.stopTimer = this.stopTimer.bind(this);\n this.resetTimer = this.resetTimer.bind(this);\n this.finishedTimer = this.finishedTimer.bind(this);\n this.switchMode = this.switchMode.bind(this);\n this.pomodoroMode = this.pomodoroMode.bind(this);\n this.breakMode = this.breakMode.bind(this);\n\n }\n\n componentWillMount() {\n this.pomodoroMode();\n }\n\n\n handleNotification(flag) {\n this.setState({\n sendNotification: flag\n });\n }\n\n formatMinute(s) {\n return (s - (s %= 60)) / 60 + (9 < s ? ':' : ':0') + s;\n }\n \n tick() {\n this.setState(state => ({\n seconds: state.seconds - 1\n }));\n\n document.title=`(${this.formatMinute(this.state.seconds)}) ${this.appName}`; \n\n if (this.state.seconds === 0) {\n this.stopTimer();\n this.finishedTimer();\n }\n }\n\n startTimer() {\n this.setState({\n started: true\n });\n\n this.interval = setInterval(() => this.tick(), 1000);\n }\n\n stopTimer() {\n this.setState({\n started: false\n });\n\n clearInterval(this.interval);\n }\n\n resetTimer() {\n if(this.state.break) {\n this.breakMode();\n } else {\n this.pomodoroMode();\n }\n\n document.title = this.appName;\n }\n\n finishedTimer() {\n this.setState({\n sendNotification: true,\n });\n this.switchMode();\n }\n\n switchMode() {\n if(this.state.break && !this.state.started) {\n this.pomodoroMode();\n } else if(!this.state.break && !this.state.started) {\n this.breakMode();\n }\n }\n\n\n pomodoroMode() {\n const pomodoroSeconds = 1500;\n this.setState({\n seconds: pomodoroSeconds,\n break: false\n });\n }\n\n breakMode() {\n const breakSeconds = 300\n this.setState({\n seconds: breakSeconds,\n break: true\n })\n }\n\n render() { \n return (\n
\n \n \n \n \n \n \n \n \n \n {this.formatMinute(this.state.seconds)}\n

\n \n
\n \n \n \n \n \n
\n\n \n
\n );\n }\n}\n\nexport default Timer;\n","import React, { Component } from 'react';\nimport Timer from './components/Timer';\nimport './App.css';\n\nclass App extends Component {\n render() {\n return (\n
\n \n tomadoro\n
\n \n
\n \n
\n\n \n

\n tomadoro{` `}\n by @frab1t (Francesco Esposito)\n

\n \n \n );\n }\n}\n\nexport default App;\n","// This optional code is used to register a service worker.\n// register() is not called by default.\n\n// This lets the app load faster on subsequent visits in production, and gives\n// it offline capabilities. However, it also means that developers (and users)\n// will only see deployed updates on subsequent visits to a page, after all the\n// existing tabs open on the page have been closed, since previously cached\n// resources are updated in the background.\n\n// To learn more about the benefits of this model and instructions on how to\n// opt-in, read https://bit.ly/CRA-PWA\n\nconst isLocalhost = Boolean(\n window.location.hostname === 'localhost' ||\n // [::1] is the IPv6 localhost address.\n window.location.hostname === '[::1]' ||\n // 127.0.0.1/8 is considered localhost for IPv4.\n window.location.hostname.match(\n /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\n )\n);\n\nexport function register(config) {\n if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\n // The URL constructor is available in all browsers that support SW.\n const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);\n if (publicUrl.origin !== window.location.origin) {\n // Our service worker won't work if PUBLIC_URL is on a different origin\n // from what our page is served on. This might happen if a CDN is used to\n // serve assets; see https://github.com/facebook/create-react-app/issues/2374\n return;\n }\n\n window.addEventListener('load', () => {\n const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\n\n if (isLocalhost) {\n // This is running on localhost. Let's check if a service worker still exists or not.\n checkValidServiceWorker(swUrl, config);\n\n // Add some additional logging to localhost, pointing developers to the\n // service worker/PWA documentation.\n navigator.serviceWorker.ready.then(() => {\n console.log(\n 'This web app is being served cache-first by a service ' +\n 'worker. To learn more, visit https://bit.ly/CRA-PWA'\n );\n });\n } else {\n // Is not localhost. Just register service worker\n registerValidSW(swUrl, config);\n }\n });\n }\n}\n\nfunction registerValidSW(swUrl, config) {\n navigator.serviceWorker\n .register(swUrl)\n .then(registration => {\n registration.onupdatefound = () => {\n const installingWorker = registration.installing;\n if (installingWorker == null) {\n return;\n }\n installingWorker.onstatechange = () => {\n if (installingWorker.state === 'installed') {\n if (navigator.serviceWorker.controller) {\n // At this point, the updated precached content has been fetched,\n // but the previous service worker will still serve the older\n // content until all client tabs are closed.\n console.log(\n 'New content is available and will be used when all ' +\n 'tabs for this page are closed. See https://bit.ly/CRA-PWA.'\n );\n\n // Execute callback\n if (config && config.onUpdate) {\n config.onUpdate(registration);\n }\n } else {\n // At this point, everything has been precached.\n // It's the perfect time to display a\n // \"Content is cached for offline use.\" message.\n console.log('Content is cached for offline use.');\n\n // Execute callback\n if (config && config.onSuccess) {\n config.onSuccess(registration);\n }\n }\n }\n };\n };\n })\n .catch(error => {\n console.error('Error during service worker registration:', error);\n });\n}\n\nfunction checkValidServiceWorker(swUrl, config) {\n // Check if the service worker can be found. If it can't reload the page.\n fetch(swUrl)\n .then(response => {\n // Ensure service worker exists, and that we really are getting a JS file.\n const contentType = response.headers.get('content-type');\n if (\n response.status === 404 ||\n (contentType != null && contentType.indexOf('javascript') === -1)\n ) {\n // No service worker found. Probably a different app. Reload the page.\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister().then(() => {\n window.location.reload();\n });\n });\n } else {\n // Service worker found. Proceed as normal.\n registerValidSW(swUrl, config);\n }\n })\n .catch(() => {\n console.log(\n 'No internet connection found. App is running in offline mode.'\n );\n });\n}\n\nexport function unregister() {\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister();\n });\n }\n}\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport 'bootstrap/dist/css/bootstrap.min.css';\nimport App from './App';\nimport * as serviceWorker from './serviceWorker';\n\nReactDOM.render(, document.getElementById('root'));\n\n// If you want your app to work offline and load faster, you can change\n// unregister() to register() below. Note this comes with some pitfalls.\n// Learn more about service workers: https://bit.ly/CRA-PWA\nserviceWorker.unregister();\n"],"sourceRoot":""} \ No newline at end of file