diff --git a/src/app/(main)/doi.org/[...doi]/Content.tsx b/src/app/(main)/doi.org/[...doi]/Content.tsx
index fdb4cc2b..83f75a98 100644
--- a/src/app/(main)/doi.org/[...doi]/Content.tsx
+++ b/src/app/(main)/doi.org/[...doi]/Content.tsx
@@ -1,5 +1,4 @@
import React from 'react'
-import Container from 'react-bootstrap/Container'
import Row from 'react-bootstrap/Row'
import Col from 'react-bootstrap/Col'
@@ -11,9 +10,9 @@ import TitleComponent from 'src/components/Title/Title'
import Claim from 'src/components/Claim/Claim'
import CiteAs from 'src/components/CiteAs/CiteAs'
import DownloadMetadata from 'src/components/DownloadMetadata/DownloadMetadata'
-// import DownloadReports from 'src/components/DownloadReports/DownloadReports'
import Work from 'src/components/Work/Work'
import ExportMetadata from 'src/components/DownloadMetadata/ExportMetadata'
+import CommonsLayout from 'src/components/CommonsLayout/CommonsLayout'
interface Props {
doi: string
@@ -24,13 +23,14 @@ export default async function Content(props: Props) {
const { data, error } = await fetchDoi(doi)
- if (error) return (
-
-
-
- )
+ if (error)
+ return (
+
+
+
+ )
- const work = data?.work || {} as WorkType
+ const work = data?.work || ({} as WorkType)
const title = work.titles[0]?.title || ''
const handleUrl =
@@ -39,46 +39,41 @@ export default async function Content(props: Props) {
: 'https://doi.org/' + work.doi
return (
-
-
-
-
-
-
+ <>
+
+
+
-
-
-
-
- } />
-
- {work.registrationAgency.id == "datacite" && (
-
-
+
+
+
+ }
+ />
- )}
-
-
-
-
- {/* */}
- {/* {!isBot && } */}
- {/*
*/}
-
-
-
-
-
-
-
+ {work.registrationAgency.id == 'datacite' && (
+
+
+
+ )}
+
+
+
+
+ >
+ }
+ >
+
+
+ >
)
}
diff --git a/src/app/(main)/doi.org/[...doi]/RelatedContent.tsx b/src/app/(main)/doi.org/[...doi]/RelatedContent.tsx
index 543cdd76..bf40ab65 100644
--- a/src/app/(main)/doi.org/[...doi]/RelatedContent.tsx
+++ b/src/app/(main)/doi.org/[...doi]/RelatedContent.tsx
@@ -3,8 +3,8 @@
import React from 'react'
import { useParams, useSearchParams } from 'next/navigation'
import Container from 'react-bootstrap/Container'
-import Col from 'react-bootstrap/Col'
import Row from 'react-bootstrap/Row'
+import Col from 'react-bootstrap/Col'
import CommonsError from 'src/components/Error/Error'
import Loading from 'src/components/Loading/Loading'
@@ -12,78 +12,91 @@ import WorksListing, { SortBy } from 'src/components/WorksListing/WorksListing'
import SearchBox from 'src/components/SearchBox/SearchBox'
import mapSearchparams from './mapSearchParams'
import { useRelatedContentManager } from 'src/data/managers/RelatedContentManager'
+import CommonsLayout from 'src/components/CommonsLayout/CommonsLayout'
function getQueryVariables(doi: string, searchParams: URLSearchParams) {
- const { variables, connectionType } = mapSearchparams(Object.fromEntries(searchParams.entries()) as any)
+ const { variables, connectionType } = mapSearchparams(
+ Object.fromEntries(searchParams.entries()) as any
+ )
return { relatedDoi: doi, ...variables, connectionType }
}
export default function RelatedContent() {
-
const doiParams = useParams().doi as string[]
const doi = decodeURIComponent(doiParams.join('/'))
const searchParams = useSearchParams()
-
+
const vars = getQueryVariables(doi, searchParams)
const manager = useRelatedContentManager(doi, vars)
- if (manager.isLoading) return
+ if (manager.isLoading)
+ return (
+
+
+
+ )
if (manager.hasError)
- return
-
-
-
-
+ return (
+
+
+
+ )
- if (!manager.hasData || !manager.hasAnyRelatedWorks) return (
-
-
-
- Related Works
-
-
-
-
+ if (!manager.hasData || !manager.hasAnyRelatedWorks)
+ return (
+ <>
+
+
+ Related Works
+
+
+
No related works found for this DOI.
-
-
-
- )
+
+ >
+ )
const { works, title: displayedConnectionTitle } = manager.selectedContent
const { hasPagination, hasNextPage, endCursor } = manager.pagination
const url = '/doi.org/' + doi + '/'
return (
-
-
-
-
-
- Related Works
-
-
-
-
-
- }
- />
-
+
+
+
+
+ Related Works
+
+
+
+
+
+
+
+
+ }
+ />
)
}
diff --git a/src/app/(main)/orcid.org/[orcid]/Content.tsx b/src/app/(main)/orcid.org/[orcid]/Content.tsx
index a011ae9b..64cec2c5 100644
--- a/src/app/(main)/orcid.org/[orcid]/Content.tsx
+++ b/src/app/(main)/orcid.org/[orcid]/Content.tsx
@@ -1,13 +1,11 @@
import React from 'react'
-import Container from 'react-bootstrap/Container'
-import Row from 'react-bootstrap/Row'
-import Col from 'react-bootstrap/Col'
import { Person as PersonType } from 'src/data/types'
import { fetchPerson } from 'src/data/queries/personQuery'
import Error from 'src/components/Error/Error'
import Person from 'src/components/Person/Person'
+import CommonsLayout from 'src/components/CommonsLayout/CommonsLayout'
interface Props {
orcid: string
@@ -19,21 +17,18 @@ export default async function Content(props: Props) {
const { data, error } = await fetchPerson(orcid)
- if (error) return (
-
-
-
- )
+ if (error)
+ return (
+
+
+
+ )
- const person = data?.person || {} as PersonType
+ const person = data?.person || ({} as PersonType)
return (
-
-
-
-
-
-
-
+
+
+
)
}
diff --git a/src/app/(main)/orcid.org/[orcid]/RelatedContent.tsx b/src/app/(main)/orcid.org/[orcid]/RelatedContent.tsx
index dbe96120..3868b04d 100644
--- a/src/app/(main)/orcid.org/[orcid]/RelatedContent.tsx
+++ b/src/app/(main)/orcid.org/[orcid]/RelatedContent.tsx
@@ -11,9 +11,10 @@ import { usePersonRelatedContentQuery } from 'src/data/queries/personRelatedCont
import Error from 'src/components/Error/Error'
import WorksListing, { SortBy } from 'src/components/WorksListing/WorksListing'
import SearchBox from 'src/components/SearchBox/SearchBox'
-import { pluralize } from 'src/utils/helpers';
+import { pluralize } from 'src/utils/helpers'
import { useParams, useSearchParams } from 'next/navigation'
import mapSearchparams from './mapSearchParams'
+import CommonsLayout from 'src/components/CommonsLayout/CommonsLayout'
interface Props {
isBot?: boolean
@@ -24,7 +25,9 @@ export default function RelatedContent(props: Props) {
const orcid = useParams().orcid as string
const searchParams = useSearchParams()
- const { variables } = mapSearchparams(Object.fromEntries(searchParams.entries()) as any)
+ const { variables } = mapSearchparams(
+ Object.fromEntries(searchParams.entries()) as any
+ )
const vars = { userId: orcid, ...variables }
@@ -32,14 +35,22 @@ export default function RelatedContent(props: Props) {
if (isBot) return null
- if (loading) return
+ if (loading)
+ return (
+
+
+
+ )
if (error)
- return
-
-
-
-
+ return (
+
+
+
+ )
if (!data) return
@@ -48,33 +59,37 @@ export default function RelatedContent(props: Props) {
const hasNextPage = relatedWorks.pageInfo
? relatedWorks.pageInfo.hasNextPage
: false
- const endCursor = relatedWorks.pageInfo
- ? relatedWorks.pageInfo.endCursor
- : ''
+ const endCursor = relatedWorks.pageInfo ? relatedWorks.pageInfo.endCursor : ''
const url = '/orcid.org/' + orcid + '/'
- return (
-
-
-
-
+ return (
+
+
- {pluralize(relatedWorks.totalCount, 'Work')}
-
+
+
+ {pluralize(relatedWorks.totalCount, 'Work')}
+
+
+
+
+
-
-
- 25}
- hasNextPage={hasNextPage}
- model={'person'}
- url={url + '?'}
- endCursor={endCursor}
- searchBox={}
- />
- )
+
+ 25}
+ hasNextPage={hasNextPage}
+ model={'person'}
+ url={url + '?'}
+ endCursor={endCursor}
+ searchBox={
+
+ }
+ />
+
+ )
}
diff --git a/src/app/(main)/repositories/[...repoid]/Content.tsx b/src/app/(main)/repositories/[...repoid]/Content.tsx
index 5a4b375d..2c7d8ae2 100644
--- a/src/app/(main)/repositories/[...repoid]/Content.tsx
+++ b/src/app/(main)/repositories/[...repoid]/Content.tsx
@@ -1,14 +1,13 @@
import React from 'react'
-import Row from 'react-bootstrap/Row'
-import Col from 'react-bootstrap/Col'
import { Repository as RepositoryType } from 'src/data/types'
-import { fetchRepository, QueryVar } from 'src/data/queries/repositoryQuery';
+import { fetchRepository, QueryVar } from 'src/data/queries/repositoryQuery'
import Error from 'src/components/Error/Error'
import Title from 'src/components/Title/Title'
import { RepositorySidebar } from 'src/components/RepositoryDetail/RepositorySidebar'
import { RepositoryDetail } from 'src/components/RepositoryDetail/RepositoryDetail'
+import CommonsLayout from 'src/components/CommonsLayout/CommonsLayout'
interface Props {
variables: QueryVar
@@ -20,29 +19,36 @@ export default async function Content(props: Props) {
const { data, error } = await fetchRepository(variables.id)
- if (error) return (
-
-
-
- )
-
- const repository = data?.repository || {} as RepositoryType
-
-
- return <>
-
-
-
-
-
- Repository Sidebar
-
-
-
+ if (error)
+ return (
+
+
+
+ )
+
+ const repository = data?.repository || ({} as RepositoryType)
+
+ return (
+ <>
+
+
+
+ Repository Sidebar
+
+ >
+ }
+ >
Repository Details
-
+
-
-
- >
+
+ >
+ )
}
diff --git a/src/app/(main)/repositories/[...repoid]/RelatedContent.tsx b/src/app/(main)/repositories/[...repoid]/RelatedContent.tsx
index 8728253d..9730afa0 100644
--- a/src/app/(main)/repositories/[...repoid]/RelatedContent.tsx
+++ b/src/app/(main)/repositories/[...repoid]/RelatedContent.tsx
@@ -2,19 +2,20 @@
import React from 'react'
import Container from 'react-bootstrap/Container'
-import Col from 'react-bootstrap/Col'
import Row from 'react-bootstrap/Row'
+import Col from 'react-bootstrap/Col'
import Loading from 'src/components/Loading/Loading'
import { useRepositoryRelatedContentQuery } from 'src/data/queries/repositoryRelatedContentQuery'
import Error from 'src/components/Error/Error'
import WorksListing, { SortBy } from 'src/components/WorksListing/WorksListing'
-import { pluralize } from 'src/utils/helpers';
-import { useSearchParams } from 'next/navigation';
-import mapSearchparams from './mapSearchParams';
+import { pluralize } from 'src/utils/helpers'
+import { useSearchParams } from 'next/navigation'
+import mapSearchparams from './mapSearchParams'
import { Repository } from 'src/data/types'
import SearchBox from 'src/components/SearchBox/SearchBox'
+import CommonsLayout from 'src/components/CommonsLayout/CommonsLayout'
interface Props {
repository: Repository
@@ -24,47 +25,56 @@ export default function RelatedContent({ repository }: Props) {
const clientId = repository.clientId
const searchParams = useSearchParams()
- const { variables } = mapSearchparams(Object.fromEntries(searchParams.entries()) as any)
+ const { variables } = mapSearchparams(
+ Object.fromEntries(searchParams.entries()) as any
+ )
const vars = { clientId, ...variables }
- const { loading, data, error, facetsLoading } = useRepositoryRelatedContentQuery(vars)
+ const { loading, data, error, facetsLoading } =
+ useRepositoryRelatedContentQuery(vars)
- if (loading) return
+ if (loading)
+ return (
+
+
+
+ )
if (error)
- return
-
-
-
-
+ return (
+
+
+
+ )
if (!data) return
const relatedWorks = data.works
const hasNextPage = relatedWorks.totalCount > 25
- const endCursor = relatedWorks.pageInfo
- ? relatedWorks.pageInfo.endCursor
- : ''
+ const endCursor = relatedWorks.pageInfo ? relatedWorks.pageInfo.endCursor : ''
const totalCount = relatedWorks.totalCount
const url = '/repositories/' + clientId + '/'
return (
-
-
-
-
-
-
- Related Works Results Summary
- {pluralize(totalCount, 'Work')}
-
-
-
-
-
+
+
+
+ Related Works Results Summary
+
+ {pluralize(totalCount, 'Work')}
+
+
+
+
+
+
+
}
+ searchBox={
+
+ }
/>
)
diff --git a/src/app/(main)/ror.org/[rorid]/Content.tsx b/src/app/(main)/ror.org/[rorid]/Content.tsx
index 03e1c084..7881a17a 100644
--- a/src/app/(main)/ror.org/[rorid]/Content.tsx
+++ b/src/app/(main)/ror.org/[rorid]/Content.tsx
@@ -1,11 +1,8 @@
'use client'
import React from 'react'
-import Container from 'react-bootstrap/Container'
-import Row from 'react-bootstrap/Row'
-import Col from 'react-bootstrap/Col'
import type { MinimalOrganization as OrganizationType } from 'src/data/queries/searchOrganizationQuery'
-import { useROROrganization } from 'src/data/queries/searchOrganizationQuery';
+import { useROROrganization } from 'src/data/queries/searchOrganizationQuery'
import Error from 'src/components/Error/Error'
import Title from 'src/components/Title/Title'
@@ -13,6 +10,7 @@ import DownloadReports from 'src/components/DownloadReports/DownloadReports'
import OrganizationMetadata from 'src/components/OrganizationMetadata/OrganizationMetadata'
import SummarySearchMetrics from 'src/components/SummarySearchMetrics/SummarySearchMetrics'
import Loading from 'src/components/Loading/Loading'
+import CommonsLayout from 'src/components/CommonsLayout/CommonsLayout'
interface Props {
rorid: string
@@ -22,52 +20,58 @@ export default function Content(props: Props) {
const { rorid: rorId } = props
const { data, error, loading } = useROROrganization(rorId)
if (loading) return
- const organization = data?.organization || {} as OrganizationType
+ const organization = data?.organization || ({} as OrganizationType)
- if (error || !organization) return (
-
-
-
- )
+ if (error || !organization)
+ return (
+
+
+
+ )
return (
<>
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
- {organization.inceptionYear && (
- Founded {organization.inceptionYear}
- )}
-
-
-
-
+
+ }
+ >
+
+ {organization.inceptionYear && (
+ Founded {organization.inceptionYear}
+ )}
+
+
>
)
}
diff --git a/src/app/(main)/ror.org/[rorid]/RelatedContent.tsx b/src/app/(main)/ror.org/[rorid]/RelatedContent.tsx
index d2e7b2d8..5a0a0ed8 100644
--- a/src/app/(main)/ror.org/[rorid]/RelatedContent.tsx
+++ b/src/app/(main)/ror.org/[rorid]/RelatedContent.tsx
@@ -2,8 +2,8 @@
import React from 'react'
import Container from 'react-bootstrap/Container'
-import Col from 'react-bootstrap/Col'
import Row from 'react-bootstrap/Row'
+import Col from 'react-bootstrap/Col'
import Loading from 'src/components/Loading/Loading'
import CommonsError from 'src/components/Error/Error'
import WorksListing, { SortBy } from 'src/components/WorksListing/WorksListing'
@@ -12,40 +12,47 @@ import mapSearchparams from './mapSearchParams'
import { useOrganizationRelatedContentManager } from 'src/data/managers/OrganizationRelatedContentManager'
import SummarySearchMetrics from 'src/components/SummarySearchMetrics/SummarySearchMetrics'
import SearchBox from 'src/components/SearchBox/SearchBox'
+import CommonsLayout from 'src/components/CommonsLayout/CommonsLayout'
export default function RelatedContent() {
const rorId = useParams().rorid as string
const searchParams = useSearchParams()
- const { variables } = mapSearchparams(Object.fromEntries(searchParams.entries()) as any)
+ const { variables } = mapSearchparams(
+ Object.fromEntries(searchParams.entries()) as any
+ )
const vars = { rorId, ...variables }
const manager = useOrganizationRelatedContentManager(vars)
- if (manager.isLoading) return
-
- if (manager.hasError)
+ if (manager.isLoading)
return (
-
-
-
+
)
+ if (manager.hasError)
+ return (
+
+
+
+ )
+
if (!manager.hasData || !manager.hasAnyRelatedWorks)
return (
-
-
-
- Related Works
-
-
-
-
- No related works found for this organization.
-
-
-
+ <>
+
+
+ Related Works
+
+
+
+ No related works found for this organization.
+
+ >
)
const { works } = manager.selectedContent
@@ -53,35 +60,39 @@ export default function RelatedContent() {
const url = '/ror.org/' + vars.rorId + '/'
return (
-
-
-
-
- Related Works
-
-
-
-
-
- }
- >
-
-
-
-
-
+
+
+
+
+ Related Works
+
+
+
+
+
+
+
+ }
+ >
+
+
+
+
)
}
diff --git a/src/components/CommonsLayout/CommonsLayout.test.tsx b/src/components/CommonsLayout/CommonsLayout.test.tsx
new file mode 100644
index 00000000..0047fb17
--- /dev/null
+++ b/src/components/CommonsLayout/CommonsLayout.test.tsx
@@ -0,0 +1,50 @@
+import React from 'react'
+import { mount } from '@cypress/react'
+import CommonsLayout from './CommonsLayout'
+
+describe('CommonsLayout Component', () => {
+ it('sidebar mode renders a 3/9 column split in a fluid container', () => {
+ mount(
+
+ )
+ cy.get('.container-fluid > .row > .col-md-3')
+ .should('contain', 'Sidebar')
+ .and('have.class', 'd-none')
+ .and('have.class', 'd-md-block')
+ .and('have.class', 'pe-4')
+ cy.get('.col-md-9').should('contain', 'Main').and('not.have.class', 'pe-4')
+ })
+
+ it('main-only mode renders a single offset column', () => {
+ mount(
+
+ Main
+
+ )
+ cy.get('.container-fluid > .row > .col-md-9.offset-md-3')
+ .find('span#main')
+ .should('contain', 'Main')
+ .and('have.attr', 'id', 'main')
+ cy.get('.col-md-3').should('not.exist')
+ })
+
+ it('applies column class overrides and can omit the container', () => {
+ mount(
+ Sidebar}
+ sidebarClassName="px-4"
+ mainClassName="px-0"
+ >
+ Main
+
+ )
+ cy.get('.container-fluid').should('not.exist')
+ cy.get('[data-cy-root] .row > .col-md-3')
+ .should('have.class', 'px-4')
+ .and('not.have.class', 'pe-4')
+ cy.get('.col-md-9').should('have.class', 'px-0')
+ })
+})
diff --git a/src/components/CommonsLayout/CommonsLayout.tsx b/src/components/CommonsLayout/CommonsLayout.tsx
new file mode 100644
index 00000000..65276e36
--- /dev/null
+++ b/src/components/CommonsLayout/CommonsLayout.tsx
@@ -0,0 +1,48 @@
+import React from 'react'
+import Container from 'react-bootstrap/Container'
+import Row from 'react-bootstrap/Row'
+import Col from 'react-bootstrap/Col'
+
+interface Props {
+ /** Optional sidebar content. When omitted, children are rendered full-width, offset to the main column. */
+ sidebar?: React.ReactNode
+ /** Main content */
+ children?: React.ReactNode
+ /** Classes for the sidebar column. Override e.g. for 'pe-5' or 'px-4'. */
+ sidebarClassName?: string
+ /** Classes for the main column, e.g. 'px-0'. */
+ mainClassName?: string
+ /** Wrap the grid in a Bootstrap fluid container. */
+ fluid?: boolean
+ /** Optional class applied to the Row wrapper. */
+ className?: string
+}
+
+export default function CommonsLayout({
+ sidebar,
+ children,
+ sidebarClassName = 'd-none d-md-block pe-4',
+ mainClassName,
+ fluid = true,
+ className
+}: Props) {
+ const columns =
+ sidebar === undefined ? (
+
+ {children}
+
+ ) : (
+ <>
+
+ {sidebar}
+
+
+ {children}
+
+ >
+ )
+
+ const row = {columns}
+
+ return fluid ? {row} : row
+}
diff --git a/src/components/SearchOrganization/SearchOrganization.tsx b/src/components/SearchOrganization/SearchOrganization.tsx
index 43b8edbf..710206bd 100644
--- a/src/components/SearchOrganization/SearchOrganization.tsx
+++ b/src/components/SearchOrganization/SearchOrganization.tsx
@@ -13,6 +13,7 @@ import Loading from 'src/components/Loading/Loading'
import { QueryVar, useRORSearch } from 'src/data/queries/searchOrganizationQuery'
import FacetList from 'src/components/FacetList/FacetList'
import FacetListGroup from 'src/components/FacetList/FacetListGroup'
+import CommonsLayout from 'src/components/CommonsLayout/CommonsLayout'
type Props = {
variables: QueryVar
@@ -25,11 +26,9 @@ export default function SearchOrganizations(props: Props) {
const organizations = data?.organizations
if (error || !organizations || organizations.nodes.length == 0) return (
-
-
-
-
-
+
+
+
)
const renderResults = () => {
@@ -88,24 +87,24 @@ export default function SearchOrganizations(props: Props) {
}
return (<>
-
+
Organization Results Summary
-
- {organizations.totalCount > 0 && (
- {pluralize(organizations.totalCount || 0, 'Organization')}
- )}
-
-
-
-
- Organization Sidebar
- Organization Facets
- {renderFacets()}
-
-
- Organization Listings
- {renderResults()}
-
-
+ {organizations.totalCount > 0 && (
+ {pluralize(organizations.totalCount || 0, 'Organization')}
+ )}
+
+
+ Organization Sidebar
+ Organization Facets
+ {renderFacets()}
+ >
+ }
+ >
+ Organization Listings
+ {renderResults()}
+
>)
}
diff --git a/src/components/SearchPerson/SearchPerson.tsx b/src/components/SearchPerson/SearchPerson.tsx
index 9e5e7e22..1437f2f2 100644
--- a/src/components/SearchPerson/SearchPerson.tsx
+++ b/src/components/SearchPerson/SearchPerson.tsx
@@ -3,7 +3,6 @@
import React from 'react'
import Loading from 'src/components/Loading/Loading'
import Row from 'react-bootstrap/Row'
-import Col from 'react-bootstrap/Col'
import PersonMetadata from 'src/components/PersonMetadata/PersonMetadata'
import Pager from 'src/components/Pager/Pager'
import NoResults from 'src/components/NoResults/NoResults'
@@ -11,6 +10,7 @@ import NoResults from 'src/components/NoResults/NoResults'
import { QueryVar, useSearchPersonQuery } from 'src/data/queries/searchPersonQuery'
import { pluralize } from 'src/utils/helpers'
+import CommonsLayout from 'src/components/CommonsLayout/CommonsLayout'
interface Props {
variables: QueryVar
@@ -23,32 +23,30 @@ export default function SearchPerson(props: Props) {
const people = data?.people
if (error || !people || people.nodes.length == 0) return (
-
-
-
-
-
+
+
+
)
return (<>
People Results
-
+
{people.nodes.length > 0 && (
{pluralize(people.totalCount, 'Person', false, 'People')}
)}
-
+
-
+
{people.nodes.map((item) => (
))}
-
+
-
+
{(people.totalCount || 0) > 25 && (
)}
-
+
>)
}
diff --git a/src/components/SearchRepository/SearchRepository.tsx b/src/components/SearchRepository/SearchRepository.tsx
index 48a0aa5e..be040ed7 100644
--- a/src/components/SearchRepository/SearchRepository.tsx
+++ b/src/components/SearchRepository/SearchRepository.tsx
@@ -1,7 +1,6 @@
'use client'
import React from 'react'
-import Container from 'react-bootstrap/Container'
import Row from 'react-bootstrap/Row'
import Col from 'react-bootstrap/Col'
import Alert from 'react-bootstrap/Alert'
@@ -16,6 +15,7 @@ import RepositoryMetadata from 'src/components/RepositoryMetadata/RepositoryMeta
import { QueryVar, useSearchRepositoryQuery } from 'src/data/queries/searchRepositoryQuery'
import { pluralize } from 'src/utils/helpers'
+import CommonsLayout from 'src/components/CommonsLayout/CommonsLayout'
type Props = {
@@ -32,22 +32,22 @@ export default function SearchRepositories({ variables }: Props) {
const repositories = data?.repositories
if (error || !repositories || repositories.nodes.length === 0) return (
-
+
No repositories found. Try a new search or explore generalist repositories such as:
-
- - Dryad
- - Figshare
- - Harvard Dataverse
- - Mendeley Data
- - Open Science Framework
- - Zenodo
-
+
+ - Dryad
+ - Figshare
+ - Harvard Dataverse
+ - Mendeley Data
+ - Open Science Framework
+ - Zenodo
+
-
+
)
@@ -103,25 +103,25 @@ export default function SearchRepositories({ variables }: Props) {
>)
}
- return (
-
+ return (<>
+
Repositories Results Summary
-
- {repositories.totalCount > 0 && (
- {pluralize(repositories.totalCount || 0, 'Repository', false, 'Repositories')}
- )}
-
-
-
-
- Repositories Sidebar
- Repositories Facets
- {renderFacets()}
-
-
- Repositories Listings
- {renderResults()}
-
-
- )
+ {repositories.totalCount > 0 && (
+ {pluralize(repositories.totalCount || 0, 'Repository', false, 'Repositories')}
+ )}
+
+
+ Repositories Sidebar
+ Repositories Facets
+ {renderFacets()}
+ >
+ }
+ >
+ Repositories Listings
+ {renderResults()}
+
+ >)
}
diff --git a/src/components/SearchWork/SearchWork.tsx b/src/components/SearchWork/SearchWork.tsx
index 78b290cb..797da20c 100644
--- a/src/components/SearchWork/SearchWork.tsx
+++ b/src/components/SearchWork/SearchWork.tsx
@@ -12,6 +12,7 @@ import { useSearchDoiFacetsQuery } from 'src/data/queries/searchDoiFacetsQuery'
import NoResults from 'src/components/NoResults/NoResults'
import WorksListing, { SortBy } from 'src/components/WorksListing/WorksListing'
import { pluralize } from 'src/utils/helpers'
+import CommonsLayout from 'src/components/CommonsLayout/CommonsLayout'
interface Props {
variables: QueryVar
@@ -24,29 +25,23 @@ export default function SearchWork(props: Props) {
if (loading) return
if (error) return (
-
-
-
-
-
+
+
+
)
const works = { ...data?.works, ...facets.data?.works } as Works
return (<>
-
+
Works Results
-
-
-
- {works.totalCount > 0 && (
-
- {pluralize(works.totalCount, 'Work')}
-
-
- )}
-
-
+ {works.totalCount > 0 && (
+
+ {pluralize(works.totalCount, 'Work')}
+
+
+ )}
+
+ : renderFacets()
+
return (
-
-
- {(loadingFacets || organizationRelationCountsLoading) ?
: renderFacets()}
-
-
- Works Search Listing
- {children}
- {loading ? : renderWorks()}
-
-
+
+ Works Search Listing
+ {children}
+ {loading ? : renderWorks()}
+
)
}