Commit b4f619b2 authored by Mathias Engelbrecht Pilegård's avatar Mathias Engelbrecht Pilegård
Browse files

added dynamic navbar view based on authenticated state and dynamic welcome message

parent 79d8fbc3
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\components\\\\home\\\\Home.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect } from 'react';\nimport { useOktaAuth } from \"@okta/okta-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 oktaAuth.token.getUserInfo().then(info => {\n setUserInfo(info);\n });\n console.log(userInfo);\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.given_name, \"!\"]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 21,\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: 24,\n columnNumber: 13\n }, this), \"\\xA0\\xA0Report issues\"]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 23,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 22,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 20,\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: 30,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 29,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 19,\n columnNumber: 5\n }, this);\n};\n\n_s(Home, \"8yuPb+f/kHytdzQyGlcPn6/UuWY=\", 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":["React","useState","useEffect","useOktaAuth","NavLink","FontAwesomeIcon","Updates","Home","authState","oktaAuth","userInfo","setUserInfo","token","getUserInfo","then","info","console","log","given_name"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,QAA2C,OAA3C;AACA,SAASC,WAAT,QAA4B,kBAA5B;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,MAA0BN,WAAW,EAA3C;AACA,QAAM,CAACO,QAAD,EAAWC,WAAX,IAA0BV,QAAQ,CAAC,IAAD,CAAxC;AAEAQ,EAAAA,QAAQ,CAACG,KAAT,CAAeC,WAAf,GAA6BC,IAA7B,CAAkCC,IAAI,IAAI;AACxCJ,IAAAA,WAAW,CAACI,IAAD,CAAX;AACD,GAFD;AAIAC,EAAAA,OAAO,CAACC,GAAR,CAAYP,QAAZ;AAEA,sBACE;AAAK,IAAA,SAAS,EAAC,oBAAf;AAAA,4BACE;AAAK,MAAA,SAAS,EAAC,gBAAf;AAAA,8BACE;AAAI,QAAA,SAAS,EAAC,cAAd;AAAA,+BAAsCA,QAAQ,CAACQ,UAA/C;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,CA1BD;;GAAMX,I;UAC4BJ,W;;;KAD5BI,I;AA4BN,eAAeA,IAAf","sourcesContent":["import React, { useState, useEffect } from 'react'\r\nimport { useOktaAuth } from \"@okta/okta-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 oktaAuth.token.getUserInfo().then(info => {\r\n setUserInfo(info);\r\n })\r\n\r\n console.log(userInfo)\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.given_name}!</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"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\components\\\\home\\\\Home.jsx\",\n _s = $RefreshSig$();\n\nimport React, { useState, useEffect } from 'react';\nimport { useOktaAuth } from \"@okta/okta-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 oktaAuth.getUser().then(info => {\n setUserInfo(info);\n });\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 Mathias!\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 22,\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: 25,\n columnNumber: 13\n }, this), \"\\xA0\\xA0Report issues\"]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 24,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 23,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 21,\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: 31,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 30,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 20,\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":["React","useState","useEffect","useOktaAuth","NavLink","FontAwesomeIcon","Updates","Home","authState","oktaAuth","userInfo","setUserInfo","getUser","then","info"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,QAA2C,OAA3C;AACA,SAASC,WAAT,QAA4B,kBAA5B;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,MAA0BN,WAAW,EAA3C;AACA,QAAM,CAACO,QAAD,EAAWC,WAAX,IAA0BV,QAAQ,CAAC,IAAD,CAAxC;AAEAC,EAAAA,SAAS,CAAC,MAAM;AACdO,IAAAA,QAAQ,CAACG,OAAT,GAAmBC,IAAnB,CAAwBC,IAAI,IAAI;AAC9BH,MAAAA,WAAW,CAACG,IAAD,CAAX;AACD,KAFD;AAGD,GAJQ,CAAT;AAOA,sBACE;AAAK,IAAA,SAAS,EAAC,oBAAf;AAAA,4BACE;AAAK,MAAA,SAAS,EAAC,gBAAf;AAAA,8BACE;AAAI,QAAA,SAAS,EAAC,cAAd;AAAA;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,CA3BD;;GAAMP,I;UAC4BJ,W;;;KAD5BI,I;AA6BN,eAAeA,IAAf","sourcesContent":["import React, { useState, useEffect } from 'react'\r\nimport { useOktaAuth } from \"@okta/okta-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 oktaAuth.getUser().then(info => {\r\n setUserInfo(info)\r\n })\r\n })\r\n\r\n\r\n return (\r\n <div className=\"homepage-container\">\r\n <div className=\"content-header\">\r\n <h2 className=\"welcome-text\">Welcome Mathias!</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"}
\ No newline at end of file
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\components\\\\navbar\\\\loginButton\\\\LoginButton.jsx\";\nimport React, { useRef, useState, useEffect } from 'react';\nimport \"./LoginButton.css\";\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nconst LoginButton = () => {\n const login = () => oktaAuth.signInWithRedirect({\n originalUri: '/home'\n });\n\n return /*#__PURE__*/_jsxDEV(\"div\", {\n className: \"loginButtonContainer\",\n children: /*#__PURE__*/_jsxDEV(\"button\", {\n onClick: login,\n children: [\"Log in\\xA0\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n icon: \"sign-in-alt\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 12,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 10,\n columnNumber: 7\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 9,\n columnNumber: 5\n }, this);\n};\n\n_c = LoginButton;\nexport default LoginButton;\n\nvar _c;\n\n$RefreshReg$(_c, \"LoginButton\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/components/navbar/loginButton/LoginButton.jsx"],"names":["React","useRef","useState","useEffect","FontAwesomeIcon","LoginButton","login","oktaAuth","signInWithRedirect","originalUri"],"mappings":";AAAA,OAAOA,KAAP,IAAgBC,MAAhB,EAAwBC,QAAxB,EAAkCC,SAAlC,QAAmD,OAAnD;AACA,OAAO,mBAAP;AACA,SAASC,eAAT,QAAgC,gCAAhC;;;AAEA,MAAMC,WAAW,GAAG,MAAM;AACxB,QAAMC,KAAK,GAAG,MAAMC,QAAQ,CAACC,kBAAT,CAA4B;AAAEC,IAAAA,WAAW,EAAE;AAAf,GAA5B,CAApB;;AAEA,sBACE;AAAK,IAAA,SAAS,EAAC,sBAAf;AAAA,2BACE;AAAQ,MAAA,OAAO,EAAEH,KAAjB;AAAA,gDAEE,QAAC,eAAD;AAAiB,QAAA,IAAI,EAAC;AAAtB;AAAA;AAAA;AAAA;AAAA,cAFF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,UADF;AAQD,CAXD;;KAAMD,W;AAaN,eAAeA,WAAf","sourcesContent":["import React, { useRef, useState, useEffect } from 'react'\r\nimport \"./LoginButton.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\n\r\nconst LoginButton = () => {\r\n const login = () => oktaAuth.signInWithRedirect({ originalUri: '/home' })\r\n\r\n return (\r\n <div className=\"loginButtonContainer\">\r\n <button onClick={login}>\r\n Log in&nbsp;&nbsp;\r\n <FontAwesomeIcon icon=\"sign-in-alt\"></FontAwesomeIcon>\r\n </button>\r\n </div>\r\n )\r\n}\r\n\r\nexport default LoginButton"]},"metadata":{},"sourceType":"module"}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment