From a665ed53bbe132ab1d2751ed09a521479d58ca09 Mon Sep 17 00:00:00 2001 From: matej Date: Sun, 28 Apr 2024 23:23:25 +0200 Subject: [PATCH] #1261 added buttons into observation dialog for later poses handling --- .../preview/molecule/observationsDialog.js | 99 ++++++++++++++++++- 1 file changed, 98 insertions(+), 1 deletion(-) diff --git a/js/components/preview/molecule/observationsDialog.js b/js/components/preview/molecule/observationsDialog.js index 23299b842..1e6a51a06 100644 --- a/js/components/preview/molecule/observationsDialog.js +++ b/js/components/preview/molecule/observationsDialog.js @@ -32,11 +32,13 @@ import SearchField from '../../common/Components/SearchField'; import GroupNglControlButtonsContext from './groupNglControlButtonsContext'; import MoleculeView from './moleculeView'; import { TagEditor } from '../tags/modal/tagEditor'; +import { ToastContext } from '../../toast'; +import { DJANGO_CONTEXT } from '../../../utils/djangoContext'; const useStyles = makeStyles(theme => ({ paper: { width: 472, - height: 294, + // minHeight: 294, overflowY: 'hidden' }, molHeader: { @@ -112,6 +114,39 @@ const useStyles = makeStyles(theme => ({ backgroundColor: theme.palette.primary.semidark //color: theme.palette.black } + }, + contColButtonBottomRow: { + border: '1px solid' + }, + bottomRow: { + marginTop: theme.spacing(1) / 4 + }, + dropdownContent: { + display: 'none', + position: 'absolute', + backgroundColor: theme.palette.primary.contrastText, + maxWidth: 150, + marginTop: -1, + border: '1px solid', + borderColor: theme.palette.primary.main, + // color: theme.palette.primary.contrastText, + // boxShadow: '0px 8px 16px 0px rgba(0, 0, 0, 0.2)', + zIndex: 1 + }, + dropdownItem: { + fontSize: 12, + // fontWeight: 'bold', + paddingLeft: theme.spacing(1) / 4, + paddingRight: theme.spacing(1) / 4, + '&:hover': { + cursor: 'pointer', + backgroundColor: theme.palette.primary.light + } + }, + dropdown: { + '&:hover $dropdownContent': { + display: 'flex' + } } })); @@ -127,6 +162,7 @@ export const ObservationsDialog = memo( const selectedAll = useRef(false); const { getNglView } = useContext(NglContext); + const { toastInfo } = useContext(ToastContext); const stage = getNglView(VIEWS.MAJOR_VIEW) && getNglView(VIEWS.MAJOR_VIEW).stage; const isLoadingInspirationListOfMolecules = useSelector( @@ -304,6 +340,20 @@ export const ObservationsDialog = memo( buttonState => buttonState ); + const handleSetAsGroupName = () => { + toastInfo('calling handleSetAsGroupName!', { autoHideDuration: 5000 }); + }; + const handleSetMainObservation = () => { + toastInfo('calling handleSetMainObservation!', { autoHideDuration: 5000 }); + }; + const handleManageGrouping = (poseId) => { + if (poseId === 0) { + toastInfo(`calling handleManageGrouping and creating new pose from selection`, { autoHideDuration: 5000 }); + } else { + toastInfo(`calling handleManageGrouping for pose with id ${poseId}`, { autoHideDuration: 5000 }); + } + }; + // TODO refactor to this line return ( @@ -465,6 +515,53 @@ export const ObservationsDialog = memo( )} + {DJANGO_CONTEXT.pk && + + + + + + + + + + handleManageGrouping(0)}>new group from selection + {/* TODO just a placeholder for poses here */} + {[{ id: 1, label: '1x' }, { id: 2, label: '2x' }, { id: 3, label: '3x' }].map(pose => + handleManageGrouping(pose.id)}>add selection to {pose.label} + )} + + + } )} {isLoadingInspirationListOfMolecules === true && (