Skip to content

Commit

Permalink
add new ELITE Browse Tools page
Browse files Browse the repository at this point in the history
  • Loading branch information
jay-hodgson committed Sep 26, 2024
1 parent 25e5e59 commit 449a6b8
Show file tree
Hide file tree
Showing 5 changed files with 331 additions and 7 deletions.
22 changes: 21 additions & 1 deletion apps/portals/elportal/src/config/routesConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ import {
projectCardConfiguration,
projectsDetailsPageConfiguration,
} from './synapseConfigs/projects'
import { partnersSql, peopleSql, projectsSql, upsetPlotSql } from './resources'
import {
computationalSql,
partnersSql,
peopleSql,
projectsSql,
upsetPlotSql,
} from './resources'
import { handleUpsetPlotClick } from './synapseConfigs/handleUpsetPlotClick'

const routes: GenericRoute[] = [
Expand Down Expand Up @@ -217,6 +223,20 @@ const routes: GenericRoute[] = [
},
],
},
{
path: 'Browse Tools',
exact: true,
synapseConfigArray: [
{
name: 'ELBrowseToolsPage',
props: {
popularSearchesSql: '',
toolsSql: computationalSql,
},
isOutsideContainer: true,
},
],
},
{
path: 'Explore',
routes: [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,294 @@
import { SynapseComponents, FeaturedToolsList } from 'synapse-react-client'
import Layout from '../Layout'
import React from 'react'
import { Box, Button, Link, TextField, Typography } from '@mui/material'
import { Query, TextMatchesQueryFilter } from '@sage-bionetworks/synapse-types'
import PopularSearches from '../PopularSearches'
import pluralize from 'pluralize'
import Ecosystem from '../csbc-home-page/Ecosystem'

type Category = {
resourceName: string
}

const categories: Category[] = [
{ resourceName: 'Cell Lines' },
{ resourceName: 'Gene Targets' },
{ resourceName: 'Biomarkers' },
{ resourceName: 'Chemoinformatics' },
]

export type ELBrowseToolsPageProps = {
popularSearchesSql: string
toolsSql: string
}

const ELBrowseToolsPage = (props: ELBrowseToolsPageProps) => {
const { popularSearchesSql, toolsSql } = props
const [searchText, setSearchText] = React.useState<string>('')
const gotoExploreTools = () => {
window.location.assign('/Explore/Computational%20Tools')
}

const gotoExploreToolsWithSelectedResource = (selectedResource: string) => {
const query: Query = {
sql: toolsSql,
selectedFacets: [
{
concreteType:
'org.sagebionetworks.repo.model.table.FacetColumnValuesRequest',
columnName: 'resourceType',
facetValues: [selectedResource],
},
],
}
window.location.assign(
`/Explore/Computational%20Tools?QueryWrapper0=${JSON.stringify(query)}`,
)
}

const gotoExploreToolsWithFullTextSearch = (fullTextSearchString: string) => {
const filter: TextMatchesQueryFilter = {
concreteType:
'org.sagebionetworks.repo.model.table.TextMatchesQueryFilter',
searchExpression: fullTextSearchString,
}
const query: Query = {
sql: toolsSql,
additionalFilters: [filter],
}
window.location.assign(
`/Explore/Computational%20Tools?QueryWrapper0=${JSON.stringify(query)}`,
)
}

const wideButtonSx = { marginTop: '50px' }

return (
<div className="browse-tools-page">
<div className="header">
<div className="home-container-description">
<Typography variant="headline1" className="sectionTitle">
EL Translational Research Tools
</Typography>
<div
className="center-content"
style={{ marginLeft: '10px', marginRight: '10px' }}
>
<div className="description">
<Typography variant="body1">
Exceptional Longevity (EL) Translational Research Tools aims to
support the translation of multidimensional biological data from
human longevity studies into potential therapeutic targets for
healthy aging. The database includes EL-associated cell lines
and chemoinformatics tools, including details on tool
characteristics and sourcing.
</Typography>
</div>
</div>
</div>
</div>
<Layout outsideContainerClassName="home-spacer">
<Typography variant="sectionTitle" className="sectionTitle">
Browse Tools by Category
</Typography>
<Typography variant="body1" className="sectionSubtitle">
Drill-down to explore specific types of EL translational research
tools
</Typography>
<Box
sx={{
color: 'white',
display: 'flex',
justifyContent: 'space-evenly',
alignItems: 'stretch',
}}
>
{categories.map(category => {
return (
<Box
sx={{
backgroundColor: '#1d594e',
width: '200px',
textAlign: 'center',
}}
>
<button
key={category.resourceName}
onClick={() =>
gotoExploreToolsWithSelectedResource(category.resourceName)
}
>
<Typography
variant="headline3"
sx={{ py: '30px', px: '10px' }}
>
{pluralize(category.resourceName)}
</Typography>
</button>
</Box>
)
})}
</Box>
<div className="center-content">
<SynapseComponents.WideButton
sx={wideButtonSx}
variant="contained"
onClick={() => gotoExploreTools()}
>
View All Tools
</SynapseComponents.WideButton>
</div>
</Layout>
<div className="home-container-description home-bg-dark home-spacer">
<Typography
variant="sectionTitle"
sx={{
textAlign: 'center',
paddingTop: '50px',
paddingBottom: '15px',
}}
>
What Tools Can We Help You Find?
</Typography>
<Typography
variant="body1"
sx={{ textAlign: 'center', paddingBottom: '15px' }}
>
For the greatest success with your search, ensure your spelling is
correct and avoid pluralization or suffixes.
</Typography>
<Typography
variant="body1"
sx={{ textAlign: 'center', paddingBottom: '40px' }}
>
<Link
href="https://help.nf.synapse.org/NFdocs/Tips-for-Search.2640478225.html"
target="_blank"
>
Learn More About MySQL Full Text Search
</Link>
</Typography>
<div className="center-content">
<div className="searchToolsRow">
<div className="searchInputWithIcon">
<SynapseComponents.IconSvg icon="searchOutlined" />
<TextField
sx={{ width: '100%' }}
type="search"
placeholder=""
value={searchText}
onChange={event => {
setSearchText(event.target.value)
}}
onKeyPress={evt => {
if (evt.key === 'Enter') {
gotoExploreToolsWithFullTextSearch(searchText)
}
}}
/>
</div>
<div className="search-button-container">
<Button
variant="contained"
onClick={() => gotoExploreToolsWithFullTextSearch(searchText)}
>
Search
</Button>
</div>
</div>
</div>
<Typography variant="sectionTitle" className="sectionTitle">
Suggested Searches
</Typography>
<div className="center-content">
<PopularSearches
sql={popularSearchesSql}
onGoToExploreToolsWithFullTextSearch={searchTerm =>
gotoExploreToolsWithFullTextSearch(searchTerm)
}
/>
</div>
</div>

{/* <Layout outsideContainerClassName="home-spacer">
<Typography variant="sectionTitle" className="sectionTitle">
Recently Added Tools
</Typography>
<Typography variant="body1" className="sectionSubtitle">
Check out some recently-catalogued research resources below.
</Typography>
<div className="center-content">
<FeaturedToolsList
entityId={'syn51469335'}
idColumnName={'resourceId'}
nameColumnName={'resourceName'}
descriptionColumnName={'description'}
typeColumnName={'resourceType'}
dateColumnName={'dateAdded'}
toolDetailPageURL={'/Explore/Tools/DetailsPage?resourceId='}
/>
</div>
<div className="center-content">
<SynapseComponents.WideButton
sx={wideButtonSx}
variant="contained"
onClick={() => gotoExploreTools()}
>
View All Tools
</SynapseComponents.WideButton>
</div>
</Layout> */}
<Layout outsideContainerClassName="home-container-description home-bg-dark home-spacer">
<Typography variant="sectionTitle" className="sectionTitle">
Announcements
</Typography>
<Ecosystem
config={[
{
title: 'EL-specific iPSC Library',
ownerId: 'syn27229419',
wikiId: '629574',
},
]}
/>
</Layout>
<Box
sx={{
backgroundColor: '#1d594e',
color: 'white',
p: '50px 0px 100px 0px;',
}}
>
<Layout outsideContainerClassName="home-spacer">
<Typography variant="sectionTitle" className="sectionTitle">
Submit a Tool to EL Translational Research Tools
</Typography>
<div className="center-content">
<div className="description">
<Typography variant="body1">
We are currently accepting submissions that describe any
EL-related cell line, gene target validation, biomarker, or
biobank. If you have a tool that you would like to add to EL
Translational Research Tools, please click the button below.
</Typography>
</div>
</div>
<div className="center-content">
<SynapseComponents.WideButton
sx={wideButtonSx}
href="https://sagebionetworks.jira.com/servicedesk/customer/portal/12"
className="highlightSubmitToolButton"
variant="contained"
// @ts-expect-error - target prop exists, but TS doesn't recognize on styled component
target="_blank"
>
Submit A Tool
</SynapseComponents.WideButton>
</div>
</Layout>
</Box>
</div>
)
}
export default ELBrowseToolsPage
2 changes: 2 additions & 0 deletions apps/synapse-portal-framework/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Ecosystem from './csbc-home-page/Ecosystem'
import AboutPortal from './csbc-home-page/AboutPortal'
import DevelopedBySage from './csbc-home-page/DevelopedBySage'
import NFBrowseToolsPage from './nf/NFBrowseToolsPage'
import ELBrowseToolsPage from './elportal/ELBrowseToolsPage'
import ELBetaLaunchBanner from './elportal/ELBetaLaunchBanner'
import ARKWelcomePage from './arkportal/ARKWelcomePage'
import GenieHomePageHeader from './genie/GenieHomePageHeader'
Expand Down Expand Up @@ -42,6 +43,7 @@ const PortalComponents = {
RedirectWithQuery,
Redirect,
NFBrowseToolsPage,
ELBrowseToolsPage,
ELBetaLaunchBanner,
ARKWelcomePage,
GenieHomePageHeader,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import Layout from '../Layout'
import React from 'react'
import { Button, Link, TextField, Typography } from '@mui/material'
import { Query, TextMatchesQueryFilter } from '@sage-bionetworks/synapse-types'
import { ReactComponent as AnimalModels } from './assets/animalmodels.svg'
import { ReactComponent as Antibodies } from './assets/antibodies.svg'
import { ReactComponent as Biobanks } from './assets/biobanks.svg'
import { ReactComponent as CellLines } from './assets/cell-lines.svg'
import { ReactComponent as PlasmidsReagents } from './assets/plasmids-reagents.svg'
import { ReactComponent as AnimalModels } from '../assets/animalmodels.svg'
import { ReactComponent as Antibodies } from '../assets/antibodies.svg'
import { ReactComponent as Biobanks } from '../assets/biobanks.svg'
import { ReactComponent as CellLines } from '../assets/cell-lines.svg'
import { ReactComponent as PlasmidsReagents } from '../assets/plasmids-reagents.svg'
import PopularSearches from '../PopularSearches'
import pluralize from 'pluralize'
import Ecosystem from '../csbc-home-page/Ecosystem'
Expand Down Expand Up @@ -161,8 +161,8 @@ const NFBrowseToolsPage = (props: NFBrowseToolsPageProps) => {
<div className="center-content">
<div className="searchToolsRow">
<div className="searchInputWithIcon">
<SynapseComponents.IconSvg icon="searchOutlined" />
<TextField
sx={{ width: '100%' }}
type="search"
placeholder=""
value={searchText}
Expand All @@ -179,6 +179,7 @@ const NFBrowseToolsPage = (props: NFBrowseToolsPageProps) => {
<div className="search-button-container">
<Button
variant="contained"
sx={{ px: '25px', py: '8px' }}
onClick={() => gotoExploreToolsWithFullTextSearch(searchText)}
>
Search
Expand Down
Loading

0 comments on commit 449a6b8

Please sign in to comment.