diff --git a/js/components/preview/projectHistory/index.js b/js/components/preview/projectHistory/index.js
index 199458e87..ae0978fad 100644
--- a/js/components/preview/projectHistory/index.js
+++ b/js/components/preview/projectHistory/index.js
@@ -1,27 +1,15 @@
import React, { memo, useContext, useEffect, useRef } from 'react';
import { Panel } from '../../common/Surfaces/Panel';
-import {
- Grid,
- IconButton,
- Typography,
- Table,
- TableBody,
- TableRow,
- TableCell,
- TableHead,
- makeStyles
-} from '@material-ui/core';
import { templateExtend, TemplateName, Orientation, Gitgraph } from '@gitgraph/react';
-import { MergeType, Share } from '@material-ui/icons';
+import { MergeType } from '@material-ui/icons';
+import { makeStyles } from '@material-ui/core';
import { Button } from '../../common/Inputs/Button';
import { useDispatch, useSelector } from 'react-redux';
import { useHistory, useRouteMatch } from 'react-router-dom';
-import { base_url, URLS } from '../../routes/constants';
import { loadSnapshotTree } from '../../projects/redux/dispatchActions';
import palette from '../../../theme/palette';
import { ModalShareSnapshot } from '../../snapshot/modals/modalShareSnapshot';
-import { setIsOpenModalBeforeExit, setSelectedSnapshotToSwitch, setSharedSnapshot } from '../../snapshot/redux/actions';
-import { resetReducersBetweenSnapshots, switchBetweenSnapshots } from '../redux/dispatchActions';
+import { setIsOpenModalBeforeExit, setSelectedSnapshotToSwitch } from '../../snapshot/redux/actions';
import { NglContext } from '../../nglView/nglProvider';
export const heightOfProjectHistory = '164px';
@@ -86,11 +74,7 @@ export const ProjectHistory = memo(({ setHeight, showFullHistory }) => {
let match = useRouteMatch();
const projectID = match && match.params && match.params.projectId;
const snapshotId = match && match.params && match.params.snapshotId;
-
- const currentProjectID = useSelector(state => state.projectReducers.currentProject.projectID);
const currentSnapshotID = useSelector(state => state.projectReducers.currentSnapshot.id);
- const currentSnapshotTitle = useSelector(state => state.projectReducers.currentSnapshot.title);
- const currentSnapshotDescription = useSelector(state => state.projectReducers.currentSnapshot.description);
const currentSnapshotList = useSelector(state => state.projectReducers.currentSnapshotList);
const currentSnapshotTree = useSelector(state => state.projectReducers.currentSnapshotTree);
const isLoadingTree = useSelector(state => state.projectReducers.isLoadingTree);
@@ -146,23 +130,6 @@ export const ProjectHistory = memo(({ setHeight, showFullHistory }) => {
hasHeader
title="Project History"
headerActions={[
- }
- onClick={() => {
- dispatch(
- setSharedSnapshot({
- title: currentSnapshotTitle,
- description: currentSnapshotDescription,
- url: `${base_url}${URLS.projects}${currentProjectID}/${currentSnapshotID}`
- })
- );
- }}
- >
- Share
- ,
}>
Detail
@@ -202,31 +169,6 @@ export const ProjectHistory = memo(({ setHeight, showFullHistory }) => {
)}
- {/**/}
- {/* */}
- {/* */}
- {/* */}
- {/* Title*/}
- {/* Author*/}
- {/* Created*/}
- {/* */}
- {/* */}
- {/* */}
- {/* */}
- {/* */}
- {/* {snapshotDetail.name}*/}
- {/* */}
- {/* */}
- {/* {snapshotDetail.author && snapshotDetail.author.username},*/}
- {/* {snapshotDetail.author && snapshotDetail.author.email}*/}
- {/* */}
- {/* */}
- {/* {snapshotDetail.created && moment(snapshotDetail.created).format('LLL')}*/}
- {/* */}
- {/* */}
- {/* */}
- {/*
*/}
- {/**/}
>
diff --git a/js/components/snapshot/withSnapshotManagement.js b/js/components/snapshot/withSnapshotManagement.js
index df7d5f1c8..6d1b9c20e 100644
--- a/js/components/snapshot/withSnapshotManagement.js
+++ b/js/components/snapshot/withSnapshotManagement.js
@@ -1,14 +1,15 @@
import React, { memo, useContext, useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { Button } from '@material-ui/core';
-import { Save } from '@material-ui/icons';
+import { Save, Share } from '@material-ui/icons';
import DownloadPdb from './downloadPdb';
import { savingStateConst } from './constants';
import { HeaderContext } from '../header/headerContext';
-import { setOpenSnapshotSavingDialog } from './redux/actions';
+import { setOpenSnapshotSavingDialog, setSharedSnapshot } from './redux/actions';
import { useRouteMatch } from 'react-router-dom';
import { DJANGO_CONTEXT } from '../../utils/djangoContext';
import { useDisableUserInteraction } from '../helpers/useEnableUserInteracion';
+import { base_url, URLS } from '../routes/constants';
/**
* Created by ricgillams on 13/06/2018.
@@ -22,6 +23,10 @@ export const withSnapshotManagement = WrappedComponent => {
const savingState = useSelector(state => state.apiReducers.savingState);
const sessionTitle = useSelector(state => state.apiReducers.sessionTitle);
+ const currentSnapshotID = useSelector(state => state.projectReducers.currentSnapshot.id);
+ const currentSnapshotTitle = useSelector(state => state.projectReducers.currentSnapshot.title);
+ const currentSnapshotDescription = useSelector(state => state.projectReducers.currentSnapshot.description);
+
const targetIdList = useSelector(state => state.apiReducers.target_id_list);
const targetName = useSelector(state => state.apiReducers.target_on_name);
const currentProject = useSelector(state => state.projectReducers.currentProject);
@@ -51,6 +56,28 @@ export const withSnapshotManagement = WrappedComponent => {
>
Save
,
+ }
+ disabled={
+ !enableButton ||
+ disableUserInteraction ||
+ currentSnapshotID === null ||
+ (currentProject && currentProject.projectID === null)
+ }
+ onClick={() => {
+ dispatch(
+ setSharedSnapshot({
+ title: currentSnapshotTitle,
+ description: currentSnapshotDescription,
+ url: `${base_url}${URLS.projects}${currentProject.projectID}/${currentSnapshotID}`
+ })
+ );
+ }}
+ >
+ Share
+ ,
]);
// setSnackBarTitle('Currently no active session.');