Skip to content

Commit

Permalink
feat: update credible-set page
Browse files Browse the repository at this point in the history
  • Loading branch information
carcruz committed Dec 9, 2024
1 parent b75d6b6 commit e59a3e7
Showing 1 changed file with 32 additions and 40 deletions.
72 changes: 32 additions & 40 deletions apps/platform/src/pages/CredibleSetPage/CredibleSetPage.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { ReactElement } from "react";
import { useLocation, useParams, Link } from "react-router-dom";
import { useQuery } from "@apollo/client";
import { useLocation, useParams, Routes, Route, useMatch, Link } from "react-router-dom";
import { Box, Tabs, Tab } from "@mui/material";
import { BasePage, ScrollToTop } from "ui";
import Header from "./Header";
import NotFoundPage from "../NotFoundPage";
import CREDIBLE_SET_PAGE_QUERY from "./CredibleSetPage.gql";
import Profile from "./Profile";

function CredibleSetPage() {
function CredibleSetPage(): ReactElement {
const location = useLocation();
const { studyLocusId } = useParams() as { studyLocusId: string };
const { path } = useMatch();

const { loading, data } = useQuery(CREDIBLE_SET_PAGE_QUERY, {
variables: { studyLocusId: studyLocusId },
variables: { studyLocusId },
});

if (data && !data?.credibleSet) {
Expand All @@ -31,42 +31,34 @@ function CredibleSetPage() {
description={`Annotation information for credible set ${studyLocusId}`}
location={location}
>
<Header
loading={loading}
studyId={studyId}
variantId={variantId}
referenceAllele={referenceAllele}
alternateAllele={alternateAllele}
studyType={studyType}
/>
<ScrollToTop />
<Route
path="/"
render={history => (
<Box sx={{ borderBottom: 1, borderColor: "divider" }}>
<Tabs value={history.location.pathname !== "/" ? history.location.pathname : false}>
<Tab
label={<Box sx={{ textTransform: "capitalize" }}>Profile</Box>}
value={`/credible-set/${studyLocusId}`}
component={Link}
to={`/credible-set/${studyLocusId}`}
/>
</Tabs>
</Box>
)}
/>

<Routes>
<Route exact path={path}>
<Profile
studyLocusId={studyLocusId}
variantId={variantId}
referenceAllele={referenceAllele}
alternateAllele={alternateAllele}
studyType={studyType}
/>
</Route>
</Routes>
<>
<Header
loading={loading}
studyId={studyId}
variantId={variantId}
referenceAllele={referenceAllele}
alternateAllele={alternateAllele}
studyType={studyType}
/>
<ScrollToTop />
<Box sx={{ borderBottom: 1, borderColor: "divider" }}>
<Tabs value={location.pathname}>
<Tab
label={<Box sx={{ textTransform: "capitalize" }}>Profile</Box>}
value={location.pathname}
component={Link}
to={`/credible-set/${studyLocusId}`}
/>
</Tabs>
</Box>
<Profile
studyLocusId={studyLocusId}
variantId={variantId}
referenceAllele={referenceAllele}
alternateAllele={alternateAllele}
studyType={studyType}
/>
</>
</BasePage>
);
}
Expand Down

0 comments on commit e59a3e7

Please sign in to comment.