{"version":3,"sources":["components/Footer.js","components/Header.js","components/LoadingPage.js","components/TodoItem.js","components/TakeData.js","App.js","serviceWorker.js","index.js"],"names":["Footer","className","href","Header","timeOfDay","colorOfDay","hours","Date","getHours","styles","color","style","LoadingPage","id","TodoItem","completedStyle","fontStyle","textDecoration","type","checked","this","props","item","completed","onChange","handleChange","text","onClick","onDelete","React","Component","axios","defaults","baseURL","TakeData","state","todos","addItem","bind","get","then","res","setState","data","updatedTodos","map","todo","post","e","_inputElement","value","newItem","prevState","concat","preventDefault","newTodos","filter","URL","delete","todoItems","length","key","onSubmit","ref","a","placeholder","App","isLoading","Boolean","window","location","hostname","match","ReactDOM","render","StrictMode","document","getElementById","navigator","serviceWorker","ready","registration","unregister","catch","error","console","message"],"mappings":"2TAWeA,MATf,WACI,OACI,gCACI,uBAAGC,UAAU,aAAb,+BAAoD,uBAAGC,KAAK,gCAAR,qBC4BjDC,MA/Bf,WACI,IAEIC,EACAC,EAFEC,GADO,IAAIC,MACEC,WAIfF,EAAM,IACNF,EAAY,UACZC,EAAa,SAERC,EAAQ,IACbF,EAAY,YACZC,EAAa,UAERC,EAAQ,IACbF,EAAY,UACZC,EAAa,WAGbD,EAAY,QACZC,EAAa,SAGjB,IAAMI,EAAS,CACXC,MAAOL,GAEX,OACA,4BAAQJ,UAAU,SAASU,MAAOF,GAAlC,aAAqDL,I,MClB1CQ,MARf,WACI,OACI,yBAAKC,GAAG,iBAAiBZ,UAAU,SAC/B,yBAAKY,GAAG,a,OCoBLC,E,4MAtBXC,eAAiB,CACbC,UAAW,SACXN,MAAO,UACPO,eAAgB,gB,uDAEV,IAAD,OACL,OACI,yBAAKhB,UAAU,aACX,2BAAOiB,KAAK,WACZC,QAASC,KAAKC,MAAMC,KAAKC,UACzBC,SAAY,kBAAM,EAAKH,MAAMI,aAAa,EAAKJ,MAAMC,KAAKT,OAC1D,6BACI,uBAAGZ,UAAU,OAAOU,MAAOS,KAAKC,MAAMC,KAAKC,UAAYH,KAAKL,eAAi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OAAOD,GAEPrC,KAAKsB,UAAS,WACV,MAAO,CACHN,MAAOmB,Q,+BAIT,IAAD,OACCI,EAAyC,IAA5BvC,KAAKe,MAAMC,MAAMwB,OAAgB,8BAAc,yBAAK3D,UAAU,aAAf,IAA8BmB,KAAKe,MAAMC,MAAMS,KAAI,SAACvB,GAAD,OAAU,kBAAC,EAAD,CAC3HuC,IAAKvC,EAAKT,GACVS,KAAMA,EACNG,aAAc,EAAKA,aACnBG,SAAU,EAAKA,cAJ+C,KAQlE,OACI,6BACI,yBAAK3B,UAAU,6CACX,0BAAM6D,SAAU1C,KAAKiB,SACjB,2BACInB,KAAK,OACL6C,IAAK,SAACC,GAAD,OAAO,EAAKf,cAAgBe,GACjCC,YAAY,sBAEhB,4BAAQ/C,KAAK,UAAb,eAGPyC,O,GA7FM7B,aC+BRoC,E,kDA9Bb,aAAe,IAAD,8BACZ,gBACK/B,MAAQ,CACXgC,WAAW,GAHD,E,gEASZ/C,KAAKsB,SAAS,CACZyB,WAAW,M,+BAKb,OACE,6BACG/C,KAAKe,MAAMgC,UACV,kBAAC,EAAD,MACA,6BACE,kBAAC,EAAD,MACA,kBAAC,EAAD,MACA,kBAAC,EAAD,Y,GAvBMtC,IAAMC,WCKJsC,QACW,cAA7BC,OAAOC,SAASC,UAEe,UAA7BF,OAAOC,SAASC,UAEhBF,OAAOC,SAASC,SAASC,MACvB,2DCZNC,IAASC,OACP,kBAAC,IAAMC,WAAP,KACE,kBAAC,EAAD,OAEFC,SAASC,eAAe,SDyHpB,kBAAmBC,WACrBA,UAAUC,cAAcC,MACrBxC,MAAK,SAAAyC,GACJA,EAAaC,gBAEdC,OAAM,SAAAC,GACLC,QAAQD,MAAMA,EAAME,c","file":"static/js/main.53499bda.chunk.js","sourcesContent":["import React from \"react\";\n\nfunction Footer() {\n return(\n \n \n );\n}\n\nexport default Footer;","import React from 'react'\n\nfunction Header() {\n const date = new Date();\n const hours = date.getHours();\n let timeOfDay;\n let colorOfDay;\n \n if (hours<12) {\n timeOfDay = \"morning\";\n colorOfDay = \"white\";\n }\n else if (hours < 17) {\n timeOfDay = \"afternoon\";\n colorOfDay = \"orange\";\n }\n else if (hours < 22){\n timeOfDay = \"evening\";\n colorOfDay = \"purple\";\n }\n else{\n timeOfDay = \"night\";\n colorOfDay = \"black\";\n }\n\n const styles = {\n color: colorOfDay\n }\n return (\n
Hey! Good {timeOfDay}
\n );\n}\n\nexport default Header;\n","import React from \"react\";\nimport './LoadingPage.css';\n\nfunction LoadingPage() {\n return(\n
\n
\n
\n );\n}\n\nexport default LoadingPage;","import React from 'react';\n\nclass TodoItem extends React.Component {\n\n completedStyle = {\n fontStyle: \"italic\",\n color: \"#cdcdcd\",\n textDecoration: \"line-through\"\n }\n render() {\n return(\n
\n this.props.handleChange(this.props.item.id)}/>\n
\n

{this.props.item.text}

\n
\n
\n \n
\n
\n );\n } \n}\n\nexport default TodoItem;","import React, {Component} from \"react\";\nimport TodoItem from \"./TodoItem\";\nimport './TakeData.css';\nimport axios from 'axios';\n\naxios.defaults.baseURL = \"https://aqueous-cliffs-31660.herokuapp.com\";\n\nclass TakeData extends Component{\n constructor() {\n super()\n this.state = {\n todos: []\n }\n this.addItem = this.addItem.bind(this);\n this.handleChange = this.handleChange.bind(this);\n this.onDelete = this.onDelete.bind(this);\n }\n\n componentDidMount() {\n\t\taxios.get(\"/todo\").then(res => {\n\t\t\tthis.setState({ todos: res.data });\n \n\t\t});\n\t}\n\n handleChange(id) {\n const updatedTodos = this.state.todos.map(todo => {\n if (todo.id === id){\n todo.completed = !todo.completed\n axios.post('/todo', {\n id: todo.id,\n text: todo.text,\n completed: todo.completed\n })\n }\n return todo\n })\n this.setState(() => {\n return {\n todos: updatedTodos\n }\n });\n }\n\n addItem(e) {\n if (this._inputElement.value !== \"\") {\n var newItem = {\n text: this._inputElement.value,\n completed: false\n };\n\n axios.post('/todo', {\n text: newItem.text,\n completed: newItem.completed\n })\n\n this.setState((prevState) => {\n return {\n todos: prevState.todos.concat(newItem)\n };\n });\n \n this._inputElement.value = \"\";\n }\n \n e.preventDefault();\n }\n onDelete(id) {\n const newTodos = this.state.todos.filter((item) => item.id !== id);\n \n const URL = `/todo/${id}`;\n\t\taxios.delete(URL);\n \n this.setState(() => {\n return {\n todos: newTodos\n }\n });\n }\n render() {\n const todoItems = (this.state.todos.length === 0) ?
:
{ this.state.todos.map((item) => \n )\n }
\n\n return(\n
\n
\n
\n this._inputElement = a}\n placeholder=\"Insert your text!\">\n \n \n \n
\n {todoItems}\n
\n );\n }\n}\n\nexport default TakeData;","import React from 'react';\nimport './App.css';\nimport Footer from './components/Footer';\nimport Header from './components/Header';\nimport LoadingPage from \"./components/LoadingPage\";\nimport TakeData from './components/TakeData';\n\nclass App extends React.Component {\n constructor() {\n super();\n this.state = {\n isLoading: true\n\n }\n }\n\n componentDidMount() {\n this.setState({\n isLoading: false\n })\n }\n\n render() {\n return (\n
\n {this.state.isLoading ? \n :\n
\n
\n \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.0/8 are 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 headers: { 'Service-Worker': 'script' },\n })\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\n .then(registration => {\n registration.unregister();\n })\n .catch(error => {\n console.error(error.message);\n });\n }\n}\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport './index.css';\nimport App from './App';\nimport * as serviceWorker from './serviceWorker';\n\nReactDOM.render(\n \n \n ,\n document.getElementById('root')\n);\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":""}