4812864e1699be3ceed00b0c9f8e6817.json 16.7 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 { 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  const [confirmAccountRemoveModalState, setConfirmAccountRemoveModalState] = useState(false);\n\n  const toggleConfirmAccountRemoveModalState = () => setConfirmAccountRemoveModalState(!confirmAccountRemoveModalState);\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: 48,\n        columnNumber: 9\n      }, this)\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 47,\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: 54,\n            columnNumber: 13\n          }, this), /*#__PURE__*/_jsxDEV(\"h5\", {\n            children: \"Personal information\"\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 55,\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: 57,\n              columnNumber: 15\n            }, this), \"Edit\"]\n          }, void 0, true, {\n            fileName: _jsxFileName,\n            lineNumber: 56,\n            columnNumber: 13\n          }, this)]\n        }, void 0, true, {\n          fileName: _jsxFileName,\n          lineNumber: 53,\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: 64,\n                columnNumber: 17\n              }, this)\n            }, void 0, false, {\n              fileName: _jsxFileName,\n              lineNumber: 63,\n              columnNumber: 15\n            }, this), /*#__PURE__*/_jsxDEV(\"li\", {\n              children: userInfo ? name : \"Fetching name\"\n            }, void 0, false, {\n              fileName: _jsxFileName,\n              lineNumber: 66,\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: 70,\n                columnNumber: 17\n              }, this)\n            }, void 0, false, {\n              fileName: _jsxFileName,\n              lineNumber: 69,\n              columnNumber: 15\n            }, this), /*#__PURE__*/_jsxDEV(\"li\", {\n              children: userInfo ? email : \"Fetching email\"\n            }, void 0, false, {\n              fileName: _jsxFileName,\n              lineNumber: 72,\n              columnNumber: 15\n            }, this)]\n          }, void 0, true, {\n            fileName: _jsxFileName,\n            lineNumber: 62,\n            columnNumber: 13\n          }, this)\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 61,\n          columnNumber: 11\n        }, this)]\n      }, void 0, true, {\n        fileName: _jsxFileName,\n        lineNumber: 52,\n        columnNumber: 9\n      }, this), /*#__PURE__*/_jsxDEV(ChangePassword, {}, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 79,\n        columnNumber: 9\n      }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n        className: \"deactivate-account-container\",\n        children: [/*#__PURE__*/_jsxDEV(\"div\", {\n          className: \"container-header\",\n          children: [/*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n            icon: \"trash\",\n            className: \"trash-icon\"\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 83,\n            columnNumber: 13\n          }, this), /*#__PURE__*/_jsxDEV(\"h5\", {\n            children: \"Delete account\"\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 84,\n            columnNumber: 13\n          }, this)]\n        }, void 0, true, {\n          fileName: _jsxFileName,\n          lineNumber: 82,\n          columnNumber: 11\n        }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n          className: \"content\",\n          children: [/*#__PURE__*/_jsxDEV(\"p\", {\n            children: \"Your account and all your data will be permanently deleted\"\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 87,\n            columnNumber: 13\n          }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n            onClick: toggleConfirmAccountRemoveModalState,\n            children: \"Delete\\xA0\"\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 90,\n            columnNumber: 13\n          }, this)]\n        }, void 0, true, {\n          fileName: _jsxFileName,\n          lineNumber: 86,\n          columnNumber: 11\n        }, this)]\n      }, void 0, true, {\n        fileName: _jsxFileName,\n        lineNumber: 81,\n        columnNumber: 9\n      }, this)]\n    }, void 0, true, {\n      fileName: _jsxFileName,\n      lineNumber: 50,\n      columnNumber: 7\n    }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n      className: `modal ${confirmAccountRemoveModalState ? \"active\" : \"inactive\"}`,\n      children: /*#__PURE__*/_jsxDEV(ConfirmRemoveAccountModal, {\n        removeModal: () => setConfirmAccountRemoveModalState(false)\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 97,\n        columnNumber: 9\n      }, this)\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 96,\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: 100,\n        columnNumber: 9\n      }, this)\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 99,\n      columnNumber: 7\n    }, this)]\n  }, void 0, true, {\n    fileName: _jsxFileName,\n    lineNumber: 46,\n    columnNumber: 5\n  }, this);\n}\n\n_s(Account, \"mspcEj1apxAoqwV3paiS9+TXXfg=\", 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","Account","authState","oktaAuth","userInfo","setUserInfo","name","setName","email","setEmail","updateUserDataModalState","setUpdateUserDataModalState","toggleUpdateUserDataModalState","confirmAccountRemoveModalState","setConfirmAccountRemoveModalState","toggleConfirmAccountRemoveModalState","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;;;AAEA,SAASC,OAAT,GAAmB;AAAA;;AACjB,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BN,WAAW,EAA3C;AACA,QAAM,CAACO,QAAD,EAAWC,WAAX,IAA0BX,QAAQ,CAAC,IAAD,CAAxC;AAEA,QAAM,CAACY,IAAD,EAAOC,OAAP,IAAkBb,QAAQ,CAAC,EAAD,CAAhC;AACA,QAAM,CAACc,KAAD,EAAQC,QAAR,IAAoBf,QAAQ,CAAC,EAAD,CAAlC;AAEA,QAAM,CAACgB,wBAAD,EAA2BC,2BAA3B,IAA0DjB,QAAQ,CAAC,KAAD,CAAxE;;AACA,QAAMkB,8BAA8B,GAAG,MAAMD,2BAA2B,CAAC,CAACD,wBAAF,CAAxE;;AAEA,QAAM,CAACG,8BAAD,EAAiCC,iCAAjC,IAAsEpB,QAAQ,CAAC,KAAD,CAApF;;AACA,QA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;AAAA;AAAA;AAAA,cA/BF;AAAA;AAAA;AAAA;AAAA;AAAA,YAJF,eAkDE;AAAK,MAAA,SAAS,EAAG,SAAQF,8BAA8B,GAAG,QAAH,GAAc,UAAW,EAAhF;AAAA,6BACE,QAAC,yBAAD;AAA2B,QAAA,WAAW,EAAE,MAAMC,iCAAiC,CAAC,KAAD;AAA/E;AAAA;AAAA;AAAA;AAAA;AADF;AAAA;AAAA;AAAA;AAAA,YAlDF,eAqDE;AAAK,MAAA,SAAS,EAAG,SAAQJ,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,YArDF;AAAA;AAAA;AAAA;AAAA;AAAA,UADF;AA2DD;;GA9FQV,O;UACyBJ,W;;;KADzBI,O;AAgGT,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\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  const [confirmAccountRemoveModalState, setConfirmAccountRemoveModalState] = useState(false)\r\n  const toggleConfirmAccountRemoveModalState = () => setConfirmAccountRemoveModalState(!confirmAccountRemoveModalState)\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\r\n        <div className=\"deactivate-account-container\">\r\n          <div className=\"container-header\">\r\n            <FontAwesomeIcon icon=\"trash\" className=\"trash-icon\"></FontAwesomeIcon>\r\n            <h5>Delete account</h5>\r\n          </div>\r\n          <div className=\"content\">\r\n            <p>\r\n              Your account and all your data will be permanently deleted\r\n            </p>\r\n            <button onClick={toggleConfirmAccountRemoveModalState}>\r\n              Delete&nbsp;\r\n            </button>\r\n          </div>\r\n        </div>\r\n      </div>\r\n      <div className={`modal ${confirmAccountRemoveModalState ? \"active\" : \"inactive\"}`}>\r\n        <ConfirmRemoveAccountModal removeModal={() => setConfirmAccountRemoveModalState(false)} />\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"}