4671a0eb7a68d0c6c93250cea451c7c8.json 12.9 KB
Newer Older
Mathias Engelbrecht Pilegård's avatar
Mathias Engelbrecht Pilegård committed
1
{"ast":null,"code":"var _jsxFileName = \"C:\\\\Users\\\\Bruger\\\\Desktop\\\\Web-projects\\\\pipit\\\\client\\\\src\\\\pages\\\\account\\\\Account.jsx\",\n    _s = $RefreshSig$();\n\n// rfce\nimport React, { useState, useEffect } from 'react';\nimport \"./Account.css\";\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { useOktaAuth } from '@okta/okta-react';\nimport ConfirmRemoveAccountModal from \"./confirmRemoveAccountModal/ConfirmRemoveAccountModal\";\nimport UpdateUserDataModal from './updateUserData/UpdateUserDataModal';\nimport ChangePassword from '../../components/changePassword/ChangePassword';\nimport RemoveAccount from '../../components/removeAccount/RemoveAccount';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\n\nfunction Account() {\n  _s();\n\n  const {\n    authState,\n    oktaAuth\n  } = useOktaAuth();\n  const [userInfo, setUserInfo] = useState(null);\n  const [name, setName] = useState('');\n  const [email, setEmail] = useState('');\n  const [updateUserDataModalState, setUpdateUserDataModalState] = useState(false);\n\n  const toggleUpdateUserDataModalState = () => setUpdateUserDataModalState(!updateUserDataModalState);\n\n  useEffect(() => {\n    if (!authState.isAuthenticated) {\n      // When user isn't authenticated, forget any user info\n      setUserInfo(null);\n    } else if (authState.isAuthenticated && updateUserDataModalState == false) {\n      oktaAuth.getUser().then(info => {\n        setUserInfo(info);\n      });\n    }\n  }, [authState, oktaAuth, updateUserDataModalState]); // Update if authState changes\n\n  useEffect(() => {\n    userInfo && setName(userInfo.name);\n    userInfo && setEmail(userInfo.email);\n  }, [userInfo]);\n  return /*#__PURE__*/_jsxDEV(\"div\", {\n    className: \"page-content-container\",\n    children: [/*#__PURE__*/_jsxDEV(\"div\", {\n      className: \"content-header\",\n      children: /*#__PURE__*/_jsxDEV(\"h2\", {\n        className: \"welcome-text\",\n        children: \"Account information\"\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 46,\n        columnNumber: 9\n      }, this)\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 45,\n      columnNumber: 7\n    }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n      className: \"accountpage-content\",\n      children: [/*#__PURE__*/_jsxDEV(\"div\", {\n        className: \"personal-information-container\",\n        children: [/*#__PURE__*/_jsxDEV(\"div\", {\n          className: \"container-header\",\n          children: [/*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n            icon: \"user-circle\",\n            className: \"user-icon\"\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 52,\n            columnNumber: 13\n          }, this), /*#__PURE__*/_jsxDEV(\"h5\", {\n            children: \"Personal information\"\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 53,\n            columnNumber: 13\n          }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n            onClick: toggleUpdateUserDataModalState,\n            children: [/*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n              icon: \"pen\",\n              className: \"pen-icon\"\n            }, void 0, false, {\n              fileName: _jsxFileName,\n              lineNumber: 55,\n              columnNumber: 15\n            }, this), \"Edit\"]\n          }, void 0, true, {\n            fileName: _jsxFileName,\n            lineNumber: 54,\n            columnNumber: 13\n          }, this)]\n        }, void 0, true, {\n          fileName: _jsxFileName,\n          lineNumber: 51,\n          columnNumber: 11\n        }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n          className: \"content\",\n          children: /*#__PURE__*/_jsxDEV(\"ul\", {\n            children: [/*#__PURE__*/_jsxDEV(\"li\", {\n              children: /*#__PURE__*/_jsxDEV(\"b\", {\n                children: \"Name:\"\n              }, void 0, false, {\n                fileName: _jsxFileName,\n                lineNumber: 62,\n                columnNumber: 17\n              }, this)\n            }, void 0, false, {\n              fileName: _jsxFileName,\n              lineNumber: 61,\n              columnNumber: 15\n            }, this), /*#__PURE__*/_jsxDEV(\"li\", {\n              children: userInfo ? name : \"Fetching name\"\n            }, void 0, false, {\n              fileName: _jsxFileName,\n              lineNumber: 64,\n              columnNumber: 15\n            }, this), /*#__PURE__*/_jsxDEV(\"li\", {\n              children: /*#__PURE__*/_jsxDEV(\"b\", {\n                children: \"Email\"\n              }, void 0, false, {\n                fileName: _jsxFileName,\n                lineNumber: 68,\n                columnNumber: 17\n              }, this)\n            }, void 0, false, {\n              fileName: _jsxFileName,\n              lineNumber: 67,\n              columnNumber: 15\n            }, this), /*#__PURE__*/_jsxDEV(\"li\", {\n              children: userInfo ? email : \"Fetching email\"\n            }, void 0, false, {\n              fileName: _jsxFileName,\n              lineNumber: 70,\n              columnNumber: 15\n            }, this)]\n          }, void 0, true, {\n            fileName: _jsxFileName,\n            lineNumber: 60,\n            columnNumber: 13\n          }, this)\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 59,\n          columnNumber: 11\n        }, this)]\n      }, void 0, true, {\n        fileName: _jsxFileName,\n        lineNumber: 50,\n        columnNumber: 9\n      }, this), /*#__PURE__*/_jsxDEV(ChangePassword, {}, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 77,\n        columnNumber: 9\n      }, this), /*#__PURE__*/_jsxDEV(RemoveAccount, {}, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 78,\n        columnNumber: 9\n      }, this)]\n    }, void 0, true, {\n      fileName: _jsxFileName,\n      lineNumber: 48,\n      columnNumber: 7\n    }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n      className: `modal ${updateUserDataModalState ? \"active\" : \"inactive\"}`,\n      children: /*#__PURE__*/_jsxDEV(UpdateUserDataModal, {\n        removeModal: () => setUpdateUserDataModalState(false)\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 81,\n        columnNumber: 9\n      }, this)\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 80,\n      columnNumber: 7\n    }, this)]\n  }, void 0, true, {\n    fileName: _jsxFileName,\n    lineNumber: 44,\n    columnNumber: 5\n  }, this);\n}\n\n_s(Account, \"TVJKyWZdBHB4T7R5lFB40t17n2E=\", false, function () {\n  return [useOktaAuth];\n});\n\n_c = Account;\nexport default Account;\n\nvar _c;\n\n$RefreshReg$(_c, \"Account\");","map":{"version":3,"sources":["C:/Users/Bruger/Desktop/Web-projects/pipit/client/src/pages/account/Account.jsx"],"names":["React","useState","useEffect","FontAwesomeIcon","useOktaAuth","ConfirmRemoveAccountModal","UpdateUserDataModal","ChangePassword","RemoveAccount","Account","authState","oktaAuth","userInfo","setUserInfo","name","setName","email","setEmail","updateUserDataModalState","setUpdateUserDataModalState","toggleUpdateUserDataModalState","isAuthenticated","getUser","then","info"],"mappings":";;;AAAA;AACA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,QAA2C,OAA3C;AACA,OAAO,eAAP;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,SAASC,WAAT,QAA4B,kBAA5B;AACA,OAAOC,yBAAP,MAAsC,uDAAtC;AACA,OAAOC,mBAAP,MAAgC,sCAAhC;AACA,OAAOC,cAAP,MAA2B,gDAA3B;AACA,OAAOC,aAAP,MAA0B,8CAA1B;;;AAEA,SAASC,OAAT,GAAmB;AAAA;;AACjB,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BP,WAAW,EAA3C;AACA,QAAM,CAACQ,QAAD,EAAWC,WAAX,IAA0BZ,QAAQ,CAAC,IAAD,CAAxC;AAEA,QAAM,CAACa,IAAD,EAAOC,OAAP,IAAkBd,QAAQ,CAAC,EAAD,CAAhC;AACA,QAAM,CAACe,KAAD,EAAQC,QAAR,IAAoBhB,QAAQ,CAAC,EAAD,CAAlC;AAEA,QAAM,CAACiB,wBAAD,EAA2BC,2BAA3B,IAA0DlB,QAAQ,CAAC,KAAD,CAAxE;;AACA,QAAMmB,8BAA8B,GAAG,MAAMD,2BAA2B,CAAC,CAACD,wBAAF,CAAxE;;AAEAhB,EAAAA,SAAS,CAAC,MAA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oBADF;AAAA;AAAA;AAAA;AAAA;AAAA,kBAHF;AAAA;AAAA;AAAA;AAAA;AAAA,gBADF,eASE;AAAK,UAAA,SAAS,EAAC,SAAf;AAAA,iCACE;AAAA,oCACE;AAAA,qCACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,oBADF,eAIE;AAAA,wBACGR,QAAQ,GAAGE,IAAH,GAAU;AADrB;AAAA;AAAA;AAAA;AAAA,oBAJF,eAOE;AAAA,qCACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,oBAPF,eAUE;AAAA,wBACGF,QAAQ,GAAGI,KAAH,GAAW;AADtB;AAAA;AAAA;AAAA;AAAA,oBAVF;AAAA;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,gBATF;AAAA;AAAA;AAAA;AAAA;AAAA,cAFF,eA6BE,QAAC,cAAD;AAAA;AAAA;AAAA;AAAA,cA7BF,eA8BE,QAAC,aAAD;AAAA;AAAA;AAAA;AAAA,cA9BF;AAAA;AAAA;AAAA;AAAA;AAAA,YAJF,eAoCE;AAAK,MAAA,SAAS,EAAG,SAAQE,wBAAwB,GAAG,QAAH,GAAc,UAAW,EAA1E;AAAA,6BACE,QAAC,mBAAD;AAAqB,QAAA,WAAW,EAAE,MAAMC,2BAA2B,CAAC,KAAD;AAAnE;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YApCF;AAAA;AAAA;AAAA;AAAA;AAAA,UADF;AA0CD;;GA1EQV,O;UACyBL,W;;;KADzBK,O;AA4ET,eAAeA,OAAf","sourcesContent":["// rfce\r\nimport React, { useState, useEffect } from 'react'\r\nimport \"./Account.css\"\r\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\r\nimport { useOktaAuth } from '@okta/okta-react';\r\nimport ConfirmRemoveAccountModal from \"./confirmRemoveAccountModal/ConfirmRemoveAccountModal\"\r\nimport UpdateUserDataModal from './updateUserData/UpdateUserDataModal';\r\nimport ChangePassword from '../../components/changePassword/ChangePassword';\r\nimport RemoveAccount from '../../components/removeAccount/RemoveAccount';\r\n\r\nfunction Account() {\r\n  const { authState, oktaAuth } = useOktaAuth();\r\n  const [userInfo, setUserInfo] = useState(null);\r\n\r\n  const [name, setName] = useState('')\r\n  const [email, setEmail] = useState('');\r\n\r\n  const [updateUserDataModalState, setUpdateUserDataModalState] = useState(false)\r\n  const toggleUpdateUserDataModalState = () => setUpdateUserDataModalState(!updateUserDataModalState)\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 if (authState.isAuthenticated && updateUserDataModalState == false) {\r\n      oktaAuth.getUser().then(info => {\r\n        setUserInfo(info);\r\n      });\r\n    }\r\n  }, [authState, oktaAuth, updateUserDataModalState]); // Update if authState changes\r\n\r\n  useEffect(() => {\r\n    userInfo && (\r\n      setName(userInfo.name)\r\n    )\r\n\r\n    userInfo && (\r\n      setEmail(userInfo.email)\r\n    )\r\n  }, [userInfo])\r\n\r\n\r\n  return (\r\n    <div className=\"page-content-container\">\r\n      <div className=\"content-header\">\r\n        <h2 className=\"welcome-text\">Account information</h2>\r\n      </div>\r\n      <div className=\"accountpage-content\">\r\n\r\n        <div className=\"personal-information-container\">\r\n          <div className=\"container-header\">\r\n            <FontAwesomeIcon icon=\"user-circle\" className=\"user-icon\"></FontAwesomeIcon>\r\n            <h5>Personal information</h5>\r\n            <button onClick={toggleUpdateUserDataModalState}>\r\n              <FontAwesomeIcon icon=\"pen\" className=\"pen-icon\"></FontAwesomeIcon>\r\n              Edit\r\n            </button>\r\n          </div>\r\n          <div className=\"content\">\r\n            <ul>\r\n              <li>\r\n                <b>Name:</b>\r\n              </li>\r\n              <li>\r\n                {userInfo ? name : \"Fetching name\"}\r\n              </li>\r\n              <li>\r\n                <b>Email</b>\r\n              </li>\r\n              <li>\r\n                {userInfo ? email : \"Fetching email\"}\r\n              </li>\r\n            </ul>\r\n          </div>\r\n        </div>\r\n\r\n        <ChangePassword />\r\n        <RemoveAccount />\r\n      </div>\r\n      <div className={`modal ${updateUserDataModalState ? \"active\" : \"inactive\"}`}>\r\n        <UpdateUserDataModal removeModal={() => setUpdateUserDataModalState(false)} />\r\n      </div>\r\n    </div>\r\n  )\r\n}\r\n\r\nexport default Account\r\n"]},"metadata":{},"sourceType":"module"}