-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(index.tsx): update GenomePageWrapper to use SummaryLoader compon…
…ent instead of Loader for better loading screen The changes were made to refactor the loader components in the genome-page application to use the useRouter hook and Layout component for improved routing and page layout consistency. This enhances the user experience and makes the code more maintainable.
- Loading branch information
Showing
5 changed files
with
53 additions
and
33 deletions.
There are no files selected for viewing
27 changes: 16 additions & 11 deletions
27
apps/genome-page/components/features/Phenotypes/PhenotypesLoader.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
import { makeBy as AmakeBy } from "fp-ts/Array" | ||
import { Skeleton } from "@material-ui/lab" | ||
import Box from "@material-ui/core/Box" | ||
import { useRouter } from "next/router" | ||
import { Layout } from "components/layout/Layout" | ||
import { Loader } from "components/Loader" | ||
|
||
/** | ||
* Loading screen for Phenotypes page | ||
* Loading screen for Summary page | ||
*/ | ||
const PhenotypesLoader = () => ( | ||
<Box mt="10px" data-testid="skeleton-loader"> | ||
{AmakeBy(12, (key) => ( | ||
<Skeleton height={50} key={key} animation="wave" /> | ||
))} | ||
</Box> | ||
) | ||
const PhenotypesLoader = () => { | ||
const { query } = useRouter() | ||
const geneId = query.id as string | ||
return ( | ||
<Layout | ||
gene={geneId} | ||
title={`Phenotypes for ${geneId}`} | ||
description={`Gene phenotypes for ${geneId}`}> | ||
<Loader /> | ||
</Layout> | ||
) | ||
} | ||
|
||
export { PhenotypesLoader } |
27 changes: 18 additions & 9 deletions
27
apps/genome-page/components/features/References/ReferencesLoader.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,21 @@ | ||
import { Box, Skeleton } from "@mui/material" | ||
import { useRouter } from "next/router" | ||
import { Layout } from "components/layout/Layout" | ||
import { Loader } from "components/Loader" | ||
|
||
const ReferencesLoader = () => ( | ||
<Box mt="10px" data-testid="skeleton-loader"> | ||
{new Array(10).map((item, key) => ( | ||
// eslint-disable-next-line react/no-array-index-key | ||
<Skeleton animation="wave" key={key} /> | ||
))} | ||
</Box> | ||
) | ||
/** | ||
* Loading screen for Summary page | ||
*/ | ||
const ReferencesLoader = () => { | ||
const { query } = useRouter() | ||
const geneId = query.id as string | ||
return ( | ||
<Layout | ||
gene={geneId} | ||
title={`References for ${geneId}`} | ||
description={`Gene references for ${geneId}`}> | ||
<Loader /> | ||
</Layout> | ||
) | ||
} | ||
|
||
export { ReferencesLoader } |
24 changes: 15 additions & 9 deletions
24
apps/genome-page/components/features/Summary/SummaryLoader.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,21 @@ | ||
import { Box, Skeleton } from "@mui/material" | ||
import { useRouter } from "next/router" | ||
import { Layout } from "components/layout/Layout" | ||
import { Loader } from "components/Loader" | ||
|
||
/** | ||
* Loading screen for Summary page | ||
*/ | ||
const SummaryLoader = () => ( | ||
<Box mt="10px" data-testid="skeleton-loader"> | ||
{new Array(10).map((item, key) => ( | ||
// eslint-disable-next-line react/no-array-index-key | ||
<Skeleton key={key} animation="wave" /> | ||
))} | ||
</Box> | ||
) | ||
const SummaryLoader = () => { | ||
const { query } = useRouter() | ||
const geneId = query.id as string | ||
return ( | ||
<Layout | ||
gene={geneId} | ||
title={`GO Annotations for ${geneId}`} | ||
description={`Gene Ontology Annotations for ${geneId}`}> | ||
<Loader /> | ||
</Layout> | ||
) | ||
} | ||
|
||
export { SummaryLoader } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters