diff --git a/client/src/components/Pages/Structure/Input/TxSegmentElementInput/TxSegmentElementInput.tsx b/client/src/components/Pages/Structure/Input/TxSegmentElementInput/TxSegmentElementInput.tsx index b0b1cb4..7180adb 100644 --- a/client/src/components/Pages/Structure/Input/TxSegmentElementInput/TxSegmentElementInput.tsx +++ b/client/src/components/Pages/Structure/Input/TxSegmentElementInput/TxSegmentElementInput.tsx @@ -14,6 +14,7 @@ import { } from "../../../../../services/ResponseModels"; import React, { useEffect, useState, KeyboardEvent, ChangeEvent } from "react"; import { + GenomicInputType, getTxSegmentElementEC, getTxSegmentElementGC, getTxSegmentNomenclature, @@ -30,11 +31,6 @@ interface TxSegmentElementInputProps extends StructuralElementInputProps { element: ClientTranscriptSegmentElement; } -enum GenomicInputType { - GENE = "gene", - TRANSCRIPT = "transcript", -} - const TxSegmentCompInput: React.FC = ({ element, index, @@ -416,11 +412,11 @@ const TxSegmentCompInput: React.FC = ({ ); const renderTxOptions = () => { - if (!genomicInputType) { - return <>; - } switch (txInputType) { case TxElementInputType.gc: + if (!genomicInputType) { + return <>; + } return ( diff --git a/client/src/components/Utilities/GetCoordinates/GetCoordinates.tsx b/client/src/components/Utilities/GetCoordinates/GetCoordinates.tsx index b6af0c1..9ae8ad4 100644 --- a/client/src/components/Utilities/GetCoordinates/GetCoordinates.tsx +++ b/client/src/components/Utilities/GetCoordinates/GetCoordinates.tsx @@ -18,6 +18,7 @@ import { getGenomicCoords, getExonCoords, TxElementInputType, + GenomicInputType, } from "../../../services/main"; import { CoordsUtilsResponse, @@ -74,6 +75,8 @@ const GetCoordinates: React.FC = () => { const [inputType, setInputType] = useState( TxElementInputType.default ); + const [genomicInputType, setGenomicInputType] = + useState(null); const [txAc, setTxAc] = useState(""); const [txAcText, setTxAcText] = useState(""); @@ -277,6 +280,14 @@ const GetCoordinates: React.FC = () => { } }; + const txInputField = ( + + ); + const handleChromosomeChange = (e: ChangeEvent) => { setChromosome(e.target.value); }; @@ -294,38 +305,49 @@ const GetCoordinates: React.FC = () => { const renderInputOptions = () => { switch (inputType) { - case "genomic_coords": + case TxElementInputType.gc: + if (!genomicInputType) { + return <>; + } return ( <> - - - Transcript - - + {genomicInputType === GenomicInputType.GENE ? ( + <> + + + Transcript + + + + ) : ( + <> + {txInputField} + + )} {genomicCoordinateInfo} @@ -345,16 +367,10 @@ const GetCoordinates: React.FC = () => { ); - case "exon_coords": + case TxElementInputType.ec: return ( <> - - - + {txInputField} { Genomic coordinates Exon coordinates + {inputType === TxElementInputType.gc ? ( + + + Gene or Transcript? + + + + ) : ( + <> + )} {renderInputOptions()} diff --git a/client/src/services/main.tsx b/client/src/services/main.tsx index 7afb267..e990be7 100644 --- a/client/src/services/main.tsx +++ b/client/src/services/main.tsx @@ -55,6 +55,11 @@ export enum TxElementInputType { ec = "exon_coords", } +export enum GenomicInputType { + GENE = "gene", + TRANSCRIPT = "transcript", +} + export type ClientElementUnion = | ClientMultiplePossibleGenesElement | ClientRegulatoryElement