diff --git a/client/modules/IDE/components/Header/Nav.jsx b/client/modules/IDE/components/Header/Nav.jsx
index 28995a2d56..dd8d52357b 100644
--- a/client/modules/IDE/components/Header/Nav.jsx
+++ b/client/modules/IDE/components/Header/Nav.jsx
@@ -1,7 +1,7 @@
import React, { useContext } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { sortBy } from 'lodash';
-import { Link } from 'react-router-dom';
+import { Link, useHistory } from 'react-router-dom';
import PropTypes from 'prop-types';
import { useTranslation } from 'react-i18next';
import { MenubarSubmenu } from '../../../../components/Menubar/MenubarSubmenu';
@@ -25,7 +25,8 @@ import {
newFolder,
showKeyboardShortcutModal,
startSketch,
- stopSketch
+ stopSketch,
+ showErrorModal
} from '../../actions/ide';
import { logoutUser } from '../../../User/actions';
import { CmControllerContext } from '../../pages/IDEView';
@@ -34,7 +35,6 @@ import useIsMobile from '../../hooks/useIsMobile';
const Nav = ({ layout }) => {
const isMobile = useIsMobile();
-
return isMobile ? (
) : (
@@ -160,6 +160,7 @@ const ProjectMenu = () => {
const cmRef = useContext(CmControllerContext);
const dispatch = useDispatch();
+ const history = useHistory();
const { t } = useTranslation();
const {
@@ -182,12 +183,14 @@ const ProjectMenu = () => {
saveSketch(cmRef.current)}
+ isDisabled={!isLoginEnabled || (project?.owner && !isUserOwner)}
+ onClick={() => {
+ if (!user.authenticated) {
+ dispatch(showErrorModal('forceAuthentication'));
+ return;
+ }
+ saveSketch(cmRef.current);
+ }}
>
{t('Common.Save')}
{metaKeyName}+S
@@ -222,10 +225,16 @@ const ProjectMenu = () => {
{
+ if (!user.authenticated) {
+ dispatch(showErrorModal('forceAuthentication'));
+ return;
+ }
+ history.push(
+ `/${user.username}/sketches/${project?.id}/add-to-collection`
+ );
+ }}
>
{t('Nav.File.AddToCollection')}