Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pulling feat/genomepage-empty-display into develop #971

Merged
merged 34 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
79bb940
style(errorStyles.tsx): remove unused backgroundColor property in err…
ktun95 Feb 3, 2025
941b726
style(NotFoundError.tsx): add Paper component import for better styli…
ktun95 Feb 4, 2025
41b4bbf
style(NotFoundError.tsx): remove unnecessary className from Grid cont…
ktun95 Feb 4, 2025
a2180e2
feat(GraphQLErrorPage.tsx): add a new component GraphQLErrorPage to h…
ktun95 Feb 4, 2025
bf4caed
feat(NoDataDisplay.tsx): add NoDataDisplay component to genome-page f…
ktun95 Feb 4, 2025
3e738e2
refactor(PhenotypesContainer.tsx): remove unnecessary Layout componen…
ktun95 Feb 4, 2025
e33c7a4
fix(phenotypes.tsx): fix import path for GraphQLErrorPage component
ktun95 Feb 4, 2025
7aa2968
feat(phenotypes.tsx): add Layout component to wrap PhenotypesPage con…
ktun95 Feb 4, 2025
e1d36ca
feat(references.tsx): add Layout and NoDataDisplay components for imp…
ktun95 Feb 4, 2025
0b6f9fe
feat(phenotypes.tsx): add NoDataDisplay component to show a message w…
ktun95 Feb 4, 2025
532c247
style(ServerError.tsx): remove unnecessary className from Grid component
ktun95 Feb 4, 2025
2f6ba19
style(errorStyles.tsx): adjust margin styles for better spacing and a…
ktun95 Feb 4, 2025
0355499
style(OtherError.tsx): replace FontAwesomeIcon with Typography for co…
ktun95 Feb 4, 2025
cdb2d51
style(NoDataDisplay.tsx): replace SentimentDissatisfiedIcon with Remo…
ktun95 Feb 4, 2025
37f7a91
refactor(PhenotypesLoader.tsx): simplify PhenotypesLoader component b…
ktun95 Feb 4, 2025
e0e2224
refactor(ReferencesLoader.tsx): remove unused useRouter and Layout im…
ktun95 Feb 4, 2025
7389ac8
refactor(OntologyContainer.tsx): remove unused imports and simplify c…
ktun95 Feb 4, 2025
8e2c6fe
refactor(OntologyLoader.tsx): remove unused useRouter and Layout impo…
ktun95 Feb 4, 2025
96b1f1f
chore(goannotations.tsx): update import path for GraphQLErrorPage com…
ktun95 Feb 4, 2025
1b107a1
style(goannotations.tsx): improve code formatting and readability by …
ktun95 Feb 4, 2025
c2c0cd7
feat(goannotations.tsx): add NoDataDisplay component to show a messag…
ktun95 Feb 4, 2025
e42a85f
style(OntologyContainer.tsx): remove unnecessary space after Ontology…
ktun95 Feb 4, 2025
75d6faa
refactor(goannotations.tsx): update page title and description to ref…
ktun95 Feb 4, 2025
b6eedc1
chore(genome-page): update import path for GraphQLErrorPage component
ktun95 Feb 4, 2025
31a93c9
feat(genome-page): add Layout component to GenomePageWrapper for cons…
ktun95 Feb 4, 2025
4c77d33
feat(genome-page): add NoDataDisplay component to show message when g…
ktun95 Feb 4, 2025
2e522f2
refactor: remove Layout component and its props as they are no longer…
ktun95 Feb 4, 2025
fd9d377
style(SummaryLoader.tsx): remove unnecessary line breaks in the retur…
ktun95 Feb 4, 2025
0a06812
style(genome-page): remove unnecessary whitespace in NoDataDisplay co…
ktun95 Feb 4, 2025
5c537d2
feat(genome-page): replace specific loader components with generic Lo…
ktun95 Feb 4, 2025
357f6fe
style(Loader.tsx): refactor Loader component to use Paper and makeSty…
ktun95 Feb 4, 2025
51740a0
chore(genome-page): remove OntologyLoader, PhenotypesLoader, Referenc…
ktun95 Feb 4, 2025
78629dc
feat(SummaryContainer.tsx): add NoDataDisplay component to handle emp…
ktun95 Feb 4, 2025
fd956f0
style(genomepage): fix various linting errors
ktun95 Feb 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions apps/genome-page/components/Loader.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
import { makeBy as AmakeBy } from "fp-ts/Array"
import { Skeleton } from "@material-ui/lab"
import Box from "@material-ui/core/Box"
import Paper from "@material-ui/core/Paper"
import { makeStyles } from "@material-ui/core/styles"
import { blue } from "@material-ui/core/colors"

const useStyles = makeStyles({
container: {
backgroundColor: blue[50],
padding: "1rem",
},
})

/**
* Loader is the default loading skeleton component.
*/
const Loader = () => (
<Box mt="10px" data-testid="skeleton-loader">
{AmakeBy(12, (key) => (
<Skeleton height={50} key={key} animation="wave" />
))}
</Box>
)
const Loader = () => {
const classes = useStyles()
return (
<Paper className={classes.container}>
<Box data-testid="skeleton-loader">
{AmakeBy(12, (key) => (
<Skeleton height={50} key={key} animation="wave" />
))}
</Box>
</Paper>
)
}

export { Loader }
47 changes: 47 additions & 0 deletions apps/genome-page/components/NoDataDisplay.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import Paper from "@material-ui/core/Paper"
import Typography from "@material-ui/core/Typography"
import Grid from "@material-ui/core/Grid"
import RemoveCircleOutlineIcon from "@material-ui/icons/RemoveCircleOutline"
import { makeStyles } from "@material-ui/core/styles"
import { blue, grey } from "@material-ui/core/colors"

const useStyles = makeStyles({
container: {
backgroundColor: blue[50],
color: grey[600],
},
grid: {
minHeight: "10rem",
},
icon: {
fontSize: "4rem",
},
})

type NoDataDisplayProperties = {
query: string
geneId: string
}

const NoDataDisplay = ({ query, geneId }: NoDataDisplayProperties) => {
const classes = useStyles()
return (

Check warning on line 28 in apps/genome-page/components/NoDataDisplay.tsx

View check run for this annotation

Codecov / codecov/patch

apps/genome-page/components/NoDataDisplay.tsx#L27-L28

Added lines #L27 - L28 were not covered by tests
<Paper className={classes.container}>
<Grid
className={classes.grid}
container
direction="column"
justifyContent="center"
alignItems="center">
<Grid item>
<RemoveCircleOutlineIcon className={classes.icon} />
</Grid>
<Grid item>
<Typography variant="h2">{`No ${query} for ${geneId}`}</Typography>
</Grid>
</Grid>
</Paper>
)
}

export { NoDataDisplay }

Check warning on line 47 in apps/genome-page/components/NoDataDisplay.tsx

View check run for this annotation

Codecov / codecov/patch

apps/genome-page/components/NoDataDisplay.tsx#L47

Added line #L47 was not covered by tests
82 changes: 82 additions & 0 deletions apps/genome-page/components/errors/GraphQLErrorPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/* eslint-disable unicorn/filename-case */
import { ApolloError } from "@apollo/client"
import { pipe } from "fp-ts/function"
import { head as RAhead } from "fp-ts/ReadonlyArray"

Check warning on line 4 in apps/genome-page/components/errors/GraphQLErrorPage.tsx

View check run for this annotation

Codecov / codecov/patch

apps/genome-page/components/errors/GraphQLErrorPage.tsx#L3-L4

Added lines #L3 - L4 were not covered by tests
import {
map as Omap,
flatMap as OflatMap,
fromNullable as OfromNullable,
getOrElse as OgetOrElse,
} from "fp-ts/Option"
import { match, P } from "ts-pattern"
import Paper from "@material-ui/core/Paper"
import { makeStyles } from "@material-ui/core/styles"
import { blue, grey } from "@material-ui/core/colors"
import { ServerError } from "./ServerError"
import { NotFoundError } from "./NotFoundError"
import { OtherError } from "./OtherError"

Check warning on line 17 in apps/genome-page/components/errors/GraphQLErrorPage.tsx

View check run for this annotation

Codecov / codecov/patch

apps/genome-page/components/errors/GraphQLErrorPage.tsx#L10-L17

Added lines #L10 - L17 were not covered by tests

const useStyles = makeStyles({

Check warning on line 19 in apps/genome-page/components/errors/GraphQLErrorPage.tsx

View check run for this annotation

Codecov / codecov/patch

apps/genome-page/components/errors/GraphQLErrorPage.tsx#L19

Added line #L19 was not covered by tests
container: {
backgroundColor: blue[50],
color: grey[600],
},
grid: {
minHeight: "10rem",
},
icon: {
fontSize: "4rem",
},
})

type GraphQlErrorPageProperties = {
/** GraphQL error object */
error: ApolloError
}

/**
* Displays any errors found when issuing a GraphQL query or mutation.
* Returns one of the other error components based on the error code.
*/

const GraphQLErrorPage = ({ error }: GraphQlErrorPageProperties) => {
const classes = useStyles()

Check warning on line 43 in apps/genome-page/components/errors/GraphQLErrorPage.tsx

View check run for this annotation

Codecov / codecov/patch

apps/genome-page/components/errors/GraphQLErrorPage.tsx#L42-L43

Added lines #L42 - L43 were not covered by tests

return (

Check warning on line 45 in apps/genome-page/components/errors/GraphQLErrorPage.tsx

View check run for this annotation

Codecov / codecov/patch

apps/genome-page/components/errors/GraphQLErrorPage.tsx#L45

Added line #L45 was not covered by tests
<Paper className={classes.container}>
{match(error)
.with({ networkError: P.not(P.nullish) }, () => <ServerError />)
.with({ graphQLErrors: P.select(P.not(P.nullish)) }, (errors) => {
const primaryError = pipe(errors, RAhead)
const primaryErrorCode = pipe(

Check warning on line 51 in apps/genome-page/components/errors/GraphQLErrorPage.tsx

View check run for this annotation

Codecov / codecov/patch

apps/genome-page/components/errors/GraphQLErrorPage.tsx#L48-L51

Added lines #L48 - L51 were not covered by tests
primaryError,
OflatMap(({ extensions }) =>
pipe(

Check warning on line 54 in apps/genome-page/components/errors/GraphQLErrorPage.tsx

View check run for this annotation

Codecov / codecov/patch

apps/genome-page/components/errors/GraphQLErrorPage.tsx#L54

Added line #L54 was not covered by tests
extensions,
OfromNullable,
// eslint-disable-next-line dot-notation
Omap((extension) => extension["code"] as string),

Check warning on line 58 in apps/genome-page/components/errors/GraphQLErrorPage.tsx

View check run for this annotation

Codecov / codecov/patch

apps/genome-page/components/errors/GraphQLErrorPage.tsx#L58

Added line #L58 was not covered by tests
),
),
OgetOrElse(() => ""),

Check warning on line 61 in apps/genome-page/components/errors/GraphQLErrorPage.tsx

View check run for this annotation

Codecov / codecov/patch

apps/genome-page/components/errors/GraphQLErrorPage.tsx#L61

Added line #L61 was not covered by tests
)
const primaryErrorMessage = pipe(

Check warning on line 63 in apps/genome-page/components/errors/GraphQLErrorPage.tsx

View check run for this annotation

Codecov / codecov/patch

apps/genome-page/components/errors/GraphQLErrorPage.tsx#L63

Added line #L63 was not covered by tests
primaryError,
Omap(({ message }) => message),
OgetOrElse(() => ""),

Check warning on line 66 in apps/genome-page/components/errors/GraphQLErrorPage.tsx

View check run for this annotation

Codecov / codecov/patch

apps/genome-page/components/errors/GraphQLErrorPage.tsx#L65-L66

Added lines #L65 - L66 were not covered by tests
)
return match(primaryErrorCode)
.with("Unavailable", () => <ServerError />)

Check warning on line 69 in apps/genome-page/components/errors/GraphQLErrorPage.tsx

View check run for this annotation

Codecov / codecov/patch

apps/genome-page/components/errors/GraphQLErrorPage.tsx#L68-L69

Added lines #L68 - L69 were not covered by tests
.with("NotFound", () => (
<NotFoundError error={primaryErrorMessage} />

Check warning on line 71 in apps/genome-page/components/errors/GraphQLErrorPage.tsx

View check run for this annotation

Codecov / codecov/patch

apps/genome-page/components/errors/GraphQLErrorPage.tsx#L71

Added line #L71 was not covered by tests
))
.otherwise(() => <OtherError />)

Check warning on line 73 in apps/genome-page/components/errors/GraphQLErrorPage.tsx

View check run for this annotation

Codecov / codecov/patch

apps/genome-page/components/errors/GraphQLErrorPage.tsx#L73

Added line #L73 was not covered by tests
})
.otherwise(() => (
<OtherError />

Check warning on line 76 in apps/genome-page/components/errors/GraphQLErrorPage.tsx

View check run for this annotation

Codecov / codecov/patch

apps/genome-page/components/errors/GraphQLErrorPage.tsx#L76

Added line #L76 was not covered by tests
))}
</Paper>
)
}

export { GraphQLErrorPage }

Check warning on line 82 in apps/genome-page/components/errors/GraphQLErrorPage.tsx

View check run for this annotation

Codecov / codecov/patch

apps/genome-page/components/errors/GraphQLErrorPage.tsx#L82

Added line #L82 was not covered by tests
4 changes: 2 additions & 2 deletions apps/genome-page/components/errors/NotFoundError.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ const NotFoundError = ({ error }: Properties) => {
const classes = useStyles()

return (
<Grid container className={classes.mainGrid} justifyContent="center">
<Grid container justifyContent="center">
<Grid item xs={10} md={8}>
<div className={classes.error400}>
<Image
src="/sad-dicty.png"
src="https://storage.dictybase.dev/editor/assets/2024-11-04/0627257c-9ce3-4f02-b000-9e16ef5b1062"
alt="Sad Dicty Logo"
width="350px"
height="200%"
Expand Down
10 changes: 4 additions & 6 deletions apps/genome-page/components/errors/OtherError.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react"
import Grid from "@material-ui/core/Grid"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import Typography from "@material-ui/core/Typography"
import Image from "next/image"
import { ErrorMessage } from "./ErrorMessage"
import { useStyles } from "../../styles/errorStyles"
Expand All @@ -13,18 +13,16 @@ const OtherError = () => {
const classes = useStyles()

return (
<Grid container className={classes.mainGrid} justifyContent="center">
<Grid container justifyContent="center">
<Grid item xs={10} md={8}>
<div className={classes.error400}>
<Image
src="/sad-dicty.png"
src="https://storage.dictybase.dev/editor/assets/2024-11-04/0627257c-9ce3-4f02-b000-9e16ef5b1062"
alt="Sad Dicty Logo"
width="350px"
height="200%"
/>
<h1>
<FontAwesomeIcon icon="exclamation-circle" /> Error
</h1>
<Typography variant="h2"> Sorry, something went wrong. </Typography>
<ErrorMessage />
</div>
</Grid>
Expand Down
2 changes: 1 addition & 1 deletion apps/genome-page/components/errors/ServerError.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const ServerError = () => {
const classes = useStyles()

return (
<Grid container className={classes.mainGrid} justifyContent="center">
<Grid container justifyContent="center">
<Grid item xs={10} md={8}>
<div className={classes.error500}>
<h2>Sorry! There was a server error.</h2>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import Typography from "@material-ui/core/Typography"
import { Layout } from "components/layout/Layout"
import { GeneOntologyAnnotationQuery } from "dicty-graphql-schema"
import { useRouter } from "next/router"
import { OntologyTabLayout } from "./OntologyTabLayout"
/**
* Container component that issues a GraphQL query to get gene data for the
Expand All @@ -11,20 +9,10 @@ import { OntologyTabLayout } from "./OntologyTabLayout"
interface OntologyContainerProperties {
goas: NonNullable<GeneOntologyAnnotationQuery["geneOntologyAnnotation"]>
}
const OntologyContainer = ({ goas }: OntologyContainerProperties) => {
const { query } = useRouter()
const geneId = query.id as string

return (
<Layout
gene={geneId}
title={`GO Annotations for ${geneId}`}
description={`Gene Ontology Annotations for ${geneId}`}>
<Typography component="div">
<OntologyTabLayout goas={goas} />{" "}
</Typography>
</Layout>
)
}
const OntologyContainer = ({ goas }: OntologyContainerProperties) => (
<Typography component="div">
<OntologyTabLayout goas={goas} />
</Typography>
)

export { OntologyContainer }

This file was deleted.

This file was deleted.

60 changes: 0 additions & 60 deletions apps/genome-page/components/features/Ontology/OntologyLoader.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
import Typography from "@material-ui/core/Typography"
import { Layout } from "components/layout/Layout"
import { ListStrainsWithGeneQuery } from "dicty-graphql-schema"
import { useRouter } from "next/router"
import { PhenotypesDataTable } from "./PhenotypesDataTable"

interface PhenotypesContainerProperties {
strains: NonNullable<ListStrainsWithGeneQuery["listStrainsWithGene"]>
}
const PhenotypesContainer = ({ strains }: PhenotypesContainerProperties) => {
const { query } = useRouter()
const geneId = query.id as string

return (
<Layout
gene={geneId}
title={`Phenotypes for ${geneId}`}
description={`Gene phenotypes for ${geneId}`}>
<Typography component="div">
<PhenotypesDataTable strains={strains} />
</Typography>
</Layout>
)
}
const PhenotypesContainer = ({ strains }: PhenotypesContainerProperties) => (
<Typography component="div">
<PhenotypesDataTable strains={strains} />
</Typography>
)

export { PhenotypesContainer }

This file was deleted.

Loading