Skip to content

Commit

Permalink
cleanup, variable renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
prabh-t committed Oct 11, 2024
1 parent 555fb8b commit f56a914
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ import {ProteinColocatedVariant} from "../../../../types/PopulationObservationRe
interface CoLocatedVariantAccordionProps {
toggleCoLocated: StringVoidFun
coLocatedVariants: Array<ProteinColocatedVariant>
expendedCoLocatedKey: string
expandedCoLocatedKey: string
}
function CoLocatedVariantAccordion(props: CoLocatedVariantAccordionProps) {
const { toggleCoLocated, expendedCoLocatedKey, coLocatedVariants } = props;
const [expendedGenomicKey, setExpendedGenomicKey] = useState('');

const { toggleCoLocated, expandedCoLocatedKey, coLocatedVariants } = props;
const [expandedGenomicKey, setExpandedGenomicKey] = useState('');
const toggleGenomic = (key: string) => {
setExpendedGenomicKey(expendedGenomicKey === key ? '' : key)
setExpandedGenomicKey(expandedGenomicKey === key ? '' : key)
}

const coLocatedVariantsMap = new Map();
Expand All @@ -27,7 +26,7 @@ function CoLocatedVariantAccordion(props: CoLocatedVariantAccordionProps) {
coLocatedVariants.push(
<li key={uuidv1()}>
<CoLocatedVariantGenomicLocationAccordion coLocatedVariant={variant} toggleGenomic={toggleGenomic}
expendedGenomicKey={expendedGenomicKey} />
expandedGenomicKey={expandedGenomicKey} />
</li>);
coLocatedVariantsMap.set(change, coLocatedVariants);
});
Expand All @@ -42,7 +41,7 @@ function CoLocatedVariantAccordion(props: CoLocatedVariantAccordionProps) {
</b>
<ChevronDownIcon className="chevronicon" />
</button>
{change === expendedCoLocatedKey && <ul>{genomicLocations}</ul>}
{change === expandedCoLocatedKey && <ul>{genomicLocations}</ul>}
</li>
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ interface CoLocatedVariantDetailsProps {
}

function CoLocatedVariantDetails(props: CoLocatedVariantDetailsProps) {
const [expendedCoLocatedKey, setExpendedCoLocatedKey] = useState('');
const [expandedCoLocatedKey, setExpandedCoLocatedKey] = useState('');
const toggleCoLocated = (key: string) => {
setExpendedCoLocatedKey(expendedCoLocatedKey === key ? '' : key)
setExpandedCoLocatedKey(expandedCoLocatedKey === key ? '' : key)
}

if (props.coLocatedVariants.length <= 0) {
Expand All @@ -20,7 +20,7 @@ function CoLocatedVariantDetails(props: CoLocatedVariantDetailsProps) {
<>
The following variants alter the same amino acid (but alter a different nucleotide in the codon)
<br />
<ul><CoLocatedVariantAccordion {...props} expendedCoLocatedKey={expendedCoLocatedKey} toggleCoLocated={toggleCoLocated} /></ul>
<ul><CoLocatedVariantAccordion {...props} expandedCoLocatedKey={expandedCoLocatedKey} toggleCoLocated={toggleCoLocated} /></ul>
</>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {Association, ProteinColocatedVariant} from "../../../../types/Population

interface CoLocatedVariantGenomicLocationAccordionProps {
coLocatedVariant: ProteinColocatedVariant
expendedGenomicKey: string
expandedGenomicKey: string
toggleGenomic: StringVoidFun
}

Expand All @@ -31,7 +31,7 @@ function CoLocatedVariantGenomicLocationAccordion(props: CoLocatedVariantGenomic
<ChevronDownIcon className="chevronicon" />
</button>
</li>
{props.expendedGenomicKey === genomicLocation(props) &&
{props.expandedGenomicKey === genomicLocation(props) &&
<CoLocatedVariantGenomicLocationAccordionDetail {...props} />
}
</ul>
Expand Down

0 comments on commit f56a914

Please sign in to comment.