mirror of
https://github.com/TrentSPalmer/fcc-challenges.git
synced 2026-11-09 18:35:09 -08:00
add pomodoro-clock-react
This commit is contained in:
1 parent
01bbb2d626
commit
f3b0a0721a
59 files changed
+15628
No files matched your search
@@ -0,0 +1,23 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
# /build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
@@ -0,0 +1,80 @@
|
||||
### Drum-Machine-React Project Links
|
||||
|
||||
* [GitHub Page View of this Repo](https://trentspalmer.github.io/fcc-challenges)
|
||||
* [GitHub Page View of this Project (pomodoro-clock-react)](https://trentspalmer.github.io/fcc-challenges/pomodoro-clock-react/build)
|
||||
|
||||
### FreeCodeCamp Links
|
||||
|
||||
* [FreeCodeCamp Instruction for This Project](https://www.freecodecamp.org/learn/front-end-libraries/front-end-libraries-projects/build-a-pomodoro-clock)
|
||||
* [FreeCodeCamp Section](https://www.freecodecamp.org/learn/front-end-libraries/front-end-libraries-projects)
|
||||
|
||||
---
|
||||
|
||||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
||||
|
||||
## Available Scripts
|
||||
|
||||
In the project directory, you can run:
|
||||
|
||||
### `npm start`
|
||||
|
||||
Runs the app in the development mode.<br />
|
||||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
||||
|
||||
The page will reload if you make edits.<br />
|
||||
You will also see any lint errors in the console.
|
||||
|
||||
### `npm test`
|
||||
|
||||
Launches the test runner in the interactive watch mode.<br />
|
||||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
||||
|
||||
### `npm run build`
|
||||
|
||||
Builds the app for production to the `build` folder.<br />
|
||||
It correctly bundles React in production mode and optimizes the build for the best performance.
|
||||
|
||||
The build is minified and the filenames include the hashes.<br />
|
||||
Your app is ready to be deployed!
|
||||
|
||||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
||||
|
||||
### `npm run eject`
|
||||
|
||||
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
|
||||
|
||||
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
||||
|
||||
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
|
||||
|
||||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
|
||||
|
||||
## Learn More
|
||||
|
||||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
||||
|
||||
To learn React, check out the [React documentation](https://reactjs.org/).
|
||||
|
||||
### Code Splitting
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
|
||||
|
||||
### Analyzing the Bundle Size
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
|
||||
|
||||
### Making a Progressive Web App
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
|
||||
|
||||
### Advanced Configuration
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
|
||||
|
||||
### Deployment
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
|
||||
|
||||
### `npm run build` fails to minify
|
||||
|
||||
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"files": {
|
||||
"main.css": "/fcc-challenges/pomodoro-clock-react/build/static/css/main.1b8ac635.chunk.css",
|
||||
"main.js": "/fcc-challenges/pomodoro-clock-react/build/static/js/main.157adc9f.chunk.js",
|
||||
"main.js.map": "/fcc-challenges/pomodoro-clock-react/build/static/js/main.157adc9f.chunk.js.map",
|
||||
"runtime-main.js": "/fcc-challenges/pomodoro-clock-react/build/static/js/runtime-main.601eb45a.js",
|
||||
"runtime-main.js.map": "/fcc-challenges/pomodoro-clock-react/build/static/js/runtime-main.601eb45a.js.map",
|
||||
"static/js/2.9a920135.chunk.js": "/fcc-challenges/pomodoro-clock-react/build/static/js/2.9a920135.chunk.js",
|
||||
"static/js/2.9a920135.chunk.js.map": "/fcc-challenges/pomodoro-clock-react/build/static/js/2.9a920135.chunk.js.map",
|
||||
"index.html": "/fcc-challenges/pomodoro-clock-react/build/index.html",
|
||||
"precache-manifest.54ac6025f5b442b201d5113579ebf9b3.js": "/fcc-challenges/pomodoro-clock-react/build/precache-manifest.54ac6025f5b442b201d5113579ebf9b3.js",
|
||||
"service-worker.js": "/fcc-challenges/pomodoro-clock-react/build/service-worker.js",
|
||||
"static/css/main.1b8ac635.chunk.css.map": "/fcc-challenges/pomodoro-clock-react/build/static/css/main.1b8ac635.chunk.css.map",
|
||||
"static/js/2.9a920135.chunk.js.LICENSE.txt": "/fcc-challenges/pomodoro-clock-react/build/static/js/2.9a920135.chunk.js.LICENSE.txt",
|
||||
"static/media/BeepSound.ogg": "/fcc-challenges/pomodoro-clock-react/build/static/media/BeepSound.049fe0d0.ogg"
|
||||
},
|
||||
"entrypoints": [
|
||||
"static/js/runtime-main.601eb45a.js",
|
||||
"static/js/2.9a920135.chunk.js",
|
||||
"static/css/main.1b8ac635.chunk.css",
|
||||
"static/js/main.157adc9f.chunk.js"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="#"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/fcc-challenges/pomodoro-clock-react/build/logo192.png"/><link rel="manifest" href="/fcc-challenges/pomodoro-clock-react/build/manifest.json"/><link href="https://fonts.googleapis.com/css2?family=Ubuntu:wght@500&display=swap" rel="stylesheet"><title>Pomodoro Clock React - Build a Pomodoro Clock - Front End Libraries Projects</title><link href="/fcc-challenges/pomodoro-clock-react/build/static/css/main.1b8ac635.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"><div><script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script></div></div><script>!function(e){function r(r){for(var o,u,l=r[0],a=r[1],p=r[2],i=0,s=[];i<l.length;i++)u=l[i],Object.prototype.hasOwnProperty.call(n,u)&&n[u]&&s.push(n[u][0]),n[u]=0;for(o in a)Object.prototype.hasOwnProperty.call(a,o)&&(e[o]=a[o]);for(f&&f(r);s.length;)s.shift()();return c.push.apply(c,p||[]),t()}function t(){for(var e,r=0;r<c.length;r++){for(var t=c[r],o=!0,l=1;l<t.length;l++){var a=t[l];0!==n[a]&&(o=!1)}o&&(c.splice(r--,1),e=u(u.s=t[0]))}return e}var o={},n={1:0},c=[];function u(r){if(o[r])return o[r].exports;var t=o[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,u),t.l=!0,t.exports}u.m=e,u.c=o,u.d=function(e,r,t){u.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,r){if(1&r&&(e=u(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(u.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)u.d(t,o,function(r){return e[r]}.bind(null,o));return t},u.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(r,"a",r),r},u.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},u.p="/fcc-challenges/pomodoro-clock-react/build/";var l=this["webpackJsonppomodoro-clock-react"]=this["webpackJsonppomodoro-clock-react"]||[],a=l.push.bind(l);l.push=r,l=l.slice();for(var p=0;p<l.length;p++)r(l[p]);var f=a;t()}([])</script><script src="/fcc-challenges/pomodoro-clock-react/build/static/js/2.9a920135.chunk.js"></script><script src="/fcc-challenges/pomodoro-clock-react/build/static/js/main.157adc9f.chunk.js"></script></body></html>
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"short_name": "React App",
|
||||
"name": "Create React App Sample",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "logo192.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "logo512.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
self.__precacheManifest = (self.__precacheManifest || []).concat([
|
||||
{
|
||||
"revision": "d4480af81858bd79f0f992fbce881761",
|
||||
"url": "/fcc-challenges/pomodoro-clock-react/build/index.html"
|
||||
},
|
||||
{
|
||||
"revision": "52721a53958abb4c9a3a",
|
||||
"url": "/fcc-challenges/pomodoro-clock-react/build/static/css/main.1b8ac635.chunk.css"
|
||||
},
|
||||
{
|
||||
"revision": "a8ccb8073b63549a8872",
|
||||
"url": "/fcc-challenges/pomodoro-clock-react/build/static/js/2.9a920135.chunk.js"
|
||||
},
|
||||
{
|
||||
"revision": "c64c486544348f10a6d6c716950bc223",
|
||||
"url": "/fcc-challenges/pomodoro-clock-react/build/static/js/2.9a920135.chunk.js.LICENSE.txt"
|
||||
},
|
||||
{
|
||||
"revision": "52721a53958abb4c9a3a",
|
||||
"url": "/fcc-challenges/pomodoro-clock-react/build/static/js/main.157adc9f.chunk.js"
|
||||
},
|
||||
{
|
||||
"revision": "8cfbad2a32123298c100",
|
||||
"url": "/fcc-challenges/pomodoro-clock-react/build/static/js/runtime-main.601eb45a.js"
|
||||
},
|
||||
{
|
||||
"revision": "049fe0d053c2b8d3dcdf7c15abed110d",
|
||||
"url": "/fcc-challenges/pomodoro-clock-react/build/static/media/BeepSound.049fe0d0.ogg"
|
||||
}
|
||||
]);
|
||||
@@ -0,0 +1,3 @@
|
||||
# https://www.robotstxt.org/robotstxt.html
|
||||
User-agent: *
|
||||
Disallow:
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Welcome to your Workbox-powered service worker!
|
||||
*
|
||||
* You'll need to register this file in your web app and you should
|
||||
* disable HTTP caching for this file too.
|
||||
* See https://goo.gl/nhQhGp
|
||||
*
|
||||
* The rest of the code is auto-generated. Please don't update this file
|
||||
* directly; instead, make changes to your Workbox build configuration
|
||||
* and re-run your build process.
|
||||
* See https://goo.gl/2aRDsh
|
||||
*/
|
||||
|
||||
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
|
||||
|
||||
importScripts(
|
||||
"/fcc-challenges/pomodoro-clock-react/build/precache-manifest.54ac6025f5b442b201d5113579ebf9b3.js"
|
||||
);
|
||||
|
||||
self.addEventListener('message', (event) => {
|
||||
if (event.data && event.data.type === 'SKIP_WAITING') {
|
||||
self.skipWaiting();
|
||||
}
|
||||
});
|
||||
|
||||
workbox.core.clientsClaim();
|
||||
|
||||
/**
|
||||
* The workboxSW.precacheAndRoute() method efficiently caches and responds to
|
||||
* requests for URLs in the manifest.
|
||||
* See https://goo.gl/S9QRab
|
||||
*/
|
||||
self.__precacheManifest = [].concat(self.__precacheManifest || []);
|
||||
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
|
||||
|
||||
workbox.routing.registerNavigationRoute(workbox.precaching.getCacheKeyForURL("/fcc-challenges/pomodoro-clock-react/build/index.html"), {
|
||||
|
||||
blacklist: [/^\/_/,/\/[^/?]+\.[^/]+$/],
|
||||
});
|
||||
@@ -0,0 +1,2 @@
|
||||
body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;overflow:hidden}code{font-family:source-code-pro,Menlo,Monaco,Consolas,"Courier New",monospace}
|
||||
/*# sourceMappingURL=main.1b8ac635.chunk.css.map */
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["index.css"],"names":[],"mappings":"AAAA,KACE,QAAS,CACT,mJAEY,CACZ,kCAAmC,CACnC,iCAAkC,CAClC,eACF,CAEA,KACE,yEAEF","file":"main.1b8ac635.chunk.css","sourcesContent":["body {\n margin: 0;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',\n 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',\n sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n overflow: hidden;\n}\n\ncode {\n font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',\n monospace;\n}\n"]}
|
||||
@@ -0,0 +1,3 @@
|
||||
/*! For license information please see 2.9a920135.chunk.js.LICENSE.txt */
|
||||
(this["webpackJsonppomodoro-clock-react"]=this["webpackJsonppomodoro-clock-react"]||[]).push([[2],[function(e,t,n){"use strict";e.exports=n(22)},function(e,t,n){e.exports=n(26)()},function(e,t,n){"use strict";function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return o})),n.d(t,"c",(function(){return i})),n.d(t,"d",(function(){return a})),n.d(t,"e",(function(){return l}));var r={prefix:"fas",iconName:"arrow-circle-down",icon:[512,512,[],"f0ab","M504 256c0 137-111 248-248 248S8 393 8 256 119 8 256 8s248 111 248 248zm-143.6-28.9L288 302.6V120c0-13.3-10.7-24-24-24h-16c-13.3 0-24 10.7-24 24v182.6l-72.4-75.5c-9.3-9.7-24.8-9.9-34.3-.4l-10.9 11c-9.4 9.4-9.4 24.6 0 33.9L239 404.3c9.4 9.4 24.6 9.4 33.9 0l132.7-132.7c9.4-9.4 9.4-24.6 0-33.9l-10.9-11c-9.5-9.5-25-9.3-34.3.4z"]},o={prefix:"fas",iconName:"arrow-circle-up",icon:[512,512,[],"f0aa","M8 256C8 119 119 8 256 8s248 111 248 248-111 248-248 248S8 393 8 256zm143.6 28.9l72.4-75.5V392c0 13.3 10.7 24 24 24h16c13.3 0 24-10.7 24-24V209.4l72.4 75.5c9.3 9.7 24.8 9.9 34.3.4l10.9-11c9.4-9.4 9.4-24.6 0-33.9L273 107.7c-9.4-9.4-24.6-9.4-33.9 0L106.3 240.4c-9.4 9.4-9.4 24.6 0 33.9l10.9 11c9.6 9.5 25.1 9.3 34.4-.4z"]},i={prefix:"fas",iconName:"pause-circle",icon:[512,512,[],"f28b","M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm-16 328c0 8.8-7.2 16-16 16h-48c-8.8 0-16-7.2-16-16V176c0-8.8 7.2-16 16-16h48c8.8 0 16 7.2 16 16v160zm112 0c0 8.8-7.2 16-16 16h-48c-8.8 0-16-7.2-16-16V176c0-8.8 7.2-16 16-16h48c8.8 0 16 7.2 16 16v160z"]},a={prefix:"fas",iconName:"play-circle",icon:[512,512,[],"f144","M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm115.7 272l-176 101c-15.8 8.8-35.7-2.5-35.7-21V152c0-18.4 19.8-29.8 35.7-21l176 107c16.4 9.2 16.4 32.9 0 42z"]},l={prefix:"fas",iconName:"sync-alt",icon:[512,512,[],"f2f1","M370.72 133.28C339.458 104.008 298.888 87.962 255.848 88c-77.458.068-144.328 53.178-162.791 126.85-1.344 5.363-6.122 9.15-11.651 9.15H24.103c-7.498 0-13.194-6.807-11.807-14.176C33.933 94.924 134.813 8 256 8c66.448 0 126.791 26.136 171.315 68.685L463.03 40.97C478.149 25.851 504 36.559 504 57.941V192c0 13.255-10.745 24-24 24H345.941c-21.382 0-32.09-25.851-16.971-40.971l41.75-41.749zM32 296h134.059c21.382 0 32.09 25.851 16.971 40.971l-41.75 41.75c31.262 29.273 71.835 45.319 114.876 45.28 77.418-.07 144.315-53.144 162.787-126.849 1.344-5.363 6.122-9.15 11.651-9.15h57.304c7.498 0 13.194 6.807 11.807 14.176C478.067 417.076 377.187 504 256 504c-66.448 0-126.791-26.136-171.315-68.685L48.97 471.03C33.851 486.149 8 475.441 8 454.059V320c0-13.255 10.745-24 24-24z"]}},function(e,t,n){"use strict";n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return W}));var r=n(0),o=n.n(r),i=(n(1),o.a.createContext(null));var a=function(e){e()},l={notify:function(){}};function u(){var e=a,t=null,n=null;return{clear:function(){t=null,n=null},notify:function(){e((function(){for(var e=t;e;)e.callback(),e=e.next}))},get:function(){for(var e=[],n=t;n;)e.push(n),n=n.next;return e},subscribe:function(e){var r=!0,o=n={callback:e,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){r&&null!==t&&(r=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}var c=function(){function e(e,t){this.store=e,this.parentSub=t,this.unsubscribe=null,this.listeners=l,this.handleChangeWrapper=this.handleChangeWrapper.bind(this)}var t=e.prototype;return t.addNestedSub=function(e){return this.trySubscribe(),this.listeners.subscribe(e)},t.notifyNestedSubs=function(){this.listeners.notify()},t.handleChangeWrapper=function(){this.onStateChange&&this.onStateChange()},t.isSubscribed=function(){return Boolean(this.unsubscribe)},t.trySubscribe=function(){this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.handleChangeWrapper):this.store.subscribe(this.handleChangeWrapper),this.listeners=u())},t.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=l)},e}();var s=function(e){var t=e.store,n=e.context,a=e.children,l=Object(r.useMemo)((function(){var e=new c(t);return e.onStateChange=e.notifyNestedSubs,{store:t,subscription:e}}),[t]),u=Object(r.useMemo)((function(){return t.getState()}),[t]);Object(r.useEffect)((function(){var e=l.subscription;return e.trySubscribe(),u!==t.getState()&&e.notifyNestedSubs(),function(){e.tryUnsubscribe(),e.onStateChange=null}}),[l,u]);var s=n||i;return o.a.createElement(s.Provider,{value:l},a)};function f(){return(f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function d(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}var p=n(15)Line truncated
|
||||
//# sourceMappingURL=2.9a920135.chunk.js.map
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
object-assign
|
||||
(c) Sindre Sorhus
|
||||
@license MIT
|
||||
*/
|
||||
|
||||
/** @license React v0.19.1
|
||||
* scheduler.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v16.13.1
|
||||
* react-dom.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v16.13.1
|
||||
* react-is.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/** @license React v16.13.1
|
||||
* react.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../node_modules/react/index.js","../node_modules/prop-types/index.js","../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","../node_modules/@fortawesome/free-solid-svg-icons/index.es.js","../node_modules/react-redux/es/components/Context.js","../node_modules/react-redux/es/utils/batch.js","../node_modules/react-redux/es/utils/Subscription.js","../node_modules/react-redux/es/components/Provider.js","../node_modules/@babel/runtime/helpers/esm/extends.js","../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","../node_modules/react-redux/es/utils/useIsomorphicLayoutEffect.js","../node_modules/react-redux/es/components/connectAdvanced.js","../node_modules/react-redux/es/utils/shallowEqual.js","../node_modules/react-redux/es/connect/wrapMapToProps.js","../node_modules/react-redux/es/connect/mapDispatchToProps.js","../node_modules/react-redux/es/connect/mapStateToProps.js","../node_modules/react-redux/es/connect/mergeProps.js","../node_modules/react-redux/es/connect/selectorFactory.js","../node_modules/react-redux/es/connect/connect.js","../node_modules/react-redux/es/hooks/useSelector.js","../node_modules/react-redux/es/index.js","../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/classCallCheck.js","../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/createClass.js","../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js","../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js","../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/typeof.js","../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js","../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/createSuper.js","../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/inherits.js","../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/defineProperty.js","../node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/objectSpread2.js","../node_modules/@fortawesome/react-fontawesome/index.es.js","../node_modules/redux/es/redux.js","../node_modules/webpack/buildin/global.js","../node_modules/react-dom/index.js","../node_modules/react-is/index.js","../node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js","../node_modules/symbol-observable/es/index.js","../node_modules/@fortawesome/fontawesome-svg-core/index.es.js","../node_modules/object-assign/index.js","../node_modules/symbol-observable/es/ponyfill.js","../node_modules/react/cjs/react.production.min.js","../node_modules/react-dom/cjs/react-dom.production.min.js","../node_modules/scheduler/index.js","../node_modules/scheduler/cjs/scheduler.production.min.js","../node_modules/prop-types/factoryWithThrowingShims.js","../node_modules/prop-types/lib/ReactPropTypesSecret.js","../node_modules/react-is/cjs/react-is.production.min.js","../node_modules/webpack/buildin/harmony-module.js","../node_modules/timers-browserify/main.js","../node_modules/setimmediate/setImmediate.js","../node_modules/process/browser.js"],"names":["module","exports","require","_assertThisInitialized","self","ReferenceError","faArrowCircleDown","prefix","iconName","icon","faArrowCircleUp","faPauseCircle","faPlayCircle","faSyncAlt","ReactReduxContext","React","createContext","batch","callback","nullListeners","notify","createListenerCollection","first","last","clear","listener","next","get","listeners","push","subscribe","isSubscribed","prev","Subscription","store","parentSub","this","unsubscribe","handleChangeWrapper","bind","_proto","prototype","addNestedSub","trySubscribe","notifyNestedSubs","onStateChange","Boolean","tryUnsubscribe","Provider","_ref","context","children","contextValue","useMemo","subscription","previousState","getState","useEffect","Context","createElement","value","_extends","Object","assign","target","i","arguments","length","source","key","hasOwnProperty","call","apply","_objectWithoutPropertiesLoose","excluded","sourceKeys","keys","indexOf","useIsomorphicLayoutEffect","window","document","useLayoutEffect","EMPTY_ARRAY","NO_SUBSCRIPTION_ARRAY","storeStateUpdatesReducer","state","action","updateCount","payload","useIsomorphicLayoutEffectWithArgs","effectFunc","effectArgs","dependencies","captureWrapperProps","lastWrapperProps","lastChildProps","renderIsScheduled","wrapperProps","actualChildProps","childPropsFromStoreUpdate","current","subscribeUpdates","shouldHandleStateChanges","childPropsSelector","forceComponentUpdateDispatch","didUnsubscribe","lastThrownError","checkForUpdates","newChildProps","error","latestStoreState","e","type","initStateUpdates","connectAdvanced","selectorFactory","_ref2"Line truncated
|
||||
@@ -0,0 +1,2 @@
|
||||
(this["webpackJsonppomodoro-clock-react"]=this["webpackJsonppomodoro-clock-react"]||[]).push([[0],{20:function(e,t,n){e.exports=n.p+"static/media/BeepSound.049fe0d0.ogg"},21:function(e,t,n){e.exports=n(34)},30:function(e,t,n){},34:function(e,t,n){"use strict";n.r(t);var o=n(0),i=n.n(o),r=n(13),s=n.n(r),a=n(4),c=n(11),h=function(e){return{type:"SETBREAKLENGTH",breakLength:e}},u=function(e){return{type:"SETSESSIONLENGTH",sessionLength:e}},l=function(e){return{type:"SETCLOCK",time:e}},p=Object(c.b)({innerWindowWidth:function(e,t){switch(e||(e=window.innerWidth),t.type){case"SETWINDOWINNERWIDTH":return t.windowInnerWidth;default:return e}},innerWindowHeight:function(e,t){switch(e||(e=window.innerHeight),t.type){case"SETWINDOWINNERHEIGHT":return t.windowInnerHeight;default:return e}},breakLength:function(e,t){switch(e||(e=5),t.type){case"SETBREAKLENGTH":return t.breakLength;default:return e}},sessionLength:function(e,t){switch(e||(e=25),t.type){case"SETSESSIONLENGTH":return t.sessionLength;default:return e}},timer:function(e,t){switch(e||(e="Session"),t.type){case"SETTIMER":return t.timer;default:return e}},clock:function(e,t){switch(e||(e="25:00"),t.type){case"SETCLOCK":return t.time;default:return e}},clockIsRunning:function(e,t){switch(e||(e=!1),t.type){case"SETCLOCKISRUNNING":return t.clockIsRunning;default:return e}},zeroTime:function(e,t){switch(e||(e=0),t.type){case"SETZEROTIME":return t.zeroTime;default:return e}}}),d=Object(c.c)(p),m=(n(30),n(5)),f=n(6),w=n(2),v=n(8),E=n(7),y=n(9),g="#0b3c5d",b="#328cc1",k="#d9b310",S="#1d2731",M=function(e){var t=e%60,n=Math.floor(e/60);return(n>9?n.toString():"0"+n.toString())+":"+(t>9?t.toString():"0"+t.toString())},A=n(10),C=n(3),O=function(e){Object(v.a)(n,e);var t=Object(E.a)(n);function n(e){var o;return Object(m.a)(this,n),(o=t.call(this,e)).handleDownArrowMouseEvent=o.handleDownArrowMouseEvent.bind(Object(w.a)(o)),o.handleUpArrowMouseEvent=o.handleUpArrowMouseEvent.bind(Object(w.a)(o)),o.incrementBreak=o.incrementBreak.bind(Object(w.a)(o)),o.decrementBreak=o.decrementBreak.bind(Object(w.a)(o)),o.state={downColor:S,upColor:S},o}return Object(f.a)(n,[{key:"incrementBreak",value:function(){if(this.props.breakLength<60){var e=this.props.breakLength+1;this.props.clockIsRunning?"Session"===this.props.timer&&this.props.breakLengthAction(e):(this.props.breakLengthAction(e),"Break"===this.props.timer&&this.props.clockAction(M(60*e)))}}},{key:"decrementBreak",value:function(){if(this.props.breakLength>1){var e=this.props.breakLength-1;this.props.clockIsRunning?"Session"===this.props.timer&&this.props.breakLengthAction(e):(this.props.breakLengthAction(e),"Break"===this.props.timer&&this.props.clockAction(M(60*e)))}}},{key:"handleDownArrowMouseEvent",value:function(e){"mousedown"===e.type||"touchstart"===e.type?this.setState({downColor:k}):"mouseup"!==e.type&&"touchend"!==e.type||this.setState({downColor:S})}},{key:"handleUpArrowMouseEvent",value:function(e){"mousedown"===e.type||"touchstart"===e.type?this.setState({upColor:k}):"mouseup"!==e.type&&"touchend"!==e.type||this.setState({upColor:S})}},{key:"render",value:function(){var e={color:this.state.downColor},t={color:this.state.upColor};return i.a.createElement("div",{style:{height:"50%",width:"75%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-end",marginRight:"25%",fontSize:32}},i.a.createElement("div",{id:"break-decrement",style:e,onClick:this.decrementBreak,onTouchStart:this.handleDownArrowMouseEvent,onTouchEnd:this.handleDownArrowMouseEvent,onMouseDown:this.handleDownArrowMouseEvent,onMouseUp:this.handleDownArrowMouseEvent},i.a.createElement(A.a,{icon:C.a})),i.a.createElement("p",{id:"break-length",style:{width:50}},this.props.breakLength),i.a.createElement("div",{id:"break-increment",style:t,onClick:this.incrementBreak,onTouchStart:this.handleUpArrowMouseEvent,onTouchEnd:this.handleUpArrowMouseEvent,onMouseDown:this.handleUpArrowMouseEvent,onMouseUp:this.handleUpArrowMouseEvent},i.a.createElement(A.a,{icon:C.b})))}}]),n}(i.a.Component),j=Object(a.b)((function(e){return Object(y.a)({},e)}),(function(e){return{breakLengthAction:function(t){return e(h(t))},clockAction:function(t){return e(l(t))}}}))(O),T=function(){var e={height:"50%",width:"90%",display:"flex",flexDirection:"column",justifyContent:"center",textAlign:"right",marginRight:"10%",color:k};return i.a.createElement("div",{style:{height:"100%",width:"50%"}},i.a.createElement("div",{id:"break-label",style:e},"Break Length"),i.a.createElement(j,null))},I=function(e){Object(v.a)(n,e);var t=Object(E.a)(n);function n(e){var o;return Object(m.a)(this,n),(o=t.call(this,e)).handleDownArrowMouseEvent=o.handleDownArrowMouseEvent.bind(Object(w.a)(o)),o.handleUpArrowMouseEvent=o.handleUpArrowMouseEvent.bind(Object(w.a)(o)),o.incrementSession=o.incrementSession.bind(Object(w.a)(o)),o.decrementSession=o.decrementSession.bind(Object(w.a)(o)),o.state={downColor:S,upColor:S},o}return Object(f.a)(n,[{key:"incrementSession",value:function(){if(tLine truncated
|
||||
//# sourceMappingURL=main.157adc9f.chunk.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["BeepSound.ogg","actions/breakLengthAction.js","actions/sessionLengthAction.js","actions/clockAction.js","reducers/rootReducer.js","reducers/innerWindowWidthReducer.js","actions/innerWindowWidthAction.js","reducers/innerWindowHeightReducer.js","actions/innerWindowHeightAction.js","reducers/breakLengthReducer.js","reducers/sessionLengthReducer.js","reducers/timerReducer.js","actions/timerAction.js","reducers/clockReducer.js","reducers/clockIsRunningReducer.js","actions/clockIsRunningAction.js","reducers/zeroTimeReducer.js","actions/zeroTimeAction.js","store.js","globals.js","BreakControls.js","Break.js","SessionControls.js","Session.js","Top.js","Clock.js","Controls.js","PomodoroClock.js","App.js","serviceWorker.js","index.js"],"names":["module","exports","breakLengthAction","breakLength","type","sessionLengthAction","sessionLength","clockAction","time","combineReducers","innerWindowWidth","state","action","window","innerWidth","windowInnerWidth","innerWindowHeight","innerHeight","windowInnerHeight","timer","clock","clockIsRunning","zeroTime","store","createStore","rootReducer","colors","makeClock","remainingTime","remainingSeconds","remainingMinutes","Math","floor","toString","BreakControls","props","handleDownArrowMouseEvent","bind","handleUpArrowMouseEvent","incrementBreak","decrementBreak","downColor","upColor","this","newBreakLength","e","setState","downArrowStyle","color","upArrowStyle","style","height","width","display","flexDirection","alignItems","justifyContent","marginRight","fontSize","id","onClick","onTouchStart","onTouchEnd","onMouseDown","onMouseUp","icon","faArrowCircleDown","faArrowCircleUp","React","Component","connect","dispatch","Break","breakTextStyle","textAlign","SessionControls","incrementSession","decrementSession","newSessionLength","marginLeft","Session","sessionTextStyle","Top","Clock","timerLabelStyle","Controls","handleMouseEventPlay","handleMouseEventPause","handleMouseEventReset","handlePlay","handleReset","playColor","pauseColor","resetColor","sound","clockIsRunningAction","now","Date","nowSeconds","getTime","split","parseInt","zeroTimeAction","self","refreshClock","setInterval","newClock","timerAction","clearInterval","pause","currentTime","prevProps","play","document","getElementById","playStyle","pauseStyle","resetStyle","faPlayCircle","faPauseCircle","faSyncAlt","preload","src","BeepSoundOgg","PomodoroClock","eightyPercentWidth","round","eightyPercentHeight","margin","border","borderColor","zIndex","backgroundColor","borderRadius","userSelect","MozUserSelect","WebkitUserSelect","clockContainerStyle","App","handleResize","innerWindowWidthAction","innerWindowHeightAction","addEventListener","removeEventListener","gitHubLabelStyle","position","right","attachmentStyle","overFlow","fontFamily","href","target","rel","className","alt","data-recalc-dims","Boolean","location","hostname","match","ReactDOM","render","navigator","serviceWorker","ready","then","registration","unregister","catch","error","console","message"],"mappings":"sHAAAA,EAAOC,QAAU,IAA0B,uC,oJCE9BC,EAAoB,SAACC,GAChC,MAAO,CACLC,KAJ0B,iBAK1BD,YAAaA,ICHJE,EAAsB,SAACC,GAClC,MAAO,CACLF,KAJ4B,mBAK5BE,cAAeA,ICHNC,EAAc,SAACC,GAC1B,MAAO,CACLJ,KAJoB,WAKpBI,KAAMA,ICKKC,cAAgB,CAC7BC,iBCTa,SAACC,EAAOC,GAKrB,OAJKD,IACHA,EAAQE,OAAOC,YAGTF,EAAOR,MACb,ICR+B,sBDS7B,OAAOQ,EAAOG,iBAChB,QACE,OAAOJ,IDCXK,kBGVa,SAACL,EAAOC,GAKrB,OAJKD,IACHA,EAAQE,OAAOI,aAGTL,EAAOR,MACb,ICRgC,uBDS9B,OAAOQ,EAAOM,kBAChB,QACE,OAAOP,IHEXR,YKXa,SAACQ,EAAOC,GAKrB,OAJKD,IACHA,EAAQ,GAGFC,EAAOR,MACb,IRR0B,iBQSxB,OAAOQ,EAAOT,YAChB,QACE,OAAOQ,ILGXL,cMZa,SAACK,EAAOC,GAKrB,OAJKD,IACHA,EAAQ,IAGFC,EAAOR,MACb,IRR4B,mBQS1B,OAAOQ,EAAON,cAChB,QACE,OAAOK,INIXQ,MOba,SAACR,EAAOC,GAKrB,OAJKD,IACHA,EAAQ,WAGFC,EAAOR,MACb,ICRoB,WDSlB,OAAOQ,EAAOO,MAChB,QACE,OAAOR,IPKXS,MSda,SAACT,EAAOC,GAKrB,OAJKD,IACHA,EAAQ,SAGFC,EAAOR,MACb,IVRoB,WUSlB,OAAOQ,EAAOJ,KAChB,QACE,OAAOG,ITMXU,eUfa,SAACV,EAAOC,GAKrB,OAJKD,IACHA,GAAQ,GAGFC,EAAOR,MACb,ICR6B,oBDS3B,OAAOQ,EAAOS,eAChB,QACE,OAAOV,IVOXW,SYhBa,SAACX,EAAOC,GAKrB,OAJKD,IACHA,EAAQ,GAGFC,EAAOR,MACb,ICRuB,cDSrB,OAAOQ,EAAOU,SAChB,QACE,OAAOX,MENEY,EAFDC,YAAYC,G,kDCHbC,EACG,UADHA,EAEF,UAFEA,EAGD,UAHCA,EAIC,UAGDC,EAAY,SAACC,GACxB,IAAMC,EAAmBD,EAAgB,GACnCE,EAAmBC,KAAKC,MAAMJ,EAAgB,IAGpD,OAFgBE,EAAmB,EAAIA,EAAiBG,WAAa,IAAMH,EAAiBG,YAE3E,KADDJ,EAAmB,EAAIA,EAAiBI,WAAa,IAAMJ,EAAiBI,a,eCOxFC,E,kDACJ,WAAYC,GAAQ,IAAD,8BACjB,cAAMA,IACDC,0BAA4B,EAAKA,0BAA0BC,KAA/B,gBACjC,EAAKC,wBAA0B,EAAKA,wBAAwBD,KAA7B,gBAC/B,EAAKE,eAAiB,EAAKA,eAAeF,KAApB,gBACtB,EAAKG,eAAiB,EAAKA,eAAeH,KAApB,gBACtB,EAAK1B,MAAQ,CACX8B,UAAWf,EACXgB,QAAShB,GARM,E,6DAajB,GAAIiB,KAAKR,MAAMhC,YAAc,GAAI,CAC/B,IAAMyC,EAAiBD,KAAKR,MAAMhC,YAAc,EAC3CwC,KAAKR,MAAMd,eAMW,YAArBsB,KAAKR,MAAMhB,OACbwB,KAAKR,MAAMjC,kBAAkB0C,IAN/BD,KAAKR,MAAMjC,kBAAkB0C,GACJ,UAArBD,KAAKR,MAAMhB,OACbwB,KAAKR,MAAM5B,YAAYoB,EAA2B,GAAjBiB,Q,uCAWvC,GAAID,KAAKR,MAAMhC,YAAc,EAAG,CAC9B,IAAMyC,EAAiBD,KAAKR,MAAMhC,YAAc,EAC3CwC,KAAKR,MAAMd,eAMW,YAArBsB,KAAKR,MAAMhB,OACbwB,KAAKR,MAAMjC,kBAAkB0C,IAN/BD,KAAKR,MAAMjC,kLine truncated
|
||||
@@ -0,0 +1,2 @@
|
||||
!function(e){function r(r){for(var o,u,l=r[0],a=r[1],p=r[2],i=0,s=[];i<l.length;i++)u=l[i],Object.prototype.hasOwnProperty.call(n,u)&&n[u]&&s.push(n[u][0]),n[u]=0;for(o in a)Object.prototype.hasOwnProperty.call(a,o)&&(e[o]=a[o]);for(f&&f(r);s.length;)s.shift()();return c.push.apply(c,p||[]),t()}function t(){for(var e,r=0;r<c.length;r++){for(var t=c[r],o=!0,l=1;l<t.length;l++){var a=t[l];0!==n[a]&&(o=!1)}o&&(c.splice(r--,1),e=u(u.s=t[0]))}return e}var o={},n={1:0},c=[];function u(r){if(o[r])return o[r].exports;var t=o[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,u),t.l=!0,t.exports}u.m=e,u.c=o,u.d=function(e,r,t){u.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},u.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,r){if(1&r&&(e=u(e)),8&r)return e;if(4&r&&"object"===typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(u.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)u.d(t,o,function(r){return e[r]}.bind(null,o));return t},u.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(r,"a",r),r},u.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},u.p="/fcc-challenges/pomodoro-clock-react/build/";var l=this["webpackJsonppomodoro-clock-react"]=this["webpackJsonppomodoro-clock-react"]||[],a=l.push.bind(l);l.push=r,l=l.slice();for(var p=0;p<l.length;p++)r(l[p]);var f=a;t()}([]);
|
||||
//# sourceMappingURL=runtime-main.601eb45a.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../webpack/bootstrap"],"names":["webpackJsonpCallback","data","moduleId","chunkId","chunkIds","moreModules","executeModules","i","resolves","length","Object","prototype","hasOwnProperty","call","installedChunks","push","modules","parentJsonpFunction","shift","deferredModules","apply","checkDeferredModules","result","deferredModule","fulfilled","j","depId","splice","__webpack_require__","s","installedModules","1","exports","module","l","m","c","d","name","getter","o","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","p","jsonpArray","this","oldJsonpFunction","slice"],"mappings":"aACE,SAASA,EAAqBC,GAQ7B,IAPA,IAMIC,EAAUC,EANVC,EAAWH,EAAK,GAChBI,EAAcJ,EAAK,GACnBK,EAAiBL,EAAK,GAIHM,EAAI,EAAGC,EAAW,GACpCD,EAAIH,EAASK,OAAQF,IACzBJ,EAAUC,EAASG,GAChBG,OAAOC,UAAUC,eAAeC,KAAKC,EAAiBX,IAAYW,EAAgBX,IACpFK,EAASO,KAAKD,EAAgBX,GAAS,IAExCW,EAAgBX,GAAW,EAE5B,IAAID,KAAYG,EACZK,OAAOC,UAAUC,eAAeC,KAAKR,EAAaH,KACpDc,EAAQd,GAAYG,EAAYH,IAKlC,IAFGe,GAAqBA,EAAoBhB,GAEtCO,EAASC,QACdD,EAASU,OAATV,GAOD,OAHAW,EAAgBJ,KAAKK,MAAMD,EAAiBb,GAAkB,IAGvDe,IAER,SAASA,IAER,IADA,IAAIC,EACIf,EAAI,EAAGA,EAAIY,EAAgBV,OAAQF,IAAK,CAG/C,IAFA,IAAIgB,EAAiBJ,EAAgBZ,GACjCiB,GAAY,EACRC,EAAI,EAAGA,EAAIF,EAAed,OAAQgB,IAAK,CAC9C,IAAIC,EAAQH,EAAeE,GACG,IAA3BX,EAAgBY,KAAcF,GAAY,GAE3CA,IACFL,EAAgBQ,OAAOpB,IAAK,GAC5Be,EAASM,EAAoBA,EAAoBC,EAAIN,EAAe,KAItE,OAAOD,EAIR,IAAIQ,EAAmB,GAKnBhB,EAAkB,CACrBiB,EAAG,GAGAZ,EAAkB,GAGtB,SAASS,EAAoB1B,GAG5B,GAAG4B,EAAiB5B,GACnB,OAAO4B,EAAiB5B,GAAU8B,QAGnC,IAAIC,EAASH,EAAiB5B,GAAY,CACzCK,EAAGL,EACHgC,GAAG,EACHF,QAAS,IAUV,OANAhB,EAAQd,GAAUW,KAAKoB,EAAOD,QAASC,EAAQA,EAAOD,QAASJ,GAG/DK,EAAOC,GAAI,EAGJD,EAAOD,QAKfJ,EAAoBO,EAAInB,EAGxBY,EAAoBQ,EAAIN,EAGxBF,EAAoBS,EAAI,SAASL,EAASM,EAAMC,GAC3CX,EAAoBY,EAAER,EAASM,IAClC5B,OAAO+B,eAAeT,EAASM,EAAM,CAAEI,YAAY,EAAMC,IAAKJ,KAKhEX,EAAoBgB,EAAI,SAASZ,GACX,qBAAXa,QAA0BA,OAAOC,aAC1CpC,OAAO+B,eAAeT,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DrC,OAAO+B,eAAeT,EAAS,aAAc,CAAEe,OAAO,KAQvDnB,EAAoBoB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQnB,EAAoBmB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,kBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKzC,OAAO0C,OAAO,MAGvB,GAFAxB,EAAoBgB,EAAEO,GACtBzC,OAAO+B,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,EAAmB,IAAI,IAAIM,KAAON,EAAOnB,EAAoBS,EAAEc,EAAIE,EAAK,SAASA,GAAO,OAAON,EAAMM,IAAQC,KAAK,KAAMD,IAC9I,OAAOF,GAIRvB,EAAoB2B,EAAI,SAAStB,GAChC,IAAIM,EAASN,GAAUA,EAAOiB,WAC7B,WAAwB,OAAOjB,EAAgB,SAC/C,WAA8B,OAAOA,GAEtC,OADAL,EAAoBS,EAAEE,EAAQ,IAAKA,GAC5BA,GAIRX,EAAoBY,EAAI,SAASgB,EAAQC,GAAY,OAAO/C,OAAOC,UAAUC,eAAeC,KAAK2C,EAAQC,IAGzG7B,EAAoB8B,EAAI,8CAExB,IAAIC,EAAaC,KAAK,oCAAsCA,KAAK,qCAAuC,GACpGC,EAAmBF,EAAW5C,KAAKuC,KAAKK,GAC5CA,EAAW5C,KAAOf,EAClB2D,EAAaA,EAAWG,QACxB,IAAI,IAAIvD,EAAI,EAAGA,EAAIoD,EAAWlD,OAAQF,IAAKP,EAAqB2D,EAAWpD,IAC3E,IAAIU,EAAsB4C,EAI1BxC,I","file":"static/js/runtime-main.601eb45a.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tfunction webpackJsonpCallback(data) {\n \t\tvar chunkIds = data[0];\n \t\tvar moreModules = data[1];\n \t\tvar executeModules = data[2];\n\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(data);\n\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n\n \t\t// add entry modules from loaded chunk to deferred list\n \t\tdeferredModules.push.apply(deferredModules, executeModules || []);\n\n \t\t// run deferred modules when all chunks ready\n \t\treturn checkDeferredModules();\n \t};\n \tfunction checkDeferredModules() {\n \t\tvar result;\n \t\tfor(var i = 0; i < deferredModules.length; i++) {\n \t\t\tvar deferredModule = deferredModules[i];\n \t\t\tvar fulfilled = true;\n \t\t\tfor(var j = 1; j < deferredModule.length; j++) {\n \t\t\t\tvar depId = deferredModule[j];\n \t\t\t\tif(installedChunks[depId] !== 0) fulfilled = false;\n \t\t\t}\n \t\t\tif(fulfilled) {\n \t\t\t\tdeferredModules.splice(i--, 1);\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = deferredModule[0]);\n \t\t\t}\n \t\t}\n\n \t\treturn result;\n \t}\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// undefined = chunk not loaded, null = chunk preloaded/prefetched\n \t// Promise = chunk loading, 0 = chunk loaded\n \tvar installedChunks = {\n \t\t1: 0\n \t};\n\n \tvar deferredModules = [];\n\nLine truncated
|
||||
Binary file not shown.
Generated
+14064
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "pomodoro-clock-react",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"homepage": "https://trentspalmer.github.io/fcc-challenges/pomodoro-clock-react/build",
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-svg-core": "^1.2.28",
|
||||
"@fortawesome/free-solid-svg-icons": "^5.13.0",
|
||||
"@fortawesome/react-fontawesome": "^0.1.10",
|
||||
"@testing-library/jest-dom": "^4.2.4",
|
||||
"@testing-library/react": "^9.5.0",
|
||||
"@testing-library/user-event": "^7.2.1",
|
||||
"react": "^16.13.1",
|
||||
"react-dom": "^16.13.1",
|
||||
"react-redux": "^7.2.0",
|
||||
"react-scripts": "3.4.1",
|
||||
"redux": "^4.0.5"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "react-app"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="#" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Web site created using create-react-app"
|
||||
/>
|
||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is installed on a
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<link href="https://fonts.googleapis.com/css2?family=Ubuntu:wght@500&display=swap" rel="stylesheet">
|
||||
<!--
|
||||
font-family: 'Ubuntu', sans-serif;
|
||||
-->
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>
|
||||
Pomodoro Clock React - Build a Pomodoro Clock - Front End Libraries Projects
|
||||
</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root">
|
||||
<div>
|
||||
<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>
|
||||
</div>
|
||||
</div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"short_name": "React App",
|
||||
"name": "Create React App Sample",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "logo192.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "logo512.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
# https://www.robotstxt.org/robotstxt.html
|
||||
User-agent: *
|
||||
Disallow:
|
||||
@@ -0,0 +1,98 @@
|
||||
import React from 'react';
|
||||
import { connect } from "react-redux";
|
||||
|
||||
import PomodoroClock from './PomodoroClock';
|
||||
|
||||
import { colors } from './globals'
|
||||
|
||||
import { innerWindowWidthAction } from "./actions/innerWindowWidthAction";
|
||||
import { innerWindowHeightAction } from "./actions/innerWindowHeightAction";
|
||||
|
||||
const mapStateToProps = (state) => ({ ...state });
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
innerWindowWidthAction: (windowInnerWidth) => dispatch(innerWindowWidthAction(windowInnerWidth)),
|
||||
innerWindowHeightAction: (windowInnerHeight) => dispatch(innerWindowHeightAction(windowInnerHeight)),
|
||||
});
|
||||
|
||||
class App extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.handleResize = this.handleResize.bind(this);
|
||||
};
|
||||
|
||||
handleResize() {
|
||||
this.props.innerWindowWidthAction(window.innerWidth);
|
||||
this.props.innerWindowHeightAction(window.innerHeight);
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
window.addEventListener('resize',this.handleResize);
|
||||
};
|
||||
|
||||
componentWillUnmount() {
|
||||
window.removeEventListener('resize',this.handleResize);
|
||||
};
|
||||
|
||||
render() {
|
||||
const height = this.props.innerWindowHeight;
|
||||
const width = this.props.innerWindowWidth;
|
||||
const gitHubLabelStyle = {
|
||||
backgroundColor: colors.prussianBlue,
|
||||
border: 'none',
|
||||
width: 149,
|
||||
height: 0,
|
||||
position: 'absolute',
|
||||
right: 0,
|
||||
};
|
||||
|
||||
const attachmentStyle = {
|
||||
position: 'absolute',
|
||||
right: 0,
|
||||
height: 149,
|
||||
width: 149,
|
||||
};
|
||||
|
||||
const style = {
|
||||
textAlign: 'center',
|
||||
backgroundColor: colors.prussianBlue,
|
||||
height: '100vh',
|
||||
width: '100vw',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
color: colors.ivoryBlack,
|
||||
overFlow: 'hidden',
|
||||
fontFamily: 'Ubuntu sans-serif',
|
||||
fontSize: 48,
|
||||
};
|
||||
|
||||
if (width > height && height < 400) {
|
||||
gitHubLabelStyle['width'] = 99;
|
||||
attachmentStyle['width'] = 99;
|
||||
attachmentStyle['height'] = 99;
|
||||
} else if (height > width) {
|
||||
gitHubLabelStyle['width'] = 99;
|
||||
attachmentStyle['width'] = 99;
|
||||
attachmentStyle['height'] = 99;
|
||||
}
|
||||
|
||||
return (
|
||||
<div style={style}>
|
||||
<a href="https://github.com/TrentSPalmer/fcc-challenges/tree/gh-pages/pomodoro-clock-react"
|
||||
style={gitHubLabelStyle}
|
||||
target="_blank" rel="noopener noreferrer">
|
||||
<img
|
||||
src="https://github.blog/wp-content/uploads/2008/12/forkme_right_white_ffffff.png?resize=149%2C149"
|
||||
className="size-full"
|
||||
style={attachmentStyle}
|
||||
alt="Fork me on GitHub"
|
||||
data-recalc-dims="1">
|
||||
</img>
|
||||
</a>
|
||||
<PomodoroClock />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(App);
|
||||
@@ -0,0 +1,9 @@
|
||||
import React from 'react';
|
||||
import { render } from '@testing-library/react';
|
||||
import App from './App';
|
||||
|
||||
test('renders learn react link', () => {
|
||||
const { getByText } = render(<App />);
|
||||
const linkElement = getByText(/learn react/i);
|
||||
expect(linkElement).toBeInTheDocument();
|
||||
});
|
||||
Binary file not shown.
@@ -0,0 +1,31 @@
|
||||
import React from 'react';
|
||||
|
||||
import { colors } from './globals'
|
||||
import BreakControls from './BreakControls';
|
||||
|
||||
const Break = () => {
|
||||
const style = {
|
||||
height: '100%',
|
||||
width: '50%',
|
||||
};
|
||||
|
||||
const breakTextStyle = {
|
||||
height: '50%',
|
||||
width: '90%',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'center',
|
||||
textAlign: 'right',
|
||||
marginRight: '10%',
|
||||
color: colors.goldLeaf,
|
||||
};
|
||||
|
||||
return(
|
||||
<div style={style}>
|
||||
<div id="break-label" style={breakTextStyle}>Break Length</div>
|
||||
<BreakControls />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Break;
|
||||
@@ -0,0 +1,124 @@
|
||||
import React from 'react';
|
||||
import { connect } from "react-redux";
|
||||
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { faArrowCircleDown } from "@fortawesome/free-solid-svg-icons";
|
||||
import { faArrowCircleUp } from "@fortawesome/free-solid-svg-icons";
|
||||
import { colors,makeClock } from './globals'
|
||||
|
||||
import { breakLengthAction } from "./actions/breakLengthAction";
|
||||
import { clockAction } from "./actions/clockAction";
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
breakLengthAction: (breakLength) => dispatch(breakLengthAction(breakLength)),
|
||||
clockAction: (time) => dispatch(clockAction(time)),
|
||||
});
|
||||
|
||||
const mapStateToProps = (state) => ({ ...state });
|
||||
|
||||
class BreakControls extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.handleDownArrowMouseEvent = this.handleDownArrowMouseEvent.bind(this);
|
||||
this.handleUpArrowMouseEvent = this.handleUpArrowMouseEvent.bind(this);
|
||||
this.incrementBreak = this.incrementBreak.bind(this);
|
||||
this.decrementBreak = this.decrementBreak.bind(this);
|
||||
this.state = {
|
||||
downColor: colors.ivoryBlack,
|
||||
upColor: colors.ivoryBlack,
|
||||
};
|
||||
};
|
||||
|
||||
incrementBreak() {
|
||||
if (this.props.breakLength < 60) {
|
||||
const newBreakLength = this.props.breakLength + 1;
|
||||
if (!this.props.clockIsRunning) {
|
||||
this.props.breakLengthAction(newBreakLength);
|
||||
if (this.props.timer === 'Break') {
|
||||
this.props.clockAction(makeClock(newBreakLength * 60));
|
||||
}
|
||||
} else {
|
||||
if (this.props.timer === 'Session') {
|
||||
this.props.breakLengthAction(newBreakLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
decrementBreak() {
|
||||
if (this.props.breakLength > 1) {
|
||||
const newBreakLength = this.props.breakLength - 1;
|
||||
if (!this.props.clockIsRunning) {
|
||||
this.props.breakLengthAction(newBreakLength);
|
||||
if (this.props.timer === 'Break') {
|
||||
this.props.clockAction(makeClock(newBreakLength * 60));
|
||||
}
|
||||
} else {
|
||||
if (this.props.timer === 'Session') {
|
||||
this.props.breakLengthAction(newBreakLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
handleDownArrowMouseEvent(e) {
|
||||
if (e.type === 'mousedown' || e.type === 'touchstart') {
|
||||
this.setState({downColor: colors.goldLeaf});
|
||||
} else if (e.type === 'mouseup' || e.type === 'touchend') {
|
||||
this.setState({downColor: colors.ivoryBlack});
|
||||
}
|
||||
};
|
||||
|
||||
handleUpArrowMouseEvent(e) {
|
||||
if (e.type === 'mousedown' || e.type === 'touchstart') {
|
||||
this.setState({upColor: colors.goldLeaf});
|
||||
} else if (e.type === 'mouseup' || e.type === 'touchend') {
|
||||
this.setState({upColor: colors.ivoryBlack});
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const style = {
|
||||
height: '50%',
|
||||
width: '75%',
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'flex-end',
|
||||
marginRight: '25%',
|
||||
fontSize: 32,
|
||||
};
|
||||
|
||||
const breakStyle = {
|
||||
width: 50,
|
||||
}
|
||||
|
||||
const downArrowStyle = {
|
||||
color: this.state.downColor,
|
||||
}
|
||||
|
||||
const upArrowStyle = {
|
||||
color: this.state.upColor,
|
||||
}
|
||||
|
||||
return(
|
||||
<div style={style}>
|
||||
<div id='break-decrement' style={downArrowStyle} onClick={this.decrementBreak}
|
||||
onTouchStart={this.handleDownArrowMouseEvent} onTouchEnd={this.handleDownArrowMouseEvent}
|
||||
onMouseDown={this.handleDownArrowMouseEvent} onMouseUp={this.handleDownArrowMouseEvent}>
|
||||
<FontAwesomeIcon icon={faArrowCircleDown}/>
|
||||
</div>
|
||||
|
||||
<p id='break-length' style={breakStyle}>{this.props.breakLength}</p>
|
||||
|
||||
<div id='break-increment' style={upArrowStyle} onClick={this.incrementBreak}
|
||||
onTouchStart={this.handleUpArrowMouseEvent} onTouchEnd={this.handleUpArrowMouseEvent}
|
||||
onMouseDown={this.handleUpArrowMouseEvent} onMouseUp={this.handleUpArrowMouseEvent}>
|
||||
<FontAwesomeIcon icon={faArrowCircleUp}/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(BreakControls);
|
||||
@@ -0,0 +1,42 @@
|
||||
import React from 'react';
|
||||
import { connect } from "react-redux";
|
||||
|
||||
import { colors } from './globals'
|
||||
|
||||
const mapStateToProps = (state) => ({ ...state });
|
||||
|
||||
class Clock extends React.Component {
|
||||
render() {
|
||||
const clockStyle = {
|
||||
height: '40%',
|
||||
width: '100%',
|
||||
}
|
||||
|
||||
const timerLabelStyle = {
|
||||
height: '30%',
|
||||
width: '100%',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'flex-end',
|
||||
color: colors.goldLeaf,
|
||||
}
|
||||
|
||||
const timerStyle = {
|
||||
height: '70%',
|
||||
width: '100%',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'center',
|
||||
fontSize: 96,
|
||||
}
|
||||
|
||||
return(
|
||||
<div style={clockStyle}>
|
||||
<div id='timer-label' style={timerLabelStyle}>{this.props.timer}</div>
|
||||
<div id='time-left' style={timerStyle}>{this.props.clock}</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps)(Clock);
|
||||
@@ -0,0 +1,186 @@
|
||||
import React from 'react';
|
||||
import { connect } from "react-redux";
|
||||
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { faPlayCircle } from "@fortawesome/free-solid-svg-icons";
|
||||
import { faPauseCircle } from "@fortawesome/free-solid-svg-icons";
|
||||
import { faSyncAlt } from "@fortawesome/free-solid-svg-icons";
|
||||
import { colors,makeClock } from './globals'
|
||||
|
||||
import { clockIsRunningAction } from "./actions/clockIsRunningAction";
|
||||
import { zeroTimeAction } from "./actions/zeroTimeAction";
|
||||
import { clockAction } from "./actions/clockAction";
|
||||
import { timerAction } from "./actions/timerAction";
|
||||
import { sessionLengthAction } from "./actions/sessionLengthAction";
|
||||
import { breakLengthAction } from "./actions/breakLengthAction";
|
||||
import BeepSoundOgg from './BeepSound.ogg';
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
clockIsRunningAction: (clockIsRunning) => dispatch(clockIsRunningAction(clockIsRunning)),
|
||||
zeroTimeAction: (zeroTime) => dispatch(zeroTimeAction(zeroTime)),
|
||||
clockAction: (time) => dispatch(clockAction(time)),
|
||||
timerAction: (timer) => dispatch(timerAction(timer)),
|
||||
sessionLengthAction: (sessionLength) => dispatch(sessionLengthAction(sessionLength)),
|
||||
breakLengthAction: (breakLength) => dispatch(breakLengthAction(breakLength)),
|
||||
});
|
||||
|
||||
const mapStateToProps = (state) => ({ ...state });
|
||||
|
||||
class Controls extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.handleMouseEventPlay = this.handleMouseEventPlay.bind(this);
|
||||
this.handleMouseEventPause = this.handleMouseEventPause.bind(this);
|
||||
this.handleMouseEventReset = this.handleMouseEventReset.bind(this);
|
||||
this.handlePlay = this.handlePlay.bind(this);
|
||||
this.handleReset = this.handleReset.bind(this);
|
||||
this.state = {
|
||||
playColor: colors.ivoryBlack,
|
||||
pauseColor: colors.ivoryBlack,
|
||||
resetColor: colors.ivoryBlack,
|
||||
sound: '',
|
||||
};
|
||||
};
|
||||
|
||||
handlePlay() {
|
||||
if (this.props.clockIsRunning) {
|
||||
this.props.clockIsRunningAction(false);
|
||||
} else {
|
||||
this.props.clockIsRunningAction(true);
|
||||
const now = new Date();
|
||||
const nowSeconds = Math.floor(now.getTime() / 1000);
|
||||
const remainingTime = this.props.clock.split(':');
|
||||
const remainingSeconds = (60 * parseInt(remainingTime[0])) + parseInt(remainingTime[1]);
|
||||
this.props.zeroTimeAction(nowSeconds + remainingSeconds);
|
||||
const self = this;
|
||||
let refreshClock = setInterval(function(){
|
||||
if (!self.props.clockIsRunning) {
|
||||
clearInterval(refreshClock);
|
||||
} else {
|
||||
const now = new Date();
|
||||
const nowSeconds = Math.floor(now.getTime() / 1000);
|
||||
if (nowSeconds <= self.props.zeroTime) {
|
||||
const remainingTime = self.props.zeroTime - nowSeconds;
|
||||
const newClock = makeClock(remainingTime);
|
||||
if (newClock !== self.props.clock) {
|
||||
self.props.clockAction(newClock);
|
||||
}
|
||||
} else {
|
||||
let remainingTime = self.props.breakLength * 60;
|
||||
if (self.props.timer === 'Session') {
|
||||
self.props.timerAction('Break');
|
||||
} else {
|
||||
self.props.timerAction('Session');
|
||||
remainingTime = self.props.sessionLength * 60;
|
||||
}
|
||||
self.props.zeroTimeAction(nowSeconds + remainingTime);
|
||||
self.props.clockAction(makeClock(remainingTime));
|
||||
}
|
||||
}
|
||||
},1000);
|
||||
}
|
||||
};
|
||||
|
||||
handleReset() {
|
||||
if (this.props.clockIsRunning) {
|
||||
this.props.clockIsRunningAction(false);
|
||||
}
|
||||
if (this.props.timer === 'Break') {
|
||||
this.props.timerAction('Session');
|
||||
}
|
||||
if (this.props.sessionLength !== 25) {
|
||||
this.props.sessionLengthAction(25);
|
||||
}
|
||||
if (this.props.breakLength !== 5) {
|
||||
this.props.breakLengthAction(5);
|
||||
}
|
||||
if (this.props.clock !== '25:00') {
|
||||
this.props.clockAction('25:00');
|
||||
}
|
||||
this.state.sound.pause();
|
||||
const oldSound = this.state.sound;
|
||||
oldSound.currentTime = 0;
|
||||
};
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
if (this.props.clock === '00:00') {
|
||||
this.state.sound.play();
|
||||
}
|
||||
};
|
||||
|
||||
handleMouseEventPlay(e) {
|
||||
if (e.type === 'mousedown' || e.type === 'touchstart') {
|
||||
this.setState({playColor: colors.goldLeaf});
|
||||
} else if (e.type === 'mouseup' || e.type === 'touchend') {
|
||||
this.setState({playColor: colors.ivoryBlack});
|
||||
}
|
||||
};
|
||||
|
||||
handleMouseEventPause(e) {
|
||||
if (e.type === 'mousedown' || e.type === 'touchstart') {
|
||||
this.setState({pauseColor: colors.goldLeaf});
|
||||
} else if (e.type === 'mouseup' || e.type === 'touchend') {
|
||||
this.setState({pauseColor: colors.ivoryBlack});
|
||||
}
|
||||
};
|
||||
|
||||
handleMouseEventReset(e) {
|
||||
if (e.type === 'mousedown' || e.type === 'touchstart') {
|
||||
this.setState({resetColor: colors.goldLeaf});
|
||||
} else if (e.type === 'mouseup' || e.type === 'touchend') {
|
||||
this.setState({resetColor: colors.ivoryBlack});
|
||||
}
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
this.setState({sound: document.getElementById('beep')});
|
||||
};
|
||||
|
||||
render() {
|
||||
const controlsStyle = {
|
||||
height: '20%',
|
||||
width: '100%',
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
fontSize: 48,
|
||||
}
|
||||
|
||||
const playStyle = {
|
||||
color: this.state.playColor,
|
||||
};
|
||||
|
||||
const pauseStyle = {
|
||||
color: this.state.pauseColor,
|
||||
width: 150,
|
||||
};
|
||||
|
||||
const resetStyle = {
|
||||
color: this.state.resetColor,
|
||||
};
|
||||
|
||||
return(
|
||||
<div style={controlsStyle}>
|
||||
<div id='start_stop' style={playStyle} onClick={this.handlePlay}
|
||||
onMouseDown={this.handleMouseEventPlay} onMouseUp={this.handleMouseEventPlay}
|
||||
onTouchStart={this.handleMouseEventPlay} onTouchEnd={this.handleMouseEventPlay}>
|
||||
<FontAwesomeIcon icon={faPlayCircle}/>
|
||||
</div>
|
||||
|
||||
<FontAwesomeIcon style={pauseStyle} onMouseDown={this.handleMouseEventPause}
|
||||
onMouseUp={this.handleMouseEventPause} onTouchStart={this.handleMouseEventPause}
|
||||
onTouchEnd={this.handleMouseEventPause} onClick={() => {this.props.clockIsRunningAction(false)}} icon={faPauseCircle}/>
|
||||
|
||||
<div id='reset' style={resetStyle} onClick={this.handleReset}
|
||||
onMouseDown={this.handleMouseEventReset} onMouseUp={this.handleMouseEventReset}
|
||||
onTouchStart={this.handleMouseEventReset} onTouchEnd={this.handleMouseEventReset}>
|
||||
<FontAwesomeIcon icon={faSyncAlt}/>
|
||||
</div>
|
||||
|
||||
<audio id='beep' preload='auto' src={BeepSoundOgg} type='audio/ogg'></audio>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(Controls);
|
||||
@@ -0,0 +1,69 @@
|
||||
import React from 'react';
|
||||
import { connect } from "react-redux";
|
||||
import { colors } from './globals'
|
||||
|
||||
import Top from './Top';
|
||||
import Clock from './Clock';
|
||||
import Controls from './Controls';
|
||||
|
||||
const mapStateToProps = (state) => ({ ...state });
|
||||
|
||||
class PomodoroClock extends React.Component {
|
||||
render() {
|
||||
const width = this.props.innerWindowWidth;
|
||||
const height = this.props.innerWindowHeight;
|
||||
const eightyPercentWidth = Math.round(width * 0.8);
|
||||
const eightyPercentHeight = Math.round(height * 0.8);
|
||||
const maxHeight = 500;
|
||||
const maxWidth = 800;
|
||||
const style = {
|
||||
margin: 'auto',
|
||||
border: '3px solid',
|
||||
borderColor: colors.ivoryBlack,
|
||||
zIndex: '1',
|
||||
backgroundColor: colors.skyBlue,
|
||||
borderRadius: 10,
|
||||
height: eightyPercentHeight < maxHeight ? eightyPercentHeight : maxHeight,
|
||||
width: eightyPercentWidth < maxWidth ? eightyPercentWidth : maxWidth,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'center',
|
||||
fontSize: 32,
|
||||
userSelect: 'none',
|
||||
MozUserSelect: 'none',
|
||||
WebkitUserSelect: 'none',
|
||||
};
|
||||
|
||||
const clockContainerStyle = {
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
};
|
||||
|
||||
if (width > height && height < 400) {
|
||||
style['height'] = '96vh';
|
||||
style['width'] = '75vw';
|
||||
style['margin'] = '1vh auto 3vh auto';
|
||||
style['fontSize'] = 24;
|
||||
} else if (height > width) {
|
||||
style['height'] = Math.round(height * 0.75);
|
||||
style['maxHeight'] = maxHeight;
|
||||
clockContainerStyle['height'] = width > style['height'] ? style['height'] : width;
|
||||
clockContainerStyle['maxHeight'] = maxHeight;
|
||||
style['width'] = width - 6;
|
||||
style['maxWidth'] = maxWidth;
|
||||
style['fontSize'] = 24;
|
||||
}
|
||||
|
||||
return(
|
||||
<div style={style}>
|
||||
<div style={clockContainerStyle}>
|
||||
<Top />
|
||||
<Clock />
|
||||
<Controls />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps)(PomodoroClock);
|
||||
@@ -0,0 +1,31 @@
|
||||
import React from 'react';
|
||||
|
||||
import { colors } from './globals'
|
||||
import SessionControls from './SessionControls';
|
||||
|
||||
const Session = () => {
|
||||
const style = {
|
||||
height: '100%',
|
||||
width: '50%',
|
||||
};
|
||||
|
||||
const sessionTextStyle = {
|
||||
height: '50%',
|
||||
width: '90%',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'center',
|
||||
textAlign: 'left',
|
||||
marginLeft: '10%',
|
||||
color: colors.goldLeaf,
|
||||
};
|
||||
|
||||
return(
|
||||
<div style={style}>
|
||||
<div id="session-label" style={sessionTextStyle}>Session Length</div>
|
||||
<SessionControls />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Session;
|
||||
@@ -0,0 +1,124 @@
|
||||
import React from 'react';
|
||||
import { connect } from "react-redux";
|
||||
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { faArrowCircleDown } from "@fortawesome/free-solid-svg-icons";
|
||||
import { faArrowCircleUp } from "@fortawesome/free-solid-svg-icons";
|
||||
import { colors,makeClock } from './globals'
|
||||
|
||||
import { sessionLengthAction } from "./actions/sessionLengthAction";
|
||||
import { clockAction } from "./actions/clockAction";
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
sessionLengthAction: (sessionLength) => dispatch(sessionLengthAction(sessionLength)),
|
||||
clockAction: (time) => dispatch(clockAction(time)),
|
||||
});
|
||||
|
||||
const mapStateToProps = (state) => ({ ...state });
|
||||
|
||||
class SessionControls extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.handleDownArrowMouseEvent = this.handleDownArrowMouseEvent.bind(this);
|
||||
this.handleUpArrowMouseEvent = this.handleUpArrowMouseEvent.bind(this);
|
||||
this.incrementSession = this.incrementSession.bind(this);
|
||||
this.decrementSession = this.decrementSession.bind(this);
|
||||
this.state = {
|
||||
downColor: colors.ivoryBlack,
|
||||
upColor: colors.ivoryBlack,
|
||||
};
|
||||
};
|
||||
|
||||
incrementSession() {
|
||||
if (this.props.sessionLength < 60) {
|
||||
const newSessionLength = this.props.sessionLength + 1;
|
||||
if (!this.props.clockIsRunning) {
|
||||
this.props.sessionLengthAction(newSessionLength);
|
||||
if (this.props.timer === 'Session') {
|
||||
this.props.clockAction(makeClock(newSessionLength * 60));
|
||||
}
|
||||
} else {
|
||||
if (this.props.timer === 'Break') {
|
||||
this.props.sessionLengthAction(newSessionLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
decrementSession() {
|
||||
if (this.props.sessionLength > 1) {
|
||||
const newSessionLength = this.props.sessionLength - 1;
|
||||
if (!this.props.clockIsRunning) {
|
||||
this.props.sessionLengthAction(newSessionLength);
|
||||
if (this.props.timer === 'Session') {
|
||||
this.props.clockAction(makeClock(newSessionLength * 60));
|
||||
}
|
||||
} else {
|
||||
if (this.props.timer === 'Break') {
|
||||
this.props.sessionLengthAction(newSessionLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
handleDownArrowMouseEvent(e) {
|
||||
if (e.type === 'mousedown' || e.type === 'touchstart') {
|
||||
this.setState({downColor: colors.goldLeaf});
|
||||
} else if (e.type === 'mouseup' || e.type === 'touchend') {
|
||||
this.setState({downColor: colors.ivoryBlack});
|
||||
}
|
||||
};
|
||||
|
||||
handleUpArrowMouseEvent(e) {
|
||||
if (e.type === 'mousedown' || e.type === 'touchstart') {
|
||||
this.setState({upColor: colors.goldLeaf});
|
||||
} else if (e.type === 'mouseup' || e.type === 'touchend') {
|
||||
this.setState({upColor: colors.ivoryBlack});
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const style = {
|
||||
height: '50%',
|
||||
width: '75%',
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'flex-start',
|
||||
marginLeft: '25%',
|
||||
fontSize: 32,
|
||||
};
|
||||
|
||||
const breakStyle = {
|
||||
width: 50,
|
||||
}
|
||||
|
||||
const downArrowStyle = {
|
||||
color: this.state.downColor,
|
||||
}
|
||||
|
||||
const upArrowStyle = {
|
||||
color: this.state.upColor,
|
||||
}
|
||||
|
||||
return(
|
||||
<div style={style}>
|
||||
<div id='session-decrement' style={downArrowStyle} onClick={this.decrementSession}
|
||||
onTouchStart={this.handleDownArrowMouseEvent} onTouchEnd={this.handleDownArrowMouseEvent}
|
||||
onMouseDown={this.handleDownArrowMouseEvent} onMouseUp={this.handleDownArrowMouseEvent}>
|
||||
<FontAwesomeIcon icon={faArrowCircleDown}/>
|
||||
</div>
|
||||
|
||||
<p id='session-length' style={breakStyle}>{this.props.sessionLength}</p>
|
||||
|
||||
<div id='session-increment' style={upArrowStyle} onClick={this.incrementSession}
|
||||
onTouchStart={this.handleUpArrowMouseEvent} onTouchEnd={this.handleUpArrowMouseEvent}
|
||||
onMouseDown={this.handleUpArrowMouseEvent} onMouseUp={this.handleUpArrowMouseEvent}>
|
||||
<FontAwesomeIcon icon={faArrowCircleUp}/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(SessionControls);
|
||||
@@ -0,0 +1,39 @@
|
||||
import React from 'react';
|
||||
|
||||
import Break from './Break';
|
||||
import Session from './Session';
|
||||
|
||||
const Top = () => {
|
||||
|
||||
const style = {
|
||||
height: '40%',
|
||||
width: '100%',
|
||||
}
|
||||
|
||||
const titleStyle = {
|
||||
height: '50%',
|
||||
width: '100%',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'center',
|
||||
fontSize: 48,
|
||||
}
|
||||
|
||||
const breakAndSessionStyle = {
|
||||
height: '50%',
|
||||
width: '100%',
|
||||
display: 'flex',
|
||||
}
|
||||
|
||||
return(
|
||||
<div style={style}>
|
||||
<div style={titleStyle}>Pomodoro Clock</div>
|
||||
<div style={breakAndSessionStyle}>
|
||||
<Break />
|
||||
<Session />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Top;
|
||||
@@ -0,0 +1,8 @@
|
||||
export const SETBREAKLENGTH = "SETBREAKLENGTH";
|
||||
|
||||
export const breakLengthAction = (breakLength) => {
|
||||
return {
|
||||
type: SETBREAKLENGTH,
|
||||
breakLength: breakLength,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
export const SETCLOCK = "SETCLOCK";
|
||||
|
||||
export const clockAction = (time) => {
|
||||
return {
|
||||
type: SETCLOCK,
|
||||
time: time,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
export const SETCLOCKISRUNNING = "SETCLOCKISRUNNING";
|
||||
|
||||
export const clockIsRunningAction = (clockIsRunning) => {
|
||||
return {
|
||||
type: SETCLOCKISRUNNING,
|
||||
clockIsRunning: clockIsRunning,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
export const SETWINDOWINNERHEIGHT = "SETWINDOWINNERHEIGHT";
|
||||
|
||||
export const innerWindowHeightAction = (windowInnerHeight) => {
|
||||
return {
|
||||
type: SETWINDOWINNERHEIGHT,
|
||||
windowInnerHeight: windowInnerHeight,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
export const SETWINDOWINNERWIDTH = "SETWINDOWINNERWIDTH";
|
||||
|
||||
export const innerWindowWidthAction = (windowInnerWidth) => {
|
||||
return {
|
||||
type: SETWINDOWINNERWIDTH,
|
||||
windowInnerWidth: windowInnerWidth,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
export const SETSESSIONLENGTH = "SETSESSIONLENGTH";
|
||||
|
||||
export const sessionLengthAction = (sessionLength) => {
|
||||
return {
|
||||
type: SETSESSIONLENGTH,
|
||||
sessionLength: sessionLength,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
export const SETTIMER = "SETTIMER";
|
||||
|
||||
export const timerAction = (timer) => {
|
||||
return {
|
||||
type: SETTIMER,
|
||||
timer: timer,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
export const SETZEROTIME = "SETZEROTIME";
|
||||
|
||||
export const zeroTimeAction = (zeroTime) => {
|
||||
return {
|
||||
type: SETZEROTIME,
|
||||
zeroTime: zeroTime,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
export const colors = {
|
||||
prussianBlue: '#0b3c5d',
|
||||
skyBlue: '#328cc1',
|
||||
goldLeaf: '#d9b310',
|
||||
ivoryBlack: '#1d2731',
|
||||
};
|
||||
|
||||
export const makeClock = (remainingTime) => {
|
||||
const remainingSeconds = remainingTime % 60;
|
||||
const remainingMinutes = Math.floor(remainingTime / 60);
|
||||
const minutes = remainingMinutes > 9 ? remainingMinutes.toString() : '0' + remainingMinutes.toString() ;
|
||||
const seconds = remainingSeconds > 9 ? remainingSeconds.toString() : '0' + remainingSeconds.toString() ;
|
||||
return minutes + ':' + seconds;
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
||||
sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||
monospace;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
||||
sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||
monospace;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { Provider } from "react-redux";
|
||||
import store from "./store";
|
||||
|
||||
import './index.css';
|
||||
import App from './App';
|
||||
import * as serviceWorker from './serviceWorker';
|
||||
|
||||
ReactDOM.render(
|
||||
<Provider store={store}>
|
||||
<App />
|
||||
</Provider>,
|
||||
document.getElementById('root')
|
||||
);
|
||||
|
||||
// If you want your app to work offline and load faster, you can change
|
||||
// unregister() to register() below. Note this comes with some pitfalls.
|
||||
// Learn more about service workers: https://bit.ly/CRA-PWA
|
||||
serviceWorker.unregister();
|
||||
@@ -0,0 +1,14 @@
|
||||
import { SETBREAKLENGTH } from "../actions/breakLengthAction";
|
||||
|
||||
export default (state, action) => {
|
||||
if (!state) {
|
||||
state = 5;
|
||||
}
|
||||
|
||||
switch (action.type) {
|
||||
case SETBREAKLENGTH:
|
||||
return action.breakLength;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
import { SETCLOCKISRUNNING } from "../actions/clockIsRunningAction";
|
||||
|
||||
export default (state, action) => {
|
||||
if (!state) {
|
||||
state = false;
|
||||
}
|
||||
|
||||
switch (action.type) {
|
||||
case SETCLOCKISRUNNING:
|
||||
return action.clockIsRunning;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
import { SETCLOCK } from "../actions/clockAction";
|
||||
|
||||
export default (state, action) => {
|
||||
if (!state) {
|
||||
state = '25:00';
|
||||
}
|
||||
|
||||
switch (action.type) {
|
||||
case SETCLOCK:
|
||||
return action.time;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
import { SETWINDOWINNERHEIGHT } from "../actions/innerWindowHeightAction";
|
||||
|
||||
export default (state, action) => {
|
||||
if (!state) {
|
||||
state = window.innerHeight;
|
||||
}
|
||||
|
||||
switch (action.type) {
|
||||
case SETWINDOWINNERHEIGHT:
|
||||
return action.windowInnerHeight;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
import { SETWINDOWINNERWIDTH } from "../actions/innerWindowWidthAction";
|
||||
|
||||
export default (state, action) => {
|
||||
if (!state) {
|
||||
state = window.innerWidth;
|
||||
}
|
||||
|
||||
switch (action.type) {
|
||||
case SETWINDOWINNERWIDTH:
|
||||
return action.windowInnerWidth;
|
||||
default:
|
||||
return state;
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
import { combineReducers } from "redux";
|
||||
import innerWindowWidthReducer from "./innerWindowWidthReducer";
|
||||
import innerWindowHeightReducer from "./innerWindowHeightReducer";
|
||||
import breakLengthReducer from "./breakLengthReducer";
|
||||
import sessionLengthReducer from "./sessionLengthReducer";
|
||||
import timerReducer from "./timerReducer";
|
||||
import clockReducer from "./clockReducer";
|
||||
import clockIsRunningReducer from "./clockIsRunningReducer";
|
||||
import zeroTimeReducer from "./zeroTimeReducer";
|
||||
|
||||
export default combineReducers({
|
||||
innerWindowWidth: innerWindowWidthReducer,
|
||||
innerWindowHeight: innerWindowHeightReducer,
|
||||
breakLength: breakLengthReducer,
|
||||
sessionLength: sessionLengthReducer,
|
||||
timer: timerReducer,
|
||||
clock: clockReducer,
|
||||
clockIsRunning: clockIsRunningReducer,
|
||||
zeroTime: zeroTimeReducer,
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
import { SETSESSIONLENGTH } from "../actions/sessionLengthAction";
|
||||
|
||||
export default (state, action) => {
|
||||
if (!state) {
|
||||
state = 25;
|
||||
}
|
||||
|
||||
switch (action.type) {
|
||||
case SETSESSIONLENGTH:
|
||||
return action.sessionLength;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
import { SETTIMER } from "../actions/timerAction";
|
||||
|
||||
export default (state, action) => {
|
||||
if (!state) {
|
||||
state = 'Session';
|
||||
}
|
||||
|
||||
switch (action.type) {
|
||||
case SETTIMER:
|
||||
return action.timer;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,14 @@
|
||||
import { SETZEROTIME } from "../actions/zeroTimeAction";
|
||||
|
||||
export default (state, action) => {
|
||||
if (!state) {
|
||||
state = 0;
|
||||
}
|
||||
|
||||
switch (action.type) {
|
||||
case SETZEROTIME:
|
||||
return action.zeroTime;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,141 @@
|
||||
// This optional code is used to register a service worker.
|
||||
// register() is not called by default.
|
||||
|
||||
// This lets the app load faster on subsequent visits in production, and gives
|
||||
// it offline capabilities. However, it also means that developers (and users)
|
||||
// will only see deployed updates on subsequent visits to a page, after all the
|
||||
// existing tabs open on the page have been closed, since previously cached
|
||||
// resources are updated in the background.
|
||||
|
||||
// To learn more about the benefits of this model and instructions on how to
|
||||
// opt-in, read https://bit.ly/CRA-PWA
|
||||
|
||||
const isLocalhost = Boolean(
|
||||
window.location.hostname === 'localhost' ||
|
||||
// [::1] is the IPv6 localhost address.
|
||||
window.location.hostname === '[::1]' ||
|
||||
// 127.0.0.0/8 are considered localhost for IPv4.
|
||||
window.location.hostname.match(
|
||||
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
|
||||
)
|
||||
);
|
||||
|
||||
export function register(config) {
|
||||
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
|
||||
// The URL constructor is available in all browsers that support SW.
|
||||
const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
|
||||
if (publicUrl.origin !== window.location.origin) {
|
||||
// Our service worker won't work if PUBLIC_URL is on a different origin
|
||||
// from what our page is served on. This might happen if a CDN is used to
|
||||
// serve assets; see https://github.com/facebook/create-react-app/issues/2374
|
||||
return;
|
||||
}
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
|
||||
|
||||
if (isLocalhost) {
|
||||
// This is running on localhost. Let's check if a service worker still exists or not.
|
||||
checkValidServiceWorker(swUrl, config);
|
||||
|
||||
// Add some additional logging to localhost, pointing developers to the
|
||||
// service worker/PWA documentation.
|
||||
navigator.serviceWorker.ready.then(() => {
|
||||
console.log(
|
||||
'This web app is being served cache-first by a service ' +
|
||||
'worker. To learn more, visit https://bit.ly/CRA-PWA'
|
||||
);
|
||||
});
|
||||
} else {
|
||||
// Is not localhost. Just register service worker
|
||||
registerValidSW(swUrl, config);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function registerValidSW(swUrl, config) {
|
||||
navigator.serviceWorker
|
||||
.register(swUrl)
|
||||
.then(registration => {
|
||||
registration.onupdatefound = () => {
|
||||
const installingWorker = registration.installing;
|
||||
if (installingWorker == null) {
|
||||
return;
|
||||
}
|
||||
installingWorker.onstatechange = () => {
|
||||
if (installingWorker.state === 'installed') {
|
||||
if (navigator.serviceWorker.controller) {
|
||||
// At this point, the updated precached content has been fetched,
|
||||
// but the previous service worker will still serve the older
|
||||
// content until all client tabs are closed.
|
||||
console.log(
|
||||
'New content is available and will be used when all ' +
|
||||
'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
|
||||
);
|
||||
|
||||
// Execute callback
|
||||
if (config && config.onUpdate) {
|
||||
config.onUpdate(registration);
|
||||
}
|
||||
} else {
|
||||
// At this point, everything has been precached.
|
||||
// It's the perfect time to display a
|
||||
// "Content is cached for offline use." message.
|
||||
console.log('Content is cached for offline use.');
|
||||
|
||||
// Execute callback
|
||||
if (config && config.onSuccess) {
|
||||
config.onSuccess(registration);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error during service worker registration:', error);
|
||||
});
|
||||
}
|
||||
|
||||
function checkValidServiceWorker(swUrl, config) {
|
||||
// Check if the service worker can be found. If it can't reload the page.
|
||||
fetch(swUrl, {
|
||||
headers: { 'Service-Worker': 'script' },
|
||||
})
|
||||
.then(response => {
|
||||
// Ensure service worker exists, and that we really are getting a JS file.
|
||||
const contentType = response.headers.get('content-type');
|
||||
if (
|
||||
response.status === 404 ||
|
||||
(contentType != null && contentType.indexOf('javascript') === -1)
|
||||
) {
|
||||
// No service worker found. Probably a different app. Reload the page.
|
||||
navigator.serviceWorker.ready.then(registration => {
|
||||
registration.unregister().then(() => {
|
||||
window.location.reload();
|
||||
});
|
||||
});
|
||||
} else {
|
||||
// Service worker found. Proceed as normal.
|
||||
registerValidSW(swUrl, config);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
console.log(
|
||||
'No internet connection found. App is running in offline mode.'
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
export function unregister() {
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.ready
|
||||
.then(registration => {
|
||||
registration.unregister();
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
||||
// allows you to do things like:
|
||||
// expect(element).toHaveTextContent(/react/i)
|
||||
// learn more: https://github.com/testing-library/jest-dom
|
||||
import '@testing-library/jest-dom/extend-expect';
|
||||
@@ -0,0 +1,6 @@
|
||||
import { createStore } from "redux";
|
||||
import rootReducer from "./reducers/rootReducer";
|
||||
|
||||
const store = createStore(rootReducer);
|
||||
|
||||
export default store;
|
||||
Reference in new issue
Block a user