diff --git a/src/components/CheckBoxTree/index.tsx b/src/components/CheckBoxTree/index.tsx index 62754fbf..15b581aa 100644 --- a/src/components/CheckBoxTree/index.tsx +++ b/src/components/CheckBoxTree/index.tsx @@ -41,6 +41,7 @@ interface CheckBoxTreeProps { payloadForSelectAll: VisibilitySelectionMap; payloadForSelectNone: VisibilitySelectionMap; isSharedCheckboxIndeterminate: boolean; + colorInfoForPicker: any; //TODO: type this } const CHECKBOX_SPAN_NO = 2; const LABEL_SPAN_NO = 6; @@ -211,7 +212,12 @@ class CheckBoxTree extends React.Component { ); render() { - const { agentsHighlighted, treeData, agentsChecked } = this.props; + const { + agentsHighlighted, + treeData, + agentsChecked, + colorInfoForPicker, + } = this.props; return treeData.length > 0 ? (
@@ -252,6 +258,7 @@ class CheckBoxTree extends React.Component { color={nodeData.color} agentName={nodeData.title} tags={this.getAgentTags(nodeData.title)} + colorInfoForPicker={colorInfoForPicker} /> ; setRecentColors: ActionCreator; recentColors: string[]; + infoForPicker: any; // TODO: type this } const ColorPicker = ({ @@ -30,6 +31,7 @@ const ColorPicker = ({ tags, recentColors, setRecentColors, + infoForPicker, }: ColorPickerProps) => { const [color, setColor] = useState(oldColor); @@ -133,6 +135,9 @@ const ColorPicker = ({
); + // TODO: move the render function from popover to here, + // encapsulate this stuff into a function called "render picker content" or something and call + // that in content of popover }; const mapStateToProps = (state: any) => ({ diff --git a/src/components/ColorPickerPopover/index.tsx b/src/components/ColorPickerPopover/index.tsx index fdf8d421..161a95d4 100644 --- a/src/components/ColorPickerPopover/index.tsx +++ b/src/components/ColorPickerPopover/index.tsx @@ -10,6 +10,7 @@ interface ColorPickerPopoverProps { closeModal: () => void; agentName: string; tags: string[]; + colorInfoForPicker: any; // TODO: type this } const ColorPickerPopover = ({ @@ -18,6 +19,7 @@ const ColorPickerPopover = ({ closeModal, agentName, tags, + colorInfoForPicker, }: ColorPickerPopoverProps) => { return ( } placement="right" diff --git a/src/components/ColorSwatch/index.tsx b/src/components/ColorSwatch/index.tsx index 5c90472f..f46d41da 100644 --- a/src/components/ColorSwatch/index.tsx +++ b/src/components/ColorSwatch/index.tsx @@ -8,6 +8,7 @@ interface ColorSwatchProps { color: string; agentName: string; tags: string[]; + colorInfoForPicker: any; // TODO: type this } const ColorSwatch = ({ @@ -15,6 +16,7 @@ const ColorSwatch = ({ color, agentName, tags, + colorInfoForPicker, }: ColorSwatchProps): JSX.Element => { const [isColorPickerVisible, setColorPickerVisible] = useState(false); const [initialColor, setInitialColor] = useState(color); @@ -44,15 +46,14 @@ const ColorSwatch = ({ openModal(); }} /> - {isColorPickerVisible ? ( - - ) : null} + ); }; diff --git a/src/containers/ModelPanel/index.tsx b/src/containers/ModelPanel/index.tsx index 74b51132..975684d2 100644 --- a/src/containers/ModelPanel/index.tsx +++ b/src/containers/ModelPanel/index.tsx @@ -32,6 +32,7 @@ import { getSelectAllVisibilityMap, getSelectNoneVisibilityMap, getIsSharedCheckboxIndeterminate, + getColorInfoForPicker, } from "./selectors"; import { VIEWER_EMPTY, @@ -60,6 +61,7 @@ interface ModelPanelProps { viewerStatus: ViewerStatus; isNetworkedFile: boolean; changeToNetworkedFile: ActionCreator; + colorInfoForPicker: any; // TODO: type this } class ModelPanel extends React.Component { @@ -77,6 +79,7 @@ class ModelPanel extends React.Component { viewerStatus, isNetworkedFile, changeToNetworkedFile: loadNetworkFile, + colorInfoForPicker, } = this.props; const checkboxTree = ( { payloadForSelectAll={payloadForSelectAll} payloadForSelectNone={payloadForSelectNone} isSharedCheckboxIndeterminate={isSharedCheckboxIndeterminate} + colorInfoForPicker={colorInfoForPicker} /> ); const contentMap = { @@ -128,6 +132,7 @@ function mapStateToProps(state: State) { isSharedCheckboxIndeterminate: getIsSharedCheckboxIndeterminate(state), viewerStatus: getStatus(state), isNetworkedFile: getIsNetworkedFile(state), + colorInfoForPicker: getColorInfoForPicker(state), }; } diff --git a/src/containers/ModelPanel/selectors.ts b/src/containers/ModelPanel/selectors.ts index 5fc23ed8..3f43322f 100644 --- a/src/containers/ModelPanel/selectors.ts +++ b/src/containers/ModelPanel/selectors.ts @@ -3,7 +3,11 @@ import { isEmpty } from "lodash"; import { AgentDisplayNode } from "../../components/CheckBoxTree"; import { getUiDisplayDataTree } from "../../state/trajectory/selectors"; -import { getAgentVisibilityMap } from "../../state/selection/selectors"; +import { + getAgentVisibilityMap, + getColorChanges, + getRecentColors, +} from "../../state/selection/selectors"; import { VisibilitySelectionMap } from "../../state/selection/types"; // Returns an agent visibility map that indicates all states should be visible @@ -56,9 +60,7 @@ export const getIsSharedCheckboxIndeterminate = createSelector( if (visibleStates === undefined) { // This should theoretically never happen console.warn( - `Skipping agent ${ - agent.key - } in getIsSharedCheckboxIndeterminate because it doesn't exist in agentVisibilityMap` + `Skipping agent ${agent.key} in getIsSharedCheckboxIndeterminate because it doesn't exist in agentVisibilityMap` ); continue; } @@ -74,3 +76,8 @@ export const getIsSharedCheckboxIndeterminate = createSelector( return numInvisibleAgents > 0 && numInvisibleAgents < allAgents.length; } ); + +export const getColorInfoForPicker = createSelector( + [getColorChanges, getRecentColors], + (colorChanges, recentColors) => ({ colorChanges, recentColors }) +); diff --git a/src/state/selection/selectors/index.ts b/src/state/selection/selectors/index.ts index 68771eca..ff3cbe38 100644 --- a/src/state/selection/selectors/index.ts +++ b/src/state/selection/selectors/index.ts @@ -1,10 +1,10 @@ import { createSelector } from "reselect"; import { reduce } from "lodash"; -import { UIDisplayData } from "@aics/simularium-viewer/type-declarations"; import { - ColorChanges, - SelectionEntry, -} from "@aics/simularium-viewer/type-declarations/simularium/SelectionInterface"; + UIDisplayData, + // ColorChanges, + // SelectionEntry, +} from "@aics/simularium-viewer/type-declarations"; import { getAgentDisplayNamesAndStates } from "../../trajectory/selectors"; import { ColorChangesMap, VisibilitySelectionMap } from "../types"; @@ -17,11 +17,8 @@ import { export const getHighlightedAgents = createSelector( [getAgentHighlightMap, getAgentDisplayNamesAndStates], - ( - highlightedAgents: VisibilitySelectionMap, - allAgents: UIDisplayData - ): SelectionEntry[] => { - const init: SelectionEntry[] = []; + (highlightedAgents: VisibilitySelectionMap, allAgents: UIDisplayData) => { + const init: any = []; return reduce( allAgents, (acc, agent) => { @@ -66,8 +63,8 @@ export const getAgentsToHide = createSelector( ( agentVisibilityMap: VisibilitySelectionMap, agentDisplayData: UIDisplayData - ): SelectionEntry[] => { - const init: SelectionEntry[] = []; + ) => { + const init: any = []; return reduce( agentDisplayData, (acc, agent) => { @@ -112,15 +109,12 @@ export const getAgentsToHide = createSelector( export const getColorChanges = createSelector( [getColorChangesMap, getAgentDisplayNamesAndStates], - ( - colorChangesMap: ColorChangesMap, - agentDisplayData: UIDisplayData - ): ColorChanges[] => { - const colorArray: ColorChanges[] = []; + (colorChangesMap: ColorChangesMap, agentDisplayData: UIDisplayData) => { + const colorArray: any = []; - const agentColorChanges: SelectionEntry[] = reduce( + const agentColorChanges = reduce( agentDisplayData, - (acc: SelectionEntry[], agent) => { + (acc: any, agent) => { if (!colorChangesMap.agents[agent.name]) { return acc; } diff --git a/webpack/plugins.js b/webpack/plugins.js index 7beed32a..7a744715 100644 --- a/webpack/plugins.js +++ b/webpack/plugins.js @@ -66,7 +66,7 @@ const PLUGINS_BY_ENV = { [Env.DEVELOPMENT]: [ new webpack.EnvironmentPlugin({ // FIXME: make a dev server - BACKEND_SERVER_IP: `staging-node1-agentviz-backend.cellexplore.net`, + BACKEND_SERVER_IP: `production-node1-agentviz-backend.cellexplore.net`, }), ], };