diff --git a/client/modules/IDE/components/Header/Nav.jsx b/client/modules/IDE/components/Header/Nav.jsx index 591f9b5740..52c9e77751 100644 --- a/client/modules/IDE/components/Header/Nav.jsx +++ b/client/modules/IDE/components/Header/Nav.jsx @@ -1,4 +1,4 @@ -import React, { useContext } from 'react'; +import React, { useContext, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { sortBy } from 'lodash'; import { Link } from 'react-router-dom'; @@ -31,6 +31,8 @@ import { import { logoutUser } from '../../../User/actions'; import { CmControllerContext } from '../../pages/IDEView'; import MobileNav from './MobileNav'; +import Modal from '../Modal'; +import Button from '../../../../common/Button'; const Nav = ({ layout }) => ( @@ -306,39 +308,71 @@ const UnauthenticatedUserMenu = () => { const AuthenticatedUserMenu = () => { const username = useSelector((state) => state.user.username); + const [isModalOpen, setIsModalOpen] = useState(false); + const dispatch = useDispatch(); + const handleCancel = () => setIsModalOpen(false); + const handleConfirm = () => { + dispatch(logoutUser()); + setIsModalOpen(false); + }; const { t } = useTranslation(); - const dispatch = useDispatch(); return ( - + ); }; diff --git a/client/modules/IDE/components/Header/__snapshots__/Nav.unit.test.jsx.snap b/client/modules/IDE/components/Header/__snapshots__/Nav.unit.test.jsx.snap index bbfcb41e6e..b4301440a1 100644 --- a/client/modules/IDE/components/Header/__snapshots__/Nav.unit.test.jsx.snap +++ b/client/modules/IDE/components/Header/__snapshots__/Nav.unit.test.jsx.snap @@ -330,7 +330,7 @@ exports[`Nav renders dashboard version for mobile 1`] = ` >