From 207eca619eb17b0f5021753f5faec02fdeb9daf3 Mon Sep 17 00:00:00 2001 From: Tibor Postek Date: Wed, 22 Apr 2020 14:53:54 +0200 Subject: [PATCH] #276 move share button --- js/components/preview/projectHistory/index.js | 64 +------------------ .../snapshot/withSnapshotManagement.js | 31 ++++++++- 2 files changed, 32 insertions(+), 63 deletions(-) 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={[ - , @@ -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 , + , ]); // setSnackBarTitle('Currently no active session.');