34ca9862cb8fd43dba1c9b5269a616e1.json 25.3 KB
Newer Older
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 { 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 {\n      oktaAuth.getUser().then(info => {\n        setUserInfo(info);\n      });\n      setName(userInfo.name);\n      setEmail(userInfo.email);\n    }\n  }, [authState, oktaAuth]); // Update if authState changes\n  // useEffect(() => {\n  //   if (updateUserDataModalState == false && authState.isAuthenticated) {\n  //     window.location.reload(false)\n  //   }\n  // }, [updateUserDataModalState])\n\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(\"div\", {\n        className: \"change-password-container\",\n        children: [/*#__PURE__*/_jsxDEV(\"div\", {\n          className: \"container-header\",\n          children: [/*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n            icon: \"lock\",\n            className: \"lock-icon\"\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 79,\n            columnNumber: 13\n          }, this), /*#__PURE__*/_jsxDEV(\"h5\", {\n            children: \"Change password\"\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 80,\n            columnNumber: 13\n          }, this)]\n        }, void 0, true, {\n          fileName: _jsxFileName,\n          lineNumber: 78,\n          columnNumber: 11\n        }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n          className: \"content\",\n          children: [/*#__PURE__*/_jsxDEV(\"p\", {\n            children: \"Password requirements:\"\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 83,\n            columnNumber: 13\n          }, this), /*#__PURE__*/_jsxDEV(\"ul\", {\n            children: [/*#__PURE__*/_jsxDEV(\"li\", {\n              children: \"At least 8 characters\"\n            }, void 0, false, {\n              fileName: _jsxFileName,\n              lineNumber: 85,\n              columnNumber: 15\n            }, this), /*#__PURE__*/_jsxDEV(\"li\", {\n              children: \"No parts of username may be included\"\n            }, void 0, false, {\n              fileName: _jsxFileName,\n              lineNumber: 88,\n              columnNumber: 15\n            }, this), /*#__PURE__*/_jsxDEV(\"li\", {\n              children: \"Your password may not be any of the last 4 passwords\"\n            }, void 0, false, {\n              fileName: _jsxFileName,\n              lineNumber: 91,\n              columnNumber: 15\n            }, this)]\n          }, void 0, true, {\n            fileName: _jsxFileName,\n            lineNumber: 84,\n            columnNumber: 13\n          }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n            children: /*#__PURE__*/_jsxDEV(\"div\", {\n              className: \"reset-password-form-container\",\n              children: [/*#__PURE__*/_jsxDEV(\"div\", {\n                className: \"form-item\",\n                children: [/*#__PURE__*/_jsxDEV(\"label\", {\n                  children: \"Old password\"\n                }, void 0, false, {\n                  fileName: _jsxFileName,\n                  lineNumber: 98,\n                  columnNumber: 19\n                }, this), /*#__PURE__*/_jsxDEV(\"input\", {\n                  type: \"password\"\n                }, void 0, false, {\n                  fileName: _jsxFileName,\n                  lineNumber: 101,\n                  columnNumber: 19\n                }, this)]\n              }, void 0, true, {\n                fileName: _jsxFileName,\n                lineNumber: 97,\n                columnNumber: 17\n              }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n                className: \"form-item\",\n                children: [/*#__PURE__*/_jsxDEV(\"label\", {\n                  children: \"New password\"\n                }, void 0, false, {\n                  fileName: _jsxFileName,\n                  lineNumber: 104,\n                  columnNumber: 19\n                }, this), /*#__PURE__*/_jsxDEV(\"input\", {\n                  type: \"password\"\n                }, void 0, false, {\n                  fileName: _jsxFileName,\n                  lineNumber: 107,\n                  columnNumber: 19\n                }, this)]\n              }, void 0, true, {\n                fileName: _jsxFileName,\n                lineNumber: 103,\n                columnNumber: 17\n              }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n                className: \"form-item\",\n                children: [/*#__PURE__*/_jsxDEV(\"label\", {\n                  children: \"Confirm new password\"\n                }, void 0, false, {\n                  fileName: _jsxFileName,\n                  lineNumber: 110,\n                  columnNumber: 19\n                }, this), /*#__PURE__*/_jsxDEV(\"input\", {\n                  type: \"password\"\n                }, void 0, false, {\n                  fileName: _jsxFileName,\n                  lineNumber: 113,\n                  columnNumber: 19\n                }, this)]\n              }, void 0, true, {\n                fileName: _jsxFileName,\n                lineNumber: 109,\n                columnNumber: 17\n              }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n                className: \"form-item\",\n                children: /*#__PURE__*/_jsxDEV(\"button\", {\n                  className: \"passwordResetSubmitButton\",\n                  type: \"submit\",\n                  children: [\"Submit\\xA0\", /*#__PURE__*/_jsxDEV(FontAwesomeIcon, {\n                    icon: \"arrow-right\"\n                  }, void 0, false, {\n                    fileName: _jsxFileName,\n                    lineNumber: 118,\n                    columnNumber: 21\n                  }, this)]\n                }, void 0, true, {\n                  fileName: _jsxFileName,\n                  lineNumber: 116,\n                  columnNumber: 19\n                }, this)\n              }, void 0, false, {\n                fileName: _jsxFileName,\n                lineNumber: 115,\n                columnNumber: 17\n              }, this)]\n            }, void 0, true, {\n              fileName: _jsxFileName,\n              lineNumber: 96,\n              columnNumber: 15\n            }, this)\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 95,\n            columnNumber: 13\n          }, this)]\n        }, void 0, true, {\n          fileName: _jsxFileName,\n          lineNumber: 82,\n          columnNumber: 11\n        }, this)]\n      }, void 0, true, {\n        fileName: _jsxFileName,\n        lineNumber: 77,\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: 128,\n            columnNumber: 13\n          }, this), /*#__PURE__*/_jsxDEV(\"h5\", {\n            children: \"Delete account\"\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 129,\n            columnNumber: 13\n          }, this)]\n        }, void 0, true, {\n          fileName: _jsxFileName,\n          lineNumber: 127,\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: 132,\n            columnNumber: 13\n          }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n            onClick: toggleConfirmAccountRemoveModalState,\n            children: \"Delete\"\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 135,\n            columnNumber: 13\n          }, this)]\n        }, void 0, true, {\n          fileName: _jsxFileName,\n          lineNumber: 131,\n          columnNumber: 11\n        }, this)]\n      }, void 0, true, {\n        fileName: _jsxFileName,\n        lineNumber: 126,\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 ${confirmAccountRemoveModalState ? \"active\" : \"inactive\"}`,\n      children: /*#__PURE__*/_jsxDEV(ConfirmRemoveAccountModal, {\n        removeModal: () => setConfirmAccountRemoveModalState(false)\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 142,\n        columnNumber: 9\n      }, this)\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 141,\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: 145,\n        columnNumber: 9\n      }, this)\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 144,\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, \"XNo6TrBEQ1oiCl8zS0kKyIhS9CY=\", 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","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;;;AAEA,SAASC,OAAT,GAAmB;AAAA;;AACjB,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAA0BL,WAAW,EAA3C;AACA,QAAM,CAACM,QAAD,EAAWC,WAAX,IAA0BV,QAAQ,CAAC,IAAD,CAAxC;AAEA,QAAM,CAACW,IAAD,EAAOC,OAAP,IAAkBZ,QAAQ,CAAC,EAAD,CAAhC;AACA,QAAM,CAACa,KAAD,EAAQC,QAAR,IAAoBd,QAAQ,CAAC,EAAD,CAAlC;AAEA,QAAM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;AAAA,kCACE,QAAC,eAAD;AAAiB,YAAA,IAAI,EAAC,OAAtB;AAA8B,YAAA,SAAS,EAAC;AAAxC;AAAA;AAAA;AAAA;AAAA,kBADF,eAEE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAFF;AAAA;AAAA;AAAA;AAAA;AAAA,gBADF,eAKE;AAAK,UAAA,SAAS,EAAC,SAAf;AAAA,kCACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBADF,eAIE;AAAQ,YAAA,OAAO,EAAEO,oCAAjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAJF;AAAA;AAAA;AAAA;AAAA;AAAA,gBALF;AAAA;AAAA;AAAA;AAAA;AAAA,cA9EF;AAAA;AAAA;AAAA;AAAA;AAAA,YAJF,eAiGE;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,YAjGF,eAoGE;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,YApGF;AAAA;AAAA;AAAA;AAAA;AAAA,UADF;AA0GD;;GA5IQV,O;UACyBH,W;;;KADzBG,O;AA8IT,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\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 {\r\n      oktaAuth.getUser().then(info => {\r\n        setUserInfo(info);\r\n      });\r\n\r\n      setName(userInfo.name)\r\n      setEmail(userInfo.email)\r\n    }\r\n  }, [authState, oktaAuth]); // Update if authState changes\r\n\r\n  // useEffect(() => {\r\n  //   if (updateUserDataModalState == false && authState.isAuthenticated) {\r\n  //     window.location.reload(false)\r\n  //   }\r\n  // }, [updateUserDataModalState])\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        <div className=\"change-password-container\">\r\n          <div className=\"container-header\">\r\n            <FontAwesomeIcon icon=\"lock\" className=\"lock-icon\"></FontAwesomeIcon>\r\n            <h5>Change password</h5>\r\n          </div>\r\n          <div className=\"content\">\r\n            <p>Password requirements:</p>\r\n            <ul>\r\n              <li>\r\n                At least 8 characters\r\n              </li>\r\n              <li>\r\n                No parts of username may be included\r\n              </li>\r\n              <li>\r\n                Your password may not be any of the last 4 passwords\r\n              </li>\r\n            </ul>\r\n            <form>\r\n              <div className=\"reset-password-form-container\">\r\n                <div className=\"form-item\">\r\n                  <label>\r\n                    Old password\r\n                  </label>\r\n                  <input type=\"password\"></input>\r\n                </div>\r\n                <div className=\"form-item\">\r\n                  <label>\r\n                    New password\r\n                  </label>\r\n                  <input type=\"password\"></input>\r\n                </div>\r\n                <div className=\"form-item\">\r\n                  <label>\r\n                    Confirm new password\r\n                  </label>\r\n                  <input type=\"password\"></input>\r\n                </div>\r\n                <div className=\"form-item\">\r\n                  <button className=\"passwordResetSubmitButton\" type=\"submit\">\r\n                    Submit&nbsp;\r\n                    <FontAwesomeIcon icon=\"arrow-right\"></FontAwesomeIcon>\r\n                  </button>\r\n                </div>\r\n              </div>\r\n            </form>\r\n          </div>\r\n        </div>\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\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"}