From e30247b4012f1862166e4812937e0f6530aba035 Mon Sep 17 00:00:00 2001 From: Zoe Daniels <7177924+zkdan@users.noreply.github.com> Date: Wed, 24 Jan 2024 16:09:12 -0500 Subject: [PATCH] removing duplicate code and inserting if statement --- Eplant/views/GeneInfoView/component.tsx | 47 +++++++++++-------------- Eplant/views/eFP/Viewer/MaskModal.tsx | 10 +----- 2 files changed, 22 insertions(+), 35 deletions(-) diff --git a/Eplant/views/GeneInfoView/component.tsx b/Eplant/views/GeneInfoView/component.tsx index c8185666..5b3b52af 100644 --- a/Eplant/views/GeneInfoView/component.tsx +++ b/Eplant/views/GeneInfoView/component.tsx @@ -1,39 +1,29 @@ -import { useConfig } from '@eplant/config' import GeneticElement from '@eplant/GeneticElement' +import { useConfig } from '@eplant/config' import { usePanesDispatch, useViewID } from '@eplant/state' -import Stack from '@mui/material/Stack' -import { styled, useTheme } from '@mui/material/styles' -import Typography from '@mui/material/Typography' -import _ from 'lodash' -import React from 'react' -import { - GeneInfoViewAction, - GeneInfoViewData, - GeneInfoViewState, -} from './types' -import { View, ViewProps } from '../../View' -import { useViewData } from '../../View/viewData' -import { GeneModel } from './GeneModel' -import { - Alert, - Box, - Button, - ButtonProps, - LinearProgress, - Snackbar, -} from '@mui/material' import ContentCopyIcon from '@mui/icons-material/ContentCopy' import { Alert, Box, Button, ButtonProps, + IconButton, LinearProgress, Snackbar, } from '@mui/material' -import ContentCopyIcon from '@mui/icons-material/ContentCopy' -import { IconButton } from '@mui/material' -import { setStroke } from '../eFP/Tooltips/EFPTooltip' +import Stack from '@mui/material/Stack' +import Typography from '@mui/material/Typography' +import { styled, useTheme } from '@mui/material/styles' +import _ from 'lodash' +import React from 'react' +import { View, ViewProps } from '../../View' +import { useViewData } from '../../View/viewData' +import { GeneModel } from './GeneModel' +import { + GeneInfoViewAction, + GeneInfoViewData, + GeneInfoViewState, +} from './types' const SecondaryText = styled(Typography)(({ theme }) => ({ color: theme.palette.text.secondary, @@ -308,7 +298,12 @@ export default function GeneInfoViewer({ {activeData.proteinSequence} copyToClipboard(activeData.proteinSequence)} + onClick={() =>{ + if(activeData.proteinSequence){ + copyToClipboard(activeData.proteinSequence) + } + } + } color='primary' sx={{ ml: 1 }} > diff --git a/Eplant/views/eFP/Viewer/MaskModal.tsx b/Eplant/views/eFP/Viewer/MaskModal.tsx index 0671a796..a45c62b3 100644 --- a/Eplant/views/eFP/Viewer/MaskModal.tsx +++ b/Eplant/views/eFP/Viewer/MaskModal.tsx @@ -1,21 +1,13 @@ // Import necessary dependencies from Material-UI -import React, { useState } from 'react' import { - Modal, - Slider, - Typography, Button, - useTheme, DialogTitle, -} from '@mui/material' -import { Modal, Slider, Typography, - Button, useTheme, - DialogTitle, } from '@mui/material' +import { useState } from 'react' import { EFPViewerState } from './types' // Modal component with a slider