3d598f7bf119d81e15fc9260b8b26cb8.json 5.84 KB
Newer Older
1
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\components\\\\home\\\\Home.jsx\",\n    _s = $RefreshSig$();\n\nimport { useOktaAuth } from \"@okta/okta-react\";\nimport React, { useState, useEffect } from 'react';\nimport { NavLink } from 'react-router-dom';\nimport \"./Home.css\";\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport Updates from './updates/Updates';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst Home = () => {\n  _s();\n\n  const {\n    authState,\n    oktaAuth\n  } = useOktaAuth();\n  const [userInfo, setUserInfo] = useState(null);\n  useEffect(() => {\n    if (!authState.isAuthenticated) {\n      // When user isn't authenticated, forget any user info\n      setUserInfo(null);\n    } else {\n      oktaAuth.token.getUserInfo().then(info => {\n        setUserInfo(info);\n      });\n    }\n  }, [authState, oktaAuth]); // Update if authState changes\n\n  return /*#__PURE__*/_jsxDEV(\"div\", {\n    className: \"homepage-container\",\n    children: [/*#__PURE__*/_jsxDEV(\"div\", {\n      className: \"content-header\",\n      children: [/*#__PURE__*/_jsxDEV(\"h2\", {\n        className: \"welcome-text\",\n        children: [\"Welcome \", userInfo ? userInfo.given_name : null, \"!\"]\n      }, void 0, true, {\n        fileName: _jsxFileName,\n        lineNumber: 26,\n        columnNumber: 9\n      }, this), /*#__PURE__*/_jsxDEV(NavLink, {\n        to: \"/reportissue\",\n        children: /*#__PURE__*/_jsxDEV(\"button\", {\n          className: \"report-new-issue-button\",\n          children: [/*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n            icon: \"exclamation-triangle\"\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 29,\n            columnNumber: 13\n          }, this), \"\\xA0\\xA0Report issues\"]\n        }, void 0, true, {\n          fileName: _jsxFileName,\n          lineNumber: 28,\n          columnNumber: 11\n        }, this)\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 27,\n        columnNumber: 9\n      }, this)]\n    }, void 0, true, {\n      fileName: _jsxFileName,\n      lineNumber: 25,\n      columnNumber: 7\n    }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n      className: \"homepage-content\",\n      children: /*#__PURE__*/_jsxDEV(Updates, {}, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 35,\n        columnNumber: 9\n      }, this)\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 34,\n      columnNumber: 7\n    }, this)]\n  }, void 0, true, {\n    fileName: _jsxFileName,\n    lineNumber: 24,\n    columnNumber: 5\n  }, this);\n};\n\n_s(Home, \"/7FunoA1ejJNU8uKGTy1GZFqU2I=\", false, function () {\n  return [useOktaAuth];\n});\n\n_c = Home;\nexport default Home;\n\nvar _c;\n\n$RefreshReg$(_c, \"Home\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/home/Home.jsx"],"names":["useOktaAuth","React","useState","useEffect","NavLink","FontAwesomeIcon","Updates","Home","authState","oktaAuth","userInfo","setUserInfo","isAuthenticated","token","getUserInfo","then","info","given_name"],"mappings":";;;AAAA,SAASA,WAAT,QAA4B,kBAA5B;AACA,OAAOC,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,QAA2C,OAA3C;AACA,SAASC,OAAT,QAAwB,kBAAxB;AACA,OAAO,YAAP;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,OAAOC,OAAP,MAAoB,mBAApB;;;AAEA,MAAMC,IAAI,GAAG,MAAM;AAAA;;AACjB,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BT,WAAW,EAA3C;AACA,QAAM,CAACU,QAAD,EAAWC,WAAX,IAA0BT,QAAQ,CAAC,IAAD,CAAxC;AAEAC,EAAAA,SAAS,CAAC,MAAM;AACd,QAAI,CAACK,SAAS,CAACI,eAAf,EAAgC;AAC9B;AACAD,MAAAA,WAAW,CAAC,IAAD,CAAX;AACD,KAHD,MAGO;AACLF,MAAAA,QAAQ,CAACI,KAAT,CAAeC,WAAf,GAA6BC,IAA7B,CAAkCC,IAAI,IAAI;AACxCL,QAAAA,WAAW,CAACK,IAAD,CAAX;AACD,OAFD;AAGD;AACF,GATQ,EASN,CAACR,SAAD,EAAYC,QAAZ,CATM,CAAT,CAJiB,CAaU;;AAE3B,sBACE;AAAK,IAAA,SAAS,EAAC,oBAAf;AAAA,4BACE;AAAK,MAAA,SAAS,EAAC,gBAAf;AAAA,8BACE;AAAI,QAAA,SAAS,EAAC,cAAd;AAAA,+BAAsCC,QAAQ,GAAGA,QAAQ,CAACO,UAAZ,GAAyB,IAAvE;AAAA;AAAA;AAAA;AAAA;AAAA,cADF,eAEE,QAAC,OAAD;AAAS,QAAA,EAAE,EAAC,cAAZ;AAAA,+BACE;AAAQ,UAAA,SAAS,EAAC,yBAAlB;AAAA,kCACE,QAAC,eAAD;AAAiB,YAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,kBADF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,cAFF;AAAA;AAAA;AAAA;AAAA;AAAA,YADF,eAUE;AAAK,MAAA,SAAS,EAAC,kBAAf;AAAA,6BACE,QAAC,OAAD;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YAVF;AAAA;AAAA;AAAA;AAAA;AAAA,UADF;AAgBD,CA/BD;;GAAMV,I;UAC4BP,W;;;KAD5BO,I;AAiCN,eAAeA,IAAf","sourcesContent":["import { useOktaAuth } from \"@okta/okta-react\";\r\nimport React, { useState, useEffect } from 'react'\r\nimport { NavLink } from 'react-router-dom'\r\nimport \"./Home.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport Updates from './updates/Updates'\r\n\r\nconst Home = () => {\r\n  const { authState, oktaAuth } = useOktaAuth();\r\n  const [userInfo, setUserInfo] = useState(null);\r\n\r\n  useEffect(() => {\r\n    if (!authState.isAuthenticated) {\r\n      // When user isn't authenticated, forget any user info\r\n      setUserInfo(null);\r\n    } else {\r\n      oktaAuth.token.getUserInfo().then(info => {\r\n        setUserInfo(info);\r\n      });\r\n    }\r\n  }, [authState, oktaAuth]); // Update if authState changes\r\n\r\n  return (\r\n    <div className=\"homepage-container\">\r\n      <div className=\"content-header\">\r\n        <h2 className=\"welcome-text\">Welcome {userInfo ? userInfo.given_name : null}!</h2>\r\n        <NavLink to=\"/reportissue\">\r\n          <button className=\"report-new-issue-button\">\r\n            <FontAwesomeIcon icon=\"exclamation-triangle\"></FontAwesomeIcon>\r\n            &nbsp;&nbsp;Report issues\r\n          </button>\r\n        </NavLink>\r\n      </div>\r\n      <div className=\"homepage-content\">\r\n        <Updates />\r\n      </div>\r\n    </div>\r\n  )\r\n}\r\n\r\nexport default Home"]},"metadata":{},"sourceType":"module"}