Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
NishiPhalke committed Sep 6, 2023
1 parent fc313f3 commit ef80448
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion screen2.0/src/app/search/gbview/defaulttracks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ const DefaultTracks: React.FC<DefaultTracksProps> = (props) => {
() =>
associateBy(
(data && data.bigRequests && data.bigRequests[0].data) || [],
(x: any) => x.name,
(x: { name: string}) => x.name,
(x: any) => ({ chromosome: x.chr, start: x.start, end: x.end })
),
[data]
Expand Down
4 changes: 2 additions & 2 deletions screen2.0/src/app/search/gbview/tfmotiftrack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ export const TfMotifTrack = (props) => {
data={props.data}
transform="translate(0,40)"
tooltipContent={(rect: any) => {
console.log(rect, ":recg")

return <MotifTooltip {...rect} />
}}
onClick={(x: any) => {
//return window.open(`${x}`)

return window.open(
`https://factorbook.org/tf/${props.assembly === "GRCh38" ? "human" : "mouse"}/${x.rectname.split("$")[2]}/motif`,
"_blank"
Expand Down
2 changes: 1 addition & 1 deletion screen2.0/src/common/components/MainResultsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function MainResultsTable(props: Partial<DataTableProps<any>>) {
},
{
header: "Chr",
value: (row: { chromosome: any }) => row.chromosome,
value: (row: { chromosome: string }) => row.chromosome,
},
{
header: "Start",
Expand Down
12 changes: 6 additions & 6 deletions screen2.0/src/common/components/mainsearch/CcreAutocomplete.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use client"
import * as React from "react"
import React, {useState, useCallback} from "react"
import Box from "@mui/material/Box"
import TextField from "@mui/material/TextField"
import Autocomplete from "@mui/material/Autocomplete"
Expand All @@ -23,10 +23,10 @@ query cCREQuery($accession_prefix: [String!], $limit: Int, $assembly: String!) {
}
`
export const CcreAutoComplete = (props) => {
const [value, setValue] = React.useState(null)
const [inputValue, setInputValue] = React.useState("")
const [options, setOptions] = React.useState([])
const [ccreAccessions, setCcreAccessions] = React.useState([])
const [value, setValue] = useState(null)
const [inputValue, setInputValue] = useState("")
const [options, setOptions] = useState([])
const [ccreAccessions, setCcreAccessions] = useState([])

const router = useRouter()
const onSearchChange = async (value: string) => {
Expand Down Expand Up @@ -62,7 +62,7 @@ export const CcreAutoComplete = (props) => {
}
}

const debounceFn = React.useCallback(debounce(onSearchChange, 500), [])
const debounceFn = useCallback(debounce(onSearchChange, 500), [])

return (
<Grid container sx={{ mr: "1em", ml: "1em" }}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useMemo, useState, useRef, useCallback, useEffect } from "react"
import React, { useState, useEffect } from "react"
import Box from "@mui/material/Box"
import TextField from "@mui/material/TextField"
import Autocomplete from "@mui/material/Autocomplete"
Expand Down
16 changes: 8 additions & 8 deletions screen2.0/src/common/components/mainsearch/GeneAutocomplete.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from "react"
import React, { useState, useEffect, useCallback } from "react"
import Box from "@mui/material/Box"
import TextField from "@mui/material/TextField"
import Autocomplete from "@mui/material/Autocomplete"
Expand All @@ -23,15 +23,15 @@ query ($assembly: String!, $name_prefix: [String!], $limit: Int) {
`

export const GeneAutoComplete = (props) => {
const [value, setValue] = React.useState(null)
const [inputValue, setInputValue] = React.useState("")
const [options, setOptions] = React.useState<string[]>([])
const [geneids, setGeneIds] = React.useState<{ chrom: string; start: number; end: number; id: string; name: string }[]>([])
const [value, setValue] = useState(null)
const [inputValue, setInputValue] = useState("")
const [options, setOptions] = useState<string[]>([])
const [geneids, setGeneIds] = useState<{ chrom: string; start: number; end: number; id: string; name: string }[]>([])

const router = useRouter()
const [geneDesc, setgeneDesc] = React.useState<{ name: string; desc: string }[]>()
const [geneDesc, setgeneDesc] = useState<{ name: string; desc: string }[]>()

React.useEffect(() => {
useEffect(() => {
const fetchData = async () => {
let f = await Promise.all(
options.map((gene) =>
Expand Down Expand Up @@ -89,7 +89,7 @@ export const GeneAutoComplete = (props) => {
}
}

const debounceFn = React.useCallback(debounce(onSearchChange, 500), [])
const debounceFn = useCallback(debounce(onSearchChange, 500), [])
const gridsize = props.gridsize || 5.5
return (
<Grid container sx={{ mr: "1em", ml: "1em" }}>
Expand Down

0 comments on commit ef80448

Please sign in to comment.