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

add landing page #170

Merged
merged 12 commits into from
Dec 2, 2023
62 changes: 62 additions & 0 deletions frontend/packages/data-portal/app/components/Index/IndexCTA.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { Button } from '@czi-sds/components'

import { I18n } from 'app/components/I18n'
import { Link } from 'app/components/Link'
import { useI18n } from 'app/hooks/useI18n'

function CTA({
title,
text,
buttonText,
url,
}: {
title: string
text: string
buttonText: string
url: string
}) {
return (
<>
<div className="flex flex-col gap-sds-xs">
<h4 className="font-sds-semibold font-semibold text-sds-header-m leading-sds-header-m">
{title}
</h4>
<p>{text}</p>
</div>
<div>
<Link to={url}>
<Button sdsType="primary" sdsStyle="rounded">
{buttonText}
</Button>
</Link>
</div>
</>
)
}

export function IndexCTA() {
const { t } = useI18n()

return (
<div className="py-sds-xxl flex flex-col gap-sds-xl relative after:h-full after:w-[200vw] after:bg-sds-primary-100 after:absolute after:top-0 after:-translate-x-1/2 after:-z-10">
<h3 className="font-sds-semibold font-semibold text-sds-header-xl leading-sds-header-xl">
<I18n i18nKey="helpUsAchieveThisVision" />
</h3>
<div className="w-full grid grid-cols-[1fr_auto_1fr] grid-rows-[1fr_auto] grid-flow-col gap-y-sds-xl gap-x-sds-xxl">
<CTA
title={t('viewAndDownloadDatasets')}
text={t('viewDatasetsCta')}
buttonText={t('browseData')}
url="/browse-data/datasets"
/>
<div className="bg-sds-gray-200 w-sds-xxxs row-span-2" />
<CTA
title={t('contributeYourData')}
text={t('contributeCta')}
buttonText={t('tellUsMore')}
url={t('urlDataContributionForm')}
/>
</div>
</div>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { I18n } from 'app/components/I18n'

import { IndexContributors } from './IndexContributors'
import { IndexCTA } from './IndexCTA'

export function IndexContent() {
return (
<div className="px-sds-xl w-[100vw] overflow-x-clip flex flex-col items-center">
<div className="flex flex-col max-w-content-small py-sds-xxl gap-sds-xxl">
<div className="flex flex-col gap-sds-xl">
<h2 className="font-sds-semibold font-semibold text-sds-header-xl leading-sds-header-xl">
<I18n i18nKey="landingPageWelcomeBlurb" />
</h2>
<div className="font-sds-regular text-sds-body-s leading-sds-body-s flex flex-col gap-sds-l">
<p>
<I18n i18nKey="landingPageCopy1" />
</p>
<p>
<I18n i18nKey="landingPageCopy2" />
</p>
<p>
<I18n i18nKey="landingPageCopy3" />
</p>
<p>
<I18n i18nKey="landingPageCopy4" />
</p>
<p>
<I18n i18nKey="landingPageCopy5" />
</p>
</div>
</div>
<IndexCTA />
<IndexContributors />
<div className="flex flex-col gap-sds-m">
<div className="flex-initial h-sds-xxxs bg-sds-gray-200" />
<p className="text-sds-body-xxxs leading-sds-body-xxxs text-sds-gray-600">
<I18n i18nKey="landingHeaderImageAttribution" />
</p>
</div>
</div>
</div>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { I18n } from 'app/components/I18n'

const CONTRIBUTORS = `
David Agard
Ben Barad
Florian Bec
John Briggs
Zhen Chen
Jane Ding
Ben Engel
Ryan Feathers
Sara Goetz
Danielle Grotjhan
Gus Hart
Grant Jensen
Mohammed Kaplan
Zunlong Ke
Sagar Khavnekar
Abhay Kotecha
Jun Liu
Julia Mahamid
Michaela Medina
Jürgen Plitzko
Ricado Righetto
Kem Sochacki
Matt Swulius
Liang Xue
Huaxin Yu
Ellen Zhong
`

export function IndexContributors() {
const contributors = CONTRIBUTORS.split('\n').filter(Boolean)

return (
<div className="flex flex-col gap-sds-xl h-full">
<h3 className="font-sds-semibold font-semibold text-sds-header-xl leading-sds-header-xl">
<I18n i18nKey="thankYouToOurDataContributors" />
</h3>
<ul className="grid grid-flow-col grid-rows-[repeat(7,_minmax(0,_1fr))] grid-cols-4 gap-y-sds-xxs gap-x-sds-xl">
{contributors.map((name) => (
<li key={name} className="text-sds-body-xs leading-sds-body-xs">
{name}
</li>
))}
</ul>
</div>
)
}
95 changes: 95 additions & 0 deletions frontend/packages/data-portal/app/components/Index/IndexHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import { Button } from '@czi-sds/components'
import { styled } from '@mui/material/styles'
import { useTypedLoaderData } from 'remix-typedjson'

import { LandingPageDataQuery } from 'app/__generated__/graphql'
import { I18n } from 'app/components/I18n'
import { Link } from 'app/components/Link'
import { useI18n } from 'app/hooks/useI18n'
import { theme } from 'app/theme'
import { cns, cnsNoMerge } from 'app/utils/cns'

function MetricField({ title, count }: { title: string; count: number }) {
return (
<div
className={cns(
'flex flex-col items-center justify-center',
'flex-auto max-w-[120px] w-full px-sds-m',
'font-sds-semibold font-semibold',
)}
>
<p className="text-sds-caps-xxxs leading-sds-caps-xxxs uppercase drop-shadow-landing-header">
{title}
</p>
<p className="text-sds-header-l leading-sds-header-l drop-shadow-landing-header">
{count.toLocaleString()}
</p>
</div>
)
}

const CTAButton = styled(Button)({
'background-color': theme.palette.grey[200],
color: theme.palette.common.black,
filter: 'drop-shadow(0 0 7px rgba(0, 0, 0, 0.5))',
'&:hover': {
color: theme.palette.common.black,
'background-color': theme.palette.common.white,
},
})
Comment on lines +31 to +39
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: hmm was there no way to do this in tailwind or CSS modules? a bit iffy on adding a 3rd styling solution in the codebase but not a blocker


const DIVIDER = (
<div className="w-[1px] flex-initial h-full bg-gray-400 drop-shadow-landing-header" />
)

export function IndexHeader() {
const { t } = useI18n()
const data = useTypedLoaderData<LandingPageDataQuery>()

const datasets = data.datasets_aggregate.aggregate?.count
const species = data.species_aggregate.aggregate?.count
const tomograms = data.tomograms_aggregate.aggregate?.count

return (
<div
className={cnsNoMerge(
'bg-img-landing-header',
// layout
'w-full h-[325px]',
'py-sds-xxl px-sds-xl',
'flex flex-col items-center justify-center',
// background'
'bg-gradient-img-to-b bg-auto bg-no-repeat bg-black bg-top',
// values ripped from figma: `background: linear-gradient(180deg, #000000 0%, rgba(0, 0, 0, 0.75) 16.69%, rgba(0, 0, 0, 0.3) 88.71%);`
'from-black',
'via-[rgba(0,0,0,0.75)] via-[16.69%]',
'to-[rgba(0,0,0,0.3)] to-[88.71%]',
)}
>
<div className="flex flex-col items-center gap-sds-m text-white">
<div className="flex flex-col gap-sds-xl items-center">
<h1 className="text-[32px] leading-[34px] font-sds-semibold font-semibold drop-shadow-landing-header">
<I18n i18nKey="landingHeaderTitle" />
</h1>
<div className="flex flex-row justify-center w-full">
<MetricField title={t('datasets')} count={datasets ?? 0} />
{DIVIDER}
<MetricField title={t('species')} count={species ?? 0} />
{DIVIDER}
<MetricField title={t('tomograms')} count={tomograms ?? 0} />
</div>
<Link to="/browse-data/datasets">
<CTAButton sdsType="primary" sdsStyle="rounded">
<I18n i18nKey="browseData" />
</CTAButton>
</Link>
</div>
<Link to={t('apiDocLink')}>
<p className="underline underline-offset-1 decoration-1 text-sds-body-xxs leading-none drop-shadow-landing-header">
<I18n i18nKey="orExploreViaApi" />
</p>
</Link>
</div>
</div>
)
}
2 changes: 2 additions & 0 deletions frontend/packages/data-portal/app/components/Index/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './IndexContent'
export * from './IndexHeader'
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function MdxContent() {

return (
<div className="py-sds-xxl px-sds-xl flex flex-auto justify-center">
<div className="w-full max-w-mdx-content">
<div className="w-full max-w-content-small">
<MDXRemote
{...content}
components={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ export function MetadataTable({
<TableCell {...tableCellProps}>
{match(values.length)
.with(0, () => null)
.with(1, () => datum.renderValue?.(values[0]) ?? values[0])
.with(1, () => (
<span className={datum.className}>
{datum.renderValue?.(values[0]) ?? values[0]}
</span>
))
.otherwise(() => (
<ul className="list-none flex flex-wrap gap-1">
{values.map((value, valueIdx) => (
Expand Down
10 changes: 10 additions & 0 deletions frontend/packages/data-portal/app/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ export const i18n = {
citations: 'Citations',
clearFilters: 'Clear Filters',
confidence: 'confidence',
contributeCta:
'We encourage you to share datasets and/or annotations to existing data. Click below to fill out the inquiry form.',
contributeYourData: 'Contribute your Data',
cookiePolicy: 'Cookie Policy',
ctfCorrected: 'Ctf Corrected',
curatorRecommended: 'Curator Recommended',
Expand Down Expand Up @@ -94,6 +97,7 @@ export const i18n = {
imageCorrector: 'Image Corrector',
includedContents: 'Included Contents',
keyPhoto: 'key photo',
landingHeaderTitle: 'Open access to annotated cryoET tomograms',
lastModified: (date: string) => `Last Modified: ${date}`,
lastModifiedBlank: 'Last Modified',
license: 'License',
Expand All @@ -118,6 +122,7 @@ export const i18n = {
objectName: 'Object Name',
objectShapeType: 'Object Shape Type',
objectState: 'Object State',
orExploreViaApi: 'or explore via API',
organism: 'Organism',
organismName: 'Organism Name',
otherSetup: 'Other Setup',
Expand Down Expand Up @@ -155,8 +160,10 @@ export const i18n = {
showLess: 'Show Less',
size: 'Size',
smallestAvailableVoxelSpacing: 'Smallest Available Voxel Spacing',
species: 'Species',
sphericalAberrationConstant: 'Spherical Aberration Constant',
submitFeedback: 'Submit Feedback',
tellUsMore: 'Tell us More',
terms: 'Terms',
termsOfUse: 'Terms of Use',
tiltAxis: 'Tilt Axis',
Expand Down Expand Up @@ -187,5 +194,8 @@ export const i18n = {
unitVolts: (x: number) => `${x} V`,
valueToValue: (x: string, y: string) => `${x} to ${y}`,
veryPoor: 'Very Poor',
viewAndDownloadDatasets: 'View and Download Datasets',
viewDatasetsCta:
'Find and visualize cryoET datasets in the portal and download to use for your own work.',
yes: 'Yes',
}
Loading