Skip to content

Commit

Permalink
[Platform]: consistent navigate button (#553)
Browse files Browse the repository at this point in the history
  • Loading branch information
d0choa authored Nov 22, 2024
1 parent 6365dac commit c859339
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 29 deletions.
16 changes: 11 additions & 5 deletions packages/sections/src/credibleSet/GWASColoc/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,21 @@ import Description from "./Description";
import GWAS_COLOC_QUERY from "./GWASColocQuery.gql";
import { mantissaExponentComparator, variantComparator } from "../../utils/comparators";
import { getStudyCategory } from "../../utils/getStudyCategory";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faArrowRightToBracket } from "@fortawesome/free-solid-svg-icons";
import { Box } from "@mui/material";

const columns = [
{
id: "view",
id: "otherStudyLocus.studyLocusId",
label: "Navigate",
renderCell: ({ otherStudyLocus }) => {
if (!otherStudyLocus) return naLabel;
return <Link to={`./${otherStudyLocus.studyLocusId}`}>view</Link>;
},
renderCell: ({ otherStudyLocus }) => (
<Box sx={{ display: "flex" }}>
<Link to={`./${otherStudyLocus.studyLocusId}`}>
<FontAwesomeIcon icon={faArrowRightToBracket} />
</Link>
</Box>
),
filterValue: false,
exportValue: false,
},
Expand Down
26 changes: 11 additions & 15 deletions packages/sections/src/credibleSet/GWASMolQTL/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,22 @@ import Description from "./Description";
import GWAS_COLOC_QUERY from "./GWASMolQTLColocQuery.gql";
import { mantissaExponentComparator, variantComparator } from "../../utils/comparators";
import { getStudyCategory } from "../../utils/getStudyCategory";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faArrowRightToBracket } from "@fortawesome/free-solid-svg-icons";
import { Box } from "@mui/material";

const columns = [
{
id: "view",
id: "otherStudyLocus.studyLocusId",
label: "Navigate",
renderCell: ({ otherStudyLocus }) => {
if (!otherStudyLocus) return naLabel;
return <Link to={`./${otherStudyLocus.studyLocusId}`}>view</Link>;
},
renderCell: ({ otherStudyLocus }) => (
<Box sx={{ display: "flex" }}>
<Link to={`./${otherStudyLocus.studyLocusId}`}>
<FontAwesomeIcon icon={faArrowRightToBracket} />
</Link>
</Box>
),
filterValue: false,
exportValue: false,
},
{
id: "otherStudyLocus.study.target",
label: "Gene",
renderCell: ({ otherStudyLocus }) => {
const study = otherStudyLocus?.study;
if (!study?.target) return naLabel;
return <Link to={`../study/${study.target.id}`}>{study.target.approvedSymbol}</Link>;
},
},
{
id: "otherStudyLocus.study.studyId",
Expand Down
15 changes: 11 additions & 4 deletions packages/sections/src/study/GWASCredibleSets/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,27 @@ import {
DisplayVariantId,
OtTable,
} from "ui";
import { Box } from "@mui/material";
import { naLabel } from "../../constants";
import { definition } from ".";
import Description from "./Description";
import GWAS_CREDIBLE_SETS_QUERY from "./GWASCredibleSetsQuery.gql";
import { mantissaExponentComparator, variantComparator } from "../../utils/comparators";
import ManhattanPlot from "./ManhattanPlot";
import { faArrowRightToBracket } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";

const columns = [
{
id: "view",
id: "studyLocusId",
label: "Navigate",
renderCell: ({ studyLocusId }) => <Link to={`../credible-set/${studyLocusId}`}>view</Link>,
filterValue: false,
exportValue: false,
renderCell: ({ studyLocusId }) => (
<Box sx={{ display: "flex" }}>
<Link to={`/credible-set/${studyLocusId}`}>
<FontAwesomeIcon icon={faArrowRightToBracket} />
</Link>
</Box>
),
},
{
id: "leadVariant",
Expand Down
15 changes: 11 additions & 4 deletions packages/sections/src/study/QTLCredibleSets/Body.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
import { useQuery } from "@apollo/client";
import { Link, SectionItem, ScientificNotation, DisplayVariantId, OtTable } from "ui";
import { Box } from "@mui/material";
import { naLabel } from "../../constants";
import { definition } from ".";
import Description from "./Description";
import QTL_CREDIBLE_SETS_QUERY from "./QTLCredibleSetsQuery.gql";
import { mantissaExponentComparator, variantComparator } from "../../utils/comparators";
import { faArrowRightToBracket } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";

const columns = [
{
id: "view",
id: "studyLocusId",
label: "Navigate",
renderCell: ({ studyLocusId }) => <Link to={`../credible-set/${studyLocusId}`}>view</Link>,
filterValue: false,
exportValue: false,
renderCell: ({ studyLocusId }) => (
<Box sx={{ display: "flex" }}>
<Link to={`/credible-set/${studyLocusId}`}>
<FontAwesomeIcon icon={faArrowRightToBracket} />
</Link>
</Box>
),
},
{
id: "leadVariant",
Expand Down
8 changes: 7 additions & 1 deletion packages/sections/src/variant/QTLCredibleSets/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import Description from "./Description";
import QTL_CREDIBLE_SETS_QUERY from "./QTLCredibleSetsQuery.gql";
import { mantissaExponentComparator, variantComparator } from "../../utils/comparators";
import { ReactNode } from "react";
import { faArrowRightToBracket } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";

type getColumnsType = {
id: string;
Expand All @@ -28,7 +30,11 @@ function getColumns({ id, referenceAllele, alternateAllele }: getColumnsType) {
id: "studyLocusId",
label: "Navigate",
renderCell: ({ studyLocusId }) => (
<Link to={`../credible-set/${studyLocusId}`}>{studyLocusId}</Link>
<Box sx={{ display: "flex", justifyContent: "center" }}>
<Link to={`/credible-set/${studyLocusId}`}>
<FontAwesomeIcon icon={faArrowRightToBracket} />
</Link>
</Box>
),
},
{
Expand Down

0 comments on commit c859339

Please sign in to comment.