mirror of
https://github.com/TrentSPalmer/fcc-challenges.git
synced 2024-11-16 10:11:30 -08:00
1 line
17 KiB
Plaintext
1 line
17 KiB
Plaintext
{"version":3,"sources":["actions/quoteFetchActionCreator.js","reducers/rootReducer.js","reducers/colorCounterReducer.js","actions/colorCounterAction.js","reducers/asyncQuoteReducer.js","store.js","NewQuote.js","TweetQuote.js","TextAuthor.js","QuoteBox.js","App.js","serviceWorker.js","index.js"],"names":["quoteFetchActionCreator","dispatch","type","fetch","then","response","json","quotes","newQuote","Math","floor","random","length","combineReducers","colorCount","state","action","count","fetching","quote","store","createStore","rootReducer","applyMiddleware","thunk","NewQuote","props","handleClick","bind","this","colorCounterAction","quoteFetch","newQuoteClass","onClick","className","id","React","Component","connect","TweetQuote","colors","tweetQuoteClass","href","encodeURIComponent","author","target","rel","icon","faTwitter","TextAuthor","textClass","authorClass","QuoteBox","quoteBoxClass","App","appHeaderClass","Boolean","window","location","hostname","match","ReactDOM","render","document","getElementById","navigator","serviceWorker","ready","registration","unregister","catch","error","console","message"],"mappings":"uWAgBaA,EAA0B,WACrC,OAAO,SAAUC,GACfA,EAPK,CACLC,KAX4B,qBAkB5BC,MACE,0IAECC,MAAK,SAAAC,GAAQ,OAAIA,EAASC,UAC1BF,MAAK,SAAAG,GACJN,EApBC,CACLC,KAL0B,iBAM1BM,SAoBQD,EAAOA,OAAOE,KAAKC,MAAMD,KAAKE,SAAWJ,EAAOA,OAAOK,gBCtBpDC,cAAgB,CAC7BC,WCHa,WAAwB,IAAvBC,EAAsB,uDAAd,EAAGC,EAAW,uCACpC,OAAQA,EAAOd,MACb,ICJyB,gBDKvB,OAAOc,EAAOC,MAChB,QACE,OAAOF,IDDXP,SGHa,WAAqD,IAApDO,EAAmD,uDAA3C,CAAEG,UAAU,EAAOC,MAAO,IAAMH,EAAW,uCACjE,OAAQA,EAAOd,MACb,IJJ4B,mBIK1B,MAAO,CAAEgB,UAAU,EAAMC,MAAO,IAClC,IJP0B,iBIQxB,MAAO,CAA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UAEhBF,OAAOC,SAASC,SAASC,MACvB,2DCTNC,IAASC,OACP,kBAAC,IAAD,CAAU1C,MAAOA,GACf,kBAAC,EAAD,OAEF2C,SAASC,eAAe,SDsHpB,kBAAmBC,WACrBA,UAAUC,cAAcC,MACrB/D,MAAK,SAACgE,GACLA,EAAaC,gBAEdC,OAAM,SAACC,GACNC,QAAQD,MAAMA,EAAME,c","file":"static/js/main.13413d36.chunk.js","sourcesContent":["export const RECEIVED_QUOTE = \"RECEIVED_QUOTE\";\nexport const REQUESTING_QUOTE = \"REQUESTING_QUOTE\";\n\nexport const receivedQuoteAction = quote => {\n return {\n type: RECEIVED_QUOTE,\n newQuote: quote\n };\n};\n\nexport const requestingQuoteAction = () => {\n return {\n type: REQUESTING_QUOTE\n };\n};\n\nexport const quoteFetchActionCreator = () => {\n return function (dispatch) {\n dispatch(requestingQuoteAction());\n fetch(\n \"https://gist.githubusercontent.com/camperbot/5a022b72e96c4c9585c32bf6a75f62d9/raw/e3c6895ce42069f0ee7e991229064f167fe8ccdc/quotes.json\"\n )\n .then(response => response.json())\n .then(quotes => {\n dispatch(\n receivedQuoteAction(\n quotes.quotes[Math.floor(Math.random() * quotes.quotes.length)]\n )\n );\n });\n };\n};\n","import { combineReducers } from \"redux\";\nimport colorCounterReducer from \"./colorCounterReducer\";\nimport asyncQuoteReducer from \"./asyncQuoteReducer\";\n\nexport default combineReducers({\n colorCount: colorCounterReducer,\n newQuote: asyncQuoteReducer,\n});\n","import { INCCOLORCOUNT } from \"../actions/colorCounterAction\";\n\nexport default (state = 1, action) => {\n switch (action.type) {\n case INCCOLORCOUNT:\n return action.count;\n default:\n return state;\n }\n};\n","export const INCCOLORCOUNT = \"INCCOLORCOUNT\";\n\nexport const colorCounterAction = (count) => {\n return {\n type: INCCOLORCOUNT,\n count: count,\n };\n};\n","import { REQUESTING_QUOTE } from \"../actions/quoteFetchActionCreator\";\nimport { RECEIVED_QUOTE } from \"../actions/quoteFetchActionCreator\";\n\nexport default (state = { fetching: false, quote: \"\" }, action) => {\n switch (action.type) {\n case REQUESTING_QUOTE:\n return { fetching: true, quote: \"\" };\n case RECEIVED_QUOTE:\n return { fetching: false, quote: action.newQuote };\n default:\n return state;\n }\n};\n","import { createStore, applyMiddleware } from \"redux\";\nimport thunk from \"redux-thunk\";\nimport rootReducer from \"./reducers/rootReducer\";\n\nconst store = createStore(rootReducer, applyMiddleware(thunk));\n\nexport default store;\n","import React from \"react\";\nimport { connect } from \"react-redux\";\n\nimport \"./NewQuote.css\";\n\nimport { colorCounterAction } from \"./actions/colorCounterAction\";\nimport { quoteFetchActionCreator } from \"./actions/quoteFetchActionCreator\";\n\nconst mapStateToProps = (state) => ({ ...state });\n\nconst mapDispatchToProps = (dispatch) => ({\n colorCounterAction: (count) => dispatch(colorCounterAction(count)),\n quoteFetch: () => dispatch(quoteFetchActionCreator()),\n});\n\nclass NewQuote extends React.Component {\n constructor(props) {\n super(props);\n this.handleClick = this.handleClick.bind(this);\n }\n\n handleClick() {\n this.props.colorCounterAction(\n this.props.colorCount > 1 ? 0 : this.props.colorCount + 1\n );\n this.props.quoteFetch();\n }\n\n render() {\n const colors = [\"red-background\", \"blue-background\", \"yellow-background\"];\n const newQuoteClass = \"NewQuote \" + colors[this.props.colorCount];\n return (\n <button onClick={this.handleClick} className={newQuoteClass} id=\"new-quote\">\n Click Me!\n </button>\n );\n }\n}\n\nexport default connect(mapStateToProps, mapDispatchToProps)(NewQuote);\n","import React from \"react\";\nimport { connect } from \"react-redux\";\n\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport { faTwitter } from \"@fortawesome/free-brands-svg-icons\";\n\nimport \"./TweetQuote.css\";\n\nconst mapStateToProps = state => ({ ...state });\n\nclass TweetQuote extends React.Component {\n render() {\n const colors = [\"red-background\", \"blue-background\", \"yellow-background\"];\n const tweetQuoteClass = \"TweetQuote \" + colors[this.props.colorCount];\n let href = \"https://twitter.com/intent/tweet?text=\";\n if (typeof this.props.newQuote.quote === \"object\") {\n href += encodeURIComponent(\n this.props.newQuote.quote.quote +\n \"\\n--\" +\n this.props.newQuote.quote.author\n );\n }\n return (\n <div className={tweetQuoteClass}>\n <a href={href} target=\"_blank\" rel=\"noopener noreferrer\" id=\"tweet-quote\">\n <FontAwesomeIcon icon={faTwitter} className={colors[this.props.colorCount]}/>\n </a>\n </div>\n );\n }\n}\n\nexport default connect(mapStateToProps)(TweetQuote);\n","import React from \"react\";\nimport { connect } from \"react-redux\";\n\nimport \"./TextAuthor.css\";\nimport { quoteFetchActionCreator } from \"./actions/quoteFetchActionCreator\";\n\nconst mapStateToProps = state => ({ ...state });\n\nconst mapDispatchToProps = dispatch => ({\n quoteFetch: () => dispatch(quoteFetchActionCreator())\n});\n\nclass TextAuthor extends React.Component {\n componentDidMount() {\n if (this.props.newQuote.quote === \"\") {\n this.props.quoteFetch();\n }\n }\n render() {\n let quote = \"\";\n let author = \"\";\n if (typeof this.props.newQuote.quote === \"object\") {\n quote = this.props.newQuote.quote.quote;\n author = this.props.newQuote.quote.author;\n }\n const colors = [\"red\", \"blue\", \"yellow\"];\n const textClass = \"text \" + colors[this.props.colorCount];\n const authorClass = \"author \" + colors[this.props.colorCount];\n return (\n <div>\n <p className={textClass} id=\"text\">\n {quote}\n </p>\n <p className={authorClass} id=\"author\">\n --{author}\n </p>\n </div>\n );\n }\n}\n\nexport default connect(mapStateToProps, mapDispatchToProps)(TextAuthor);\n","import React from \"react\";\nimport { connect } from \"react-redux\";\n\nimport \"./QuoteBox.css\";\nimport NewQuote from \"./NewQuote\";\nimport TweetQuote from \"./TweetQuote\";\nimport TextAuthor from \"./TextAuthor\";\n\nconst mapStateToProps = (state) => ({ ...state });\n\nclass QuoteBox extends React.Component {\n render() {\n const colors = [\n \"red-complimentary-background\",\n \"blue-complimentary-background\",\n \"yellow-complimentary-background\",\n ];\n const quoteBoxClass = \"QuoteBox \" + colors[this.props.colorCount];\n return (\n <div className={quoteBoxClass} id=\"quote-box\">\n <div className=\"quote-box-top\">\n </div>\n <div className=\"quote-box-middle\">\n <TextAuthor />\n </div>\n <div className=\"quote-box-bottom\">\n <div className=\"quote-box-bottom-left\">\n <TweetQuote />\n </div>\n <div className=\"quote-box-bottom-right\">\n <NewQuote />\n </div>\n </div>\n <div className=\"quote-box-underneath\">\n </div>\n </div>\n );\n }\n}\n\nexport default connect(mapStateToProps)(QuoteBox);\n","import React from \"react\";\nimport { connect } from \"react-redux\";\n\nimport \"./App.css\";\nimport QuoteBox from \"./QuoteBox\";\n\nconst mapStateToProps = (state) => ({ ...state });\n\nclass App extends React.Component {\n render() {\n const colors = [\"red-background\", \"blue-background\", \"yellow-background\"];\n const appHeaderClass = \"App-header \" + colors[this.props.colorCount];\n return (\n <div className=\"App\">\n <header className={appHeaderClass}>\n <QuoteBox />\n </header>\n </div>\n );\n }\n}\n\nexport default connect(mapStateToProps)(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 { Provider } from \"react-redux\";\nimport store from \"./store\";\n\nimport \"./index.css\";\nimport App from \"./App\";\nimport * as serviceWorker from \"./serviceWorker\";\n\nReactDOM.render(\n <Provider store={store}>\n <App />\n </Provider>,\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":""} |