Skip to content

Commit

Permalink
merge conflict cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
katyasoup committed Jan 10, 2025
1 parent 4a85be2 commit 66af572
Showing 1 changed file with 11 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import styles from "../buildFromTemplates/conditionTemplateSelection.module.scss";
import { Icon } from "@trussworks/react-uswds";
import { DibbsConceptType, DibbsValueSet } from "@/app/constants";
import { tallyConceptsForValueSetArray } from "../utils";
import { ChangeEvent } from "react";
import Checkbox from "@/app/query/designSystem/checkbox/Checkbox";

type ConceptTypeAccordionBodyProps = {
activeValueSetType: DibbsConceptType;
activeValueSets: { [vsId: string]: DibbsValueSet };
activeType: DibbsConceptType;
activeTypeValueSets: { [vsId: string]: DibbsValueSet };
expanded: boolean;
handleVsNameLevelUpdate: (
vsId: string,
Expand All @@ -17,42 +16,28 @@ type ConceptTypeAccordionBodyProps = {
/**
* Fragment component to style out some of the accordion bodies
* @param param0 - params
* @param param0.activeValueSetType - DibbsactiveValueSetType (labs, conditions, medications)
* @param param0.activeValueSets - ValueSets for a given activeValueSetType
* @param param0.activeType - DibbsactiveValueSetType (labs, conditions, medications)
* @param param0.activeTypeValueSets - ValueSets for a given activeValueSetType
* @param param0.expanded - Boolean for managing icon orientation
* @param param0.handleVsIdLevelUpdate - curried state update function that
* @param param0.handleVsNameLevelUpdate - curried state update function that
* takes a VsName and generatesa ValueSet level update
* @returns An accordion body component
*/

/**
*
* @param root0
* @param root0.activeValueSetType
* @param root0.activeValueSets
* @param root0.expanded
* @param root0.handleVsNameLevelUpdate
*/
const ConceptTypeAccordionHeader: React.FC<ConceptTypeAccordionBodyProps> = ({
activeValueSetType,
activeValueSets,
activeType,
activeTypeValueSets,
expanded,
handleVsNameLevelUpdate,
}) => {
const selectedCount = tallyConceptsForValueSetArray(
Object.values(activeTypeValueSets),
true,
);
const totalCount = tallyConceptsForValueSetArray(
Object.values(activeTypeValueSets),
false,
);
const concepts = activeTypeValueSets[activeType].concepts;
const selectedCount = concepts.filter((c) => c.include).length;
const totalCount = concepts.length;

function handleBulkToggle(
e: ChangeEvent<HTMLInputElement>,
isMinusState: boolean,
) {
Object.entries(activeValueSets).forEach(([vsId, activeValueSets]) => {
Object.entries(activeTypeValueSets).forEach(([vsId, activeValueSets]) => {
const handleValueSetUpdate = handleVsNameLevelUpdate(vsId);
const bulkIncludeValue = isMinusState ? false : e.target.checked;
activeValueSets.includeValueSet = bulkIncludeValue;
Expand Down

0 comments on commit 66af572

Please sign in to comment.