-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from galaxyproject/fran/18-analysis
feat: add "analysis" section (#18)
- Loading branch information
Showing
44 changed files
with
1,208 additions
and
112 deletions.
There are no files selected for viewing
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
7 changes: 6 additions & 1 deletion
7
data-catalog/app/apis/catalog/brc-analytics-catalog/common/utils.ts
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,5 +1,10 @@ | ||
import { BRCDataCatalogGenome } from "./entities"; | ||
|
||
export function getGenomeId(genome: BRCDataCatalogGenome): string { | ||
return genome.organism; | ||
return genome.genomeVersionAssemblyId; | ||
} | ||
|
||
export function getGenomeTitle(genome?: BRCDataCatalogGenome): string { | ||
if (!genome) return ""; | ||
return `${genome.species} - ${genome.strain}`; | ||
} |
13 changes: 13 additions & 0 deletions
13
data-catalog/app/components/Entity/components/AnalysisMethod/analysisMethod.styles.ts
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { ButtonPrimary } from "@databiosphere/findable-ui/lib/components/common/Button/components/ButtonPrimary/buttonPrimary"; | ||
import { CardContent } from "@databiosphere/findable-ui/lib/components/common/Card/card.styles"; | ||
import styled from "@emotion/styled"; | ||
|
||
export const StyledCardContent = styled(CardContent)` | ||
gap: 4px; | ||
`; | ||
|
||
export const StyledButtonPrimary = styled(ButtonPrimary)` | ||
justify-self: flex-start; | ||
padding-bottom: 8px; | ||
padding-top: 8px; | ||
`; |
48 changes: 48 additions & 0 deletions
48
data-catalog/app/components/Entity/components/AnalysisMethod/analysisMethod.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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { CardProps } from "@databiosphere/findable-ui/lib/components/common/Card/card"; | ||
import { CardSection } from "@databiosphere/findable-ui/lib/components/common/Card/card.styles"; | ||
import { CardText } from "@databiosphere/findable-ui/lib/components/common/Card/components/CardText/cardText"; | ||
import { CardTitle } from "@databiosphere/findable-ui/lib/components/common/Card/components/CardTitle/cardTitle"; | ||
import { FluidPaper } from "@databiosphere/findable-ui/lib/components/common/Paper/paper.styles"; | ||
import { | ||
ANCHOR_TARGET, | ||
REL_ATTRIBUTE, | ||
} from "@databiosphere/findable-ui/lib/components/Links/common/entities"; | ||
import { Card } from "@mui/material"; | ||
import { | ||
StyledButtonPrimary, | ||
StyledCardContent, | ||
} from "./analysisMethod.styles"; | ||
|
||
export interface AnalysisMethodProps extends CardProps { | ||
url: string; | ||
} | ||
|
||
export const AnalysisMethod = ({ | ||
Paper = FluidPaper, | ||
text, | ||
title, | ||
url, | ||
}: AnalysisMethodProps): JSX.Element => { | ||
return ( | ||
<Card component={Paper}> | ||
<CardSection> | ||
<StyledCardContent> | ||
<CardTitle>{title}</CardTitle> | ||
<CardText>{text}</CardText> | ||
</StyledCardContent> | ||
<StyledButtonPrimary | ||
disabled={!url} | ||
onClick={(): void => { | ||
window.open( | ||
url, | ||
ANCHOR_TARGET.BLANK, | ||
REL_ATTRIBUTE.NO_OPENER_NO_REFERRER | ||
); | ||
}} | ||
> | ||
Analyze | ||
</StyledButtonPrimary> | ||
</CardSection> | ||
</Card> | ||
); | ||
}; |
1 change: 1 addition & 0 deletions
1
data-catalog/app/components/Entity/components/AnalysisMethod/mdx/assembly.mdx
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. |
1 change: 1 addition & 0 deletions
1
...talog/app/components/Entity/components/AnalysisMethod/mdx/genomeComparisons.mdx
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. |
6 changes: 6 additions & 0 deletions
6
data-catalog/app/components/Entity/components/AnalysisMethod/mdx/index.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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export { default as Assembly } from "./assembly.mdx"; | ||
export { default as GenomeComparisons } from "./genomeComparisons.mdx"; | ||
export { default as ProteinFolding } from "./proteinFolding.mdx"; | ||
export { default as Regulation } from "./regulation.mdx"; | ||
export { default as Transcriptomics } from "./transcriptomics.mdx"; | ||
export { default as VariantCalling } from "./variantCalling.mdx"; |
1 change: 1 addition & 0 deletions
1
...-catalog/app/components/Entity/components/AnalysisMethod/mdx/proteinFolding.mdx
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. |
1 change: 1 addition & 0 deletions
1
data-catalog/app/components/Entity/components/AnalysisMethod/mdx/regulation.mdx
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. |
1 change: 1 addition & 0 deletions
1
...catalog/app/components/Entity/components/AnalysisMethod/mdx/transcriptomics.mdx
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. |
1 change: 1 addition & 0 deletions
1
...-catalog/app/components/Entity/components/AnalysisMethod/mdx/variantCalling.mdx
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. |
9 changes: 9 additions & 0 deletions
9
data-catalog/app/components/Entity/components/AnalysisPortals/analysisPortals.styles.ts
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import styled from "@emotion/styled"; | ||
import { ButtonBase } from "@mui/material"; | ||
|
||
export const StyledButtonBase = styled(ButtonBase)` | ||
display: grid; | ||
gap: 8px; | ||
grid-template-columns: auto 1fr; | ||
justify-items: flex-start; | ||
`; |
47 changes: 47 additions & 0 deletions
47
data-catalog/app/components/Entity/components/AnalysisPortals/analysisPortals.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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { | ||
StaticImage, | ||
StaticImageProps, | ||
} from "@databiosphere/findable-ui/lib/components/common/StaticImage/staticImage"; | ||
import { | ||
ANCHOR_TARGET, | ||
REL_ATTRIBUTE, | ||
} from "@databiosphere/findable-ui/lib/components/Links/common/entities"; | ||
import { TEXT_BODY_400 } from "@databiosphere/findable-ui/lib/theme/common/typography"; | ||
import { Typography } from "@mui/material"; | ||
import { Fragment } from "react"; | ||
import { StyledButtonBase } from "./analysisPortals.styles"; | ||
|
||
export interface AnalysisPortals { | ||
imageProps: StaticImageProps; | ||
label: string; | ||
url: string; | ||
} | ||
|
||
interface AnalysisPortalsProps { | ||
portals: AnalysisPortals[]; | ||
} | ||
|
||
export const AnalysisPortals = ({ | ||
portals, | ||
}: AnalysisPortalsProps): JSX.Element => { | ||
if (portals.length === 0) return <span>None</span>; | ||
return ( | ||
<Fragment> | ||
{portals.map(({ imageProps, label, url }) => ( | ||
<StyledButtonBase | ||
key={label} | ||
onClick={(): void => { | ||
window.open( | ||
url, | ||
ANCHOR_TARGET.BLANK, | ||
REL_ATTRIBUTE.NO_OPENER_NO_REFERRER | ||
); | ||
}} | ||
> | ||
<StaticImage {...imageProps} key={label} /> | ||
<Typography variant={TEXT_BODY_400}>{label}</Typography> | ||
</StyledButtonBase> | ||
))} | ||
</Fragment> | ||
); | ||
}; |
10 changes: 10 additions & 0 deletions
10
...ut/components/Detail/components/DetailViewHero/components/BackButton/backButton.styles.ts
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { mediaDesktopSmallUp } from "@databiosphere/findable-ui/lib/styles/common/mixins/breakpoints"; | ||
import styled from "@emotion/styled"; | ||
import { HeroActions as DetailViewActions } from "../../detailViewHero.styles"; | ||
|
||
export const HeroActions = styled(DetailViewActions)` | ||
${mediaDesktopSmallUp} { | ||
align-self: flex-start; | ||
margin: 8px 0; | ||
} | ||
`; |
32 changes: 32 additions & 0 deletions
32
...s/Layout/components/Detail/components/DetailViewHero/components/BackButton/backButton.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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { SouthIcon } from "@databiosphere/findable-ui/lib/components/common/CustomIcon/components/SouthIcon/southIcon"; | ||
import { IconButton } from "@mui/material"; | ||
import { useRouter } from "next/router"; | ||
import { useCallback } from "react"; | ||
import { HeroActions } from "./backButton.styles"; | ||
|
||
export const BackButton = (): JSX.Element => { | ||
const { asPath, push } = useRouter(); | ||
const onNavigate = useCallback( | ||
() => push(getNextPath(asPath)), | ||
[asPath, push] | ||
); | ||
return ( | ||
<HeroActions> | ||
<IconButton color="secondary" size="medium" onClick={onNavigate}> | ||
<SouthIcon /> | ||
</IconButton> | ||
</HeroActions> | ||
); | ||
}; | ||
|
||
/** | ||
* Returns the next path to navigate to when the back button is clicked. | ||
* The back button will navigate to the parent path of the current path. | ||
* @param asPath - Current path. | ||
* @returns next path. | ||
*/ | ||
function getNextPath(asPath: string): string { | ||
const path = asPath.split("/"); | ||
path.pop(); | ||
return path.join("/"); | ||
} |
60 changes: 60 additions & 0 deletions
60
...pp/components/Layout/components/Detail/components/DetailViewHero/detailViewHero.styles.ts
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { | ||
mediaDesktopSmallUp, | ||
mediaTabletUp, | ||
} from "@databiosphere/findable-ui/lib/styles/common/mixins/breakpoints"; | ||
import styled from "@emotion/styled"; | ||
|
||
export const DetailViewHero = styled.div` | ||
display: grid; | ||
gap: 16px; | ||
grid-column: 1 / -1; | ||
margin-bottom: 8px; | ||
`; | ||
|
||
export const DetailViewHeroHeadline = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
gap: 16px; | ||
${mediaDesktopSmallUp} { | ||
flex-direction: row; | ||
} | ||
`; | ||
|
||
export const HeroHeader = styled.div` | ||
display: flex; | ||
flex: 1; | ||
flex-direction: column; | ||
gap: 4px; | ||
`; | ||
|
||
export const HeroTitle = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
gap: 8px; | ||
${mediaTabletUp} { | ||
align-items: center; | ||
flex-direction: row; | ||
} | ||
.MuiTypography-text-heading { | ||
max-width: 726px; | ||
} | ||
`; | ||
|
||
export const Titles = styled.div` | ||
display: grid; | ||
gap: 4px; | ||
`; | ||
|
||
export const HeroActions = styled.div` | ||
align-items: center; | ||
align-self: flex-start; | ||
display: flex; | ||
gap: 8px; | ||
${mediaDesktopSmallUp} { | ||
align-self: center; | ||
} | ||
`; |
51 changes: 51 additions & 0 deletions
51
...alog/app/components/Layout/components/Detail/components/DetailViewHero/detailViewHero.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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { BackPageTabs } from "@databiosphere/findable-ui/lib/components/Layout/components/BackPage/backPageView.styles"; | ||
import { SubTitle } from "@databiosphere/findable-ui/lib/components/Layout/components/BackPage/components/BackPageHero/components/SubTitle/subTitle"; | ||
import { TEXT_HEADING } from "@databiosphere/findable-ui/lib/theme/common/typography"; | ||
import { HeroTitle as Typography } from "@databiosphere/findable-ui/src/components/common/Title/title.styles"; | ||
import { ReactNode } from "react"; | ||
import { BackButton } from "./components/BackButton/backButton"; | ||
import { | ||
DetailViewHero as DetailViewHeroLayout, | ||
DetailViewHeroHeadline, | ||
HeroHeader, | ||
HeroTitle, | ||
Titles, | ||
} from "./detailViewHero.styles"; | ||
|
||
export interface DetailViewHeroProps { | ||
breadcrumbs?: ReactNode; | ||
subTitle?: ReactNode; | ||
tabs?: ReactNode; | ||
title?: ReactNode; | ||
} | ||
|
||
export const DetailViewHero = ({ | ||
breadcrumbs, | ||
subTitle, | ||
tabs, | ||
title, | ||
}: DetailViewHeroProps): JSX.Element => { | ||
return ( | ||
<DetailViewHeroLayout> | ||
{(breadcrumbs || title) && ( | ||
<DetailViewHeroHeadline> | ||
<BackButton /> | ||
<HeroHeader> | ||
{breadcrumbs} | ||
<HeroTitle> | ||
<Titles> | ||
{title && ( | ||
<Typography component="h1" variant={TEXT_HEADING}> | ||
{title} | ||
</Typography> | ||
)} | ||
{subTitle && <SubTitle subTitle={subTitle} />} | ||
</Titles> | ||
</HeroTitle> | ||
</HeroHeader> | ||
</DetailViewHeroHeadline> | ||
)} | ||
{tabs && <BackPageTabs>{tabs}</BackPageTabs>} | ||
</DetailViewHeroLayout> | ||
); | ||
}; |
8 changes: 8 additions & 0 deletions
8
...pp/components/Table/components/TableCell/components/AnalyzeGenome/analyzeGenome.styles.ts
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { ButtonGroup } from "@databiosphere/findable-ui/lib/components/common/ButtonGroup/buttonGroup"; | ||
import styled from "@emotion/styled"; | ||
|
||
export const StyledButtonGroup = styled(ButtonGroup)` | ||
.MuiButton-sizeSmall { | ||
padding: 8px; | ||
} | ||
`; |
57 changes: 57 additions & 0 deletions
57
...alog/app/components/Table/components/TableCell/components/AnalyzeGenome/analyzeGenome.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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { | ||
ANCHOR_TARGET, | ||
REL_ATTRIBUTE, | ||
} from "@databiosphere/findable-ui/lib/components/Links/common/entities"; | ||
import { Button } from "@mui/material"; | ||
import Router from "next/router"; | ||
import { ROUTES } from "../../../../../../../routes/contants"; | ||
import { BRCDataCatalogGenome } from "../../../../../../apis/catalog/brc-analytics-catalog/common/entities"; | ||
import { AnalyzeGenomeIcon } from "../../../../../common/CustomIcon/components/AnalyzeGenomeIcon/analyzeGenomeIcon"; | ||
import { ViewGenomeIcon } from "../../../../../common/CustomIcon/components/ViewGenomeIcon/viewGenomeIcon"; | ||
import { StyledButtonGroup } from "./analyzeGenome.styles"; | ||
import { | ||
BUTTON_GROUP_PROPS, | ||
BUTTON_PROPS, | ||
ICON_PROPS, | ||
} from "./common/constants"; | ||
|
||
export interface AnalyzeGenomeProps { | ||
genome: BRCDataCatalogGenome; | ||
} | ||
|
||
export const AnalyzeGenome = ({ genome }: AnalyzeGenomeProps): JSX.Element => { | ||
const { genomeVersionAssemblyId, ucscBrowserUrl } = genome; | ||
|
||
const onAnalyze = (entityId: string): void => { | ||
Router.push(`${ROUTES.GENOMES}/${entityId}`); | ||
}; | ||
|
||
const onView = (url: string | null): void => { | ||
if (!url) return; | ||
window.open(url, ANCHOR_TARGET.BLANK, REL_ATTRIBUTE.NO_OPENER_NO_REFERRER); | ||
}; | ||
|
||
return ( | ||
<StyledButtonGroup | ||
{...BUTTON_GROUP_PROPS} | ||
Buttons={[ | ||
<Button | ||
{...BUTTON_PROPS} | ||
disabled={!genomeVersionAssemblyId} | ||
key="analyze" | ||
onClick={(): void => onAnalyze(genomeVersionAssemblyId)} | ||
> | ||
<AnalyzeGenomeIcon {...ICON_PROPS} /> | ||
</Button>, | ||
<Button | ||
{...BUTTON_PROPS} | ||
disabled={!ucscBrowserUrl} | ||
key="view" | ||
onClick={(): void => onView(ucscBrowserUrl)} | ||
> | ||
<ViewGenomeIcon {...ICON_PROPS} /> | ||
</Button>, | ||
]} | ||
/> | ||
); | ||
}; |
Oops, something went wrong.