From 84ef3ea984669a01595285c2305b02b2324e47b9 Mon Sep 17 00:00:00 2001 From: Carlos Cruz Date: Mon, 9 Dec 2024 23:31:46 +0100 Subject: [PATCH] fix: study shared trait --- .../src/study/SharedTraitStudies/Body.tsx | 43 ++++++++----------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/packages/sections/src/study/SharedTraitStudies/Body.tsx b/packages/sections/src/study/SharedTraitStudies/Body.tsx index c122aa94d..019215e45 100644 --- a/packages/sections/src/study/SharedTraitStudies/Body.tsx +++ b/packages/sections/src/study/SharedTraitStudies/Body.tsx @@ -1,13 +1,6 @@ -import { Fragment } from "react"; +import { Fragment, ReactElement } from "react"; import { Box, Typography } from "@mui/material"; -import { - Link, - SectionItem, - Tooltip, - PublicationsDrawer, - OtTable, - useBatchQuery, -} from "ui"; +import { Link, SectionItem, Tooltip, PublicationsDrawer, OtTable, useBatchQuery } from "ui"; import { definition } from "."; import Description from "./Description"; import { naLabel, initialResponse, table5HChunkSize } from "../../constants"; @@ -56,7 +49,7 @@ function getColumns(diseaseIds: string[]) { label: "Sample size", numeric: true, renderCell: ({ nSamples }) => { - return typeof nSamples === "number" ? nSamples.toLocaleString() : naLabel + return typeof nSamples === "number" ? nSamples.toLocaleString() : naLabel; }, comparator: (a, b) => a?.nSamples - b?.nSamples, sortable: true, @@ -97,23 +90,26 @@ function getColumns(diseaseIds: string[]) { getStudyCategory(projectId) === "FINNGEN" ? "FinnGen" : cohorts?.length - ? cohorts.join(", ") - : null, + ? cohorts.join(", ") + : null, }, { id: "publication", label: "Publication", renderCell: ({ publicationFirstAuthor, publicationDate, pubmedId }) => { if (!publicationFirstAuthor) return naLabel; - return + return ( + + ); }, filterValue: ({ publicationYear, publicationFirstAuthor }) => `${publicationYear} ${publicationFirstAuthor}`, - exportValue: ({ pubmedId }) => - `${pubmedId}`, + exportValue: ({ pubmedId }) => `${pubmedId}`, }, ]; } @@ -121,23 +117,20 @@ function getColumns(diseaseIds: string[]) { type BodyProps = { studyId: string; diseaseIds: string[]; - entity: string; }; -export function Body({ studyId, diseaseIds, entity }: BodyProps) { +export function Body({ studyId, diseaseIds }: BodyProps): ReactElement { const variables = { diseaseIds: diseaseIds, + size: table5HChunkSize, + index: 0, }; const [request, setRequest] = useState(initialResponse); const getData = useBatchQuery({ query: SHARED_TRAIT_STUDIES_QUERY, - variables: { - diseaseIds, - size: table5HChunkSize, - index: 0, - }, + variables, dataPath: "data.studies", size: table5HChunkSize, });