Skip to content

Commit

Permalink
change names of checkboxtree components
Browse files Browse the repository at this point in the history
  • Loading branch information
meganrm committed Dec 19, 2023
1 parent c953f49 commit 0bbb9a5
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
VisibilitySelectionMap,
} from "../../state/selection/types";
import SharedCheckbox from "../SharedCheckbox";
import CheckboxTreeSubmenu from "../CheckboxTreeSubmenu";
import AgentTreeSubmenu from "../AgentTreeSubmenu";
import TreeNode from "../TreeNode";
import Checkbox from "../Checkbox";
import { CHECKBOX_TYPE_STAR } from "../../constants";
Expand All @@ -34,7 +34,7 @@ export interface AgentDisplayNode {
color: string;
}

interface CheckBoxTreeProps {
interface AgentTreeProps {
treeData: AgentDisplayNode[];
agentsChecked: VisibilitySelectionMap;
agentsHighlighted: VisibilitySelectionMap;
Expand All @@ -51,7 +51,7 @@ interface CheckBoxTreeProps {
const CHECKBOX_SPAN_NO = 2;
import styles from "./style.css";

class CheckBoxTree extends React.Component<CheckBoxTreeProps> {
class AgentTree extends React.Component<AgentTreeProps> {
onSubCheckboxChange = (key: string, values: string[]) => {
const { handleAgentCheck } = this.props;
handleAgentCheck({ [key]: values });
Expand Down Expand Up @@ -295,7 +295,7 @@ class CheckBoxTree extends React.Component<CheckBoxTreeProps> {
{nodeData.children.length > 0 && (
<Row className={styles.subMenu}>
<Col span={CHECKBOX_SPAN_NO} offset={3}>
<CheckboxTreeSubmenu
<AgentTreeSubmenu
options={nodeData.children}
checkedAgents={
agentsHighlighted[
Expand Down Expand Up @@ -329,7 +329,7 @@ class CheckBoxTree extends React.Component<CheckBoxTreeProps> {
})}
</Col>
<Col className={styles.checkboxColumn}>
<CheckboxTreeSubmenu
<AgentTreeSubmenu
options={nodeData.children}
checkedAgents={
agentsChecked[nodeData.title] ||
Expand Down Expand Up @@ -378,4 +378,4 @@ class CheckBoxTree extends React.Component<CheckBoxTreeProps> {
}
}

export default CheckBoxTree;
export default AgentTree;
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ const CheckboxGroup = AntdCheckbox.Group;
import Checkbox from "../Checkbox";
import { CHECKBOX_TYPE_STAR } from "../../constants";

interface CheckboxTreeSubmenuProps {
interface AgentTreeSubmenuProps {
checkedAgents: string[];
options: CheckboxOptionType[];
onChange: (values: CheckboxValueType[]) => void;
checkboxType?: CHECKBOX_TYPE_STAR;
}
import styles from "./style.css";

const CheckboxTreeSubmenu = ({
const AgentTreeSubmenu = ({
checkedAgents,
options,
onChange,
checkboxType,
}: CheckboxTreeSubmenuProps): JSX.Element => {
}: AgentTreeSubmenuProps): JSX.Element => {
const onCheckboxChange = ({ target }: CheckboxChangeEvent) => {
const allowedValues = map(options, "value");
const optionIndex = checkedAgents.indexOf(target.value);
Expand Down Expand Up @@ -60,4 +60,4 @@ const CheckboxTreeSubmenu = ({
);
};

export default CheckboxTreeSubmenu;
export default AgentTreeSubmenu;
File renamed without changes.
2 changes: 1 addition & 1 deletion src/components/SharedCheckbox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { CHECKBOX_TYPE_STAR } from "../../constants";
import { isUndefined } from "lodash";

import styles from "./style.css";
import { CHECK_ALL_BUTTON_TITLE } from "../CheckBoxTree";
import { CHECK_ALL_BUTTON_TITLE } from "../AgentTree";

interface SharedCheckboxProps {
options: string[];
Expand Down
2 changes: 1 addition & 1 deletion src/containers/ModelPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
VisibilitySelectionMap,
SetRecentColorsAction,
} from "../../state/selection/types";
import CheckBoxTree, { AgentDisplayNode } from "../../components/CheckBoxTree";
import CheckBoxTree, { AgentDisplayNode } from "../../components/AgentTree";
import {
getSelectAllVisibilityMap,
getSelectNoneVisibilityMap,
Expand Down
6 changes: 2 additions & 4 deletions src/containers/ModelPanel/selectors.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createSelector } from "reselect";
import { isEmpty } from "lodash";

import { AgentDisplayNode } from "../../components/CheckBoxTree";
import { AgentDisplayNode } from "../../components/AgentTree";
import { getUiDisplayDataTree } from "../../state/trajectory/selectors";
import { getAgentVisibilityMap } from "../../state/selection/selectors";
import { VisibilitySelectionMap } from "../../state/selection/types";
Expand Down Expand Up @@ -56,9 +56,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;
}
Expand Down

0 comments on commit 0bbb9a5

Please sign in to comment.