Skip to content

Commit

Permalink
- checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
boriskovar-m2ms committed Nov 13, 2023
1 parent 362ec04 commit 63122eb
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 3 deletions.
3 changes: 2 additions & 1 deletion js/components/preview/molecule/hitNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
*/
import React, { memo } from 'react';
import { MoleculeList } from './moleculeList';
import { ObservationCmpList } from './observationCmpList';

const HitNavigator = memo(({ hideProjects }) => {
return <MoleculeList hideProjects={hideProjects} />;
return <ObservationCmpList hideProjects={hideProjects} />;
});

export default HitNavigator;
1 change: 1 addition & 0 deletions js/components/preview/molecule/observationCmpList.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ export const ObservationCmpList = memo(({ hideProjects }) => {
const isTagEditorOpen = useSelector(state => state.selectionReducers.tagEditorOpened);
const molForTagEditId = useSelector(state => state.selectionReducers.molForTagEdit);
const moleculesToEditIds = useSelector(state => state.selectionReducers.moleculesToEdit);
const obsCmpsToEditIds = useSelector(state => state.selectionReducers.obsCmpsToEdit);
const isGlobalEdit = useSelector(state => state.selectionReducers.isGlobalEdit);

const object_selection = useSelector(state => state.selectionReducers.mol_group_selection);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ import { MOL_TYPE } from '../redux/constants';
import { DensityMapsModal } from '../modals/densityMapsModal';
import { getRandomColor } from '../utils/color';
import { DEFAULT_TAG_COLOR, getAllTagsForMol } from '../../tags/utils/tagUtils';
import MoleculeSelectCheckbox from './moleculeSelectCheckbox';
import useClipboard from 'react-use-clipboard';
import Popover from '@mui/material/Popover';
import Typography from '@mui/material/Typography';
import { Edit } from '@material-ui/icons';
import { DJANGO_CONTEXT } from '../../../../utils/djangoContext';
import { getFontColorByBackgroundColor } from '../../../../utils/colors';
import MoleculeSelectCheckbox from '../moleculeView/moleculeSelectCheckbox';

const useStyles = makeStyles(theme => ({
container: {
Expand Down Expand Up @@ -928,7 +928,7 @@ const ObservationCmpView = memo(
});
};

let moleculeTitle = data?.code.replace(new RegExp(`${target_on_name}-`, 'i'), '');
let moleculeTitle = data.smiles;

const moleculeLPCControlButtonDisabled = ['ligand', 'protein', 'complex'].some(
type => disableMoleculeNglControlButtons[type]
Expand Down
21 changes: 21 additions & 0 deletions js/reducers/selection/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,27 @@ export const removeFromMolListToEdit = molId => {
};
};

export const setObsCmpListToEdit = list => {
return {
type: constants.SET_OBS_MOL_LIST_TO_EDIT,
list: list
};
};

export const appendToObsCmpListToEdit = cmpId => {
return {
type: constants.APPEND_TO_OBS_MOL_LIST_TO_EDIT,
cmpId: cmpId
};
};

export const removeFromObsCmpListToEdit = cmpId => {
return {
type: constants.REMOVE_FROM_OBS_MOL_LIST_TO_EDIT,
molId: cmpId
};
};

export const setTagToEdit = tag => {
return {
type: constants.SET_TAG_TO_EDIT,
Expand Down
4 changes: 4 additions & 0 deletions js/reducers/selection/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ export const constants = {
APPEND_TO_MOL_LIST_TO_EDIT: prefix + 'APPEND_TO_MOL_LIST_TO_EDIT',
REMOVE_FROM_MOL_LIST_TO_EDIT: prefix + 'REMOVE_FROM_MOL_LIST_TO_EDIT',

SET_OBS_MOL_LIST_TO_EDIT: prefix + 'SET_OBS_MOL_LIST_TO_EDIT',
APPEND_TO_OBS_MOL_LIST_TO_EDIT: prefix + 'APPEND_TO_OBS_MOL_LIST_TO_EDIT',
REMOVE_FROM_OBS_MOL_LIST_TO_EDIT: prefix + 'REMOVE_FROM_OBS_MOL_LIST_TO_EDIT',

SET_TAG_TO_EDIT: prefix + 'SET_TAG_TO_EDIT',
SET_DISPLAY_ALL_MOLECULES: prefix + 'SET_DISPLAY_ALL_MOLECULES',
SET_DISPLAY_UNTAGGED_MOLECULES: prefix + 'SET_DISPLAY_UNTAGGED_MOLECULES',
Expand Down
12 changes: 12 additions & 0 deletions js/reducers/selection/selectionReducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export const INITIAL_STATE = {
currentVector: null, // selected vector smile (ID) of compoundsOfVectors
moleculesToEdit: [],

obsCmpsToEdit: [],

// tags
tagToEdit: null,
//display all molecules in hit navigator regardless of the tag selection
Expand Down Expand Up @@ -425,6 +427,16 @@ export function selectionReducers(state = INITIAL_STATE, action = {}) {
let reducedMolListToEdit = state.moleculesToEdit.filter(mid => mid !== action.molId);
return { ...state, moleculesToEdit: [...reducedMolListToEdit] };

case constants.SET_OBS_MOL_LIST_TO_EDIT:
return { ...state, obsCmpsToEdit: [...action.list] };

case constants.APPEND_TO_OBS_MOL_LIST_TO_EDIT:
return { ...state, obsCmpsToEdit: [...state.obsCmpsToEdit, action.cmpId] };

case constants.REMOVE_FROM_OBS_MOL_LIST_TO_EDIT:
let reducedObsCmpListToEdit = state.obsCmpsToEdit.filter(cid => cid !== action.cmpId);
return { ...state, obsCmpsToEdit: [...reducedObsCmpListToEdit] };

case constants.SET_TAG_TO_EDIT: {
return Object.assign({}, state, {
tagToEdit: action.tagToEdit
Expand Down

0 comments on commit 63122eb

Please sign in to comment.