diff --git a/packages/libs/web-common/src/components/reporters/SequenceFormFactory.jsx b/packages/libs/web-common/src/components/reporters/SequenceFormFactory.jsx index d97862f74f..966a68325c 100644 --- a/packages/libs/web-common/src/components/reporters/SequenceFormFactory.jsx +++ b/packages/libs/web-common/src/components/reporters/SequenceFormFactory.jsx @@ -2,12 +2,18 @@ import React from 'react'; import { RadioList, NumberSelector, + Checkbox, } from '@veupathdb/wdk-client/lib/Components'; import { ComponentsList } from './SequenceFormElements'; import * as ComponentUtils from '@veupathdb/wdk-client/lib/Utils/ComponentUtils'; import * as ReporterUtils from '@veupathdb/wdk-client/lib/Views/ReporterForm/reporterUtils'; import './ReporterForms.scss'; +const SINGLE_TRANSCRIPT_VIEW_FILTER_VALUE = { + name: 'representativeTranscriptOnly', + value: {}, +}; + const util = Object.assign({}, ComponentUtils, ReporterUtils); const deflineFieldOptions = [ @@ -79,9 +85,27 @@ const createSequenceForm = ( reportType ) => { const Form = (props) => { - const { formState, updateFormState, onSubmit, includeSubmit } = props; + const { + formState, + updateFormState, + onSubmit, + includeSubmit, + viewFilters, + updateViewFilters, + } = props; const getUpdateHandler = (fieldName) => util.getChangeHandler(fieldName, updateFormState, formState); + const transcriptPerGeneChangeHandler = (isChecked) => { + const nextViewFilters = + viewFilters?.filter( + (filterValue) => + filterValue.name !== SINGLE_TRANSCRIPT_VIEW_FILTER_VALUE.name + ) ?? []; + if (isChecked) { + nextViewFilters.push(SINGLE_TRANSCRIPT_VIEW_FILTER_VALUE); + } + updateViewFilters(nextViewFilters); + }; return (
{formBeforeCommonOptions(props)} @@ -95,6 +119,22 @@ const createSequenceForm = ( />
{reportType === 'Sequences' && sequenceOptions(props)} +

Additional options:

+
+ +
{includeSubmit && (