From 5ca707a346b450310da8e68740a84058a59acf78 Mon Sep 17 00:00:00 2001 From: Bryceson Laing Date: Tue, 12 Nov 2024 09:04:24 -0600 Subject: [PATCH] Refactor remaining pages (#416) * refactor remaining pages * fix react-bootstrap imports * Remove variables from content (#417) * remove doi vars * remove organization vars * remove people vars * remove unused vars * remove unnecessary import --- src/app/about/page.tsx | 75 ++++++++++++++++- src/app/doi.org/[...doi]/Content.tsx | 10 +-- .../[...doi]/RelatedAggregateGraph.tsx | 4 +- src/app/doi.org/[...doi]/page.tsx | 14 ++-- src/app/orcid.org/[orcid]/Content.tsx | 8 +- src/app/orcid.org/[orcid]/page.tsx | 10 +-- src/app/ror.org/[rorid]/Content.tsx | 10 +-- src/app/ror.org/[rorid]/page.tsx | 10 +-- src/app/statistics/Content.tsx | 5 +- src/components/About/About.tsx | 82 ------------------- .../CitationFormatter/CitationFormatter.tsx | 3 +- src/components/CiteAs/CiteAs.tsx | 2 +- src/components/Claim/Claim.tsx | 2 +- src/components/ClaimStatus/ClaimStatus.tsx | 5 +- src/components/DataSources/DataSources.tsx | 3 +- src/components/Error/Error.tsx | 2 +- src/components/ExampleText/ExampleText.tsx | 4 +- src/components/FacetList/FacetList.tsx | 6 +- src/components/FacetList/FacetListItem.tsx | 3 +- src/components/FairFilter/FairFilter.tsx | 6 +- src/components/Header/Search.tsx | 3 +- src/components/HelpIcon/HelpIcon.tsx | 3 +- src/components/Loading/Loading.tsx | 2 +- src/components/Pager/Pager.tsx | 2 +- src/components/PersonTable/PersonTable.tsx | 2 +- .../RepositoryDetail/RepositoryDetail.tsx | 3 +- .../RepositoryMetadata/RepositoryMetadata.tsx | 5 +- src/components/SearchBox/SearchBox.tsx | 6 +- .../SearchOrganization/SearchOrganization.tsx | 4 +- src/components/SearchPerson/SearchPerson.tsx | 4 +- .../SearchRepository/SearchRepository.tsx | 5 +- src/components/SearchWork/SearchWork.tsx | 4 +- src/components/Teaser/Teaser.tsx | 4 +- src/components/UsageChart/UsageChart.tsx | 3 +- src/components/WorkFacets/WorkFacets.tsx | 3 +- .../WorksDashboard/WorksDashboard.tsx | 3 +- src/components/WorksListing/WorksListing.tsx | 4 +- src/data/queries/doiQuery.ts | 18 +--- src/data/queries/organizationQuery.ts | 20 +---- src/data/queries/personQuery.ts | 18 +--- src/data/queries/repositoryQuery.ts | 6 +- 41 files changed, 180 insertions(+), 206 deletions(-) delete mode 100644 src/components/About/About.tsx diff --git a/src/app/about/page.tsx b/src/app/about/page.tsx index bcc0ce46..c98c8ecc 100644 --- a/src/app/about/page.tsx +++ b/src/app/about/page.tsx @@ -1,11 +1,80 @@ import React from 'react' -import About from 'src/components/About/About' -import { Container } from 'react-bootstrap' +import Container from 'react-bootstrap/Container' +import Col from 'react-bootstrap/Col' +import Row from 'react-bootstrap/Row' export default function AboutPage() { return ( - + + +
+
+

About

+

+ DataCite Commons is a web search interface for the{' '} + + PID Graph + + , the graph formed by the collection of scholarly resources such + as publications, datasets, people and research organizations, and + their connections. The PID Graph uses persistent identifiers and{' '} + + GraphQL + + , with PIDs and metadata provided by DataCite, Crossref, ORCID, + and others. +

+

+ DataCite Commons was officially launched in October 2020 by the{' '} + + FREYA project + + , funded by the European Union’s Horizon 2020 research and + innovation programme under grant agreement No 777523. +

+

+ DataCite Commons is partially supported by the{' '} + + PARSEC project + {' '} + funded by the Belmont Forum (Collaborative Research Action on + Science-Driven e-Infrastructures Innovation) managed through the + National Science Foundation (Grant ID 1929464). +

+

+ + Provide input to the DataCite Roadmap + {' '} + |{' '} + + Information in DataCite Support + +

+
+
+ +
) } diff --git a/src/app/doi.org/[...doi]/Content.tsx b/src/app/doi.org/[...doi]/Content.tsx index b9e93ce4..f0672d93 100644 --- a/src/app/doi.org/[...doi]/Content.tsx +++ b/src/app/doi.org/[...doi]/Content.tsx @@ -4,7 +4,7 @@ import Row from 'react-bootstrap/Row' import Col from 'react-bootstrap/Col' import { Work as WorkType } from 'src/data/types' -import { fetchDoi, QueryVar } from 'src/data/queries/doiQuery' +import { fetchDoi } from 'src/data/queries/doiQuery' import Error from 'src/components/Error/Error' import TitleComponent from 'src/components/Title/Title' @@ -18,14 +18,14 @@ import { isProject } from 'src/utils/helpers'; import ExportMetadata from 'src/components/DownloadMetadata/ExportMetadata' interface Props { - variables: QueryVar + doi: string isBot?: boolean } export default async function Content(props: Props) { - const { variables, isBot = false } = props + const { doi, isBot = false } = props - const { data, error } = await fetchDoi(variables) + const { data, error } = await fetchDoi(doi) if (error) return ( @@ -73,7 +73,7 @@ export default async function Content(props: Props) { type: 'doi/related-works', } ]} - variables={variables as any} + variables={{ id: doi }} />} diff --git a/src/app/doi.org/[...doi]/RelatedAggregateGraph.tsx b/src/app/doi.org/[...doi]/RelatedAggregateGraph.tsx index 19ddb6f7..a514442b 100644 --- a/src/app/doi.org/[...doi]/RelatedAggregateGraph.tsx +++ b/src/app/doi.org/[...doi]/RelatedAggregateGraph.tsx @@ -1,5 +1,7 @@ import React from 'react' -import { Col, Container, Row } from 'react-bootstrap' +import Container from 'react-bootstrap/Container' +import Row from 'react-bootstrap/Row' +import Col from 'react-bootstrap/Col' import { GraphData, getRelatedWorksGraph } from 'src/data/queries/relatedWorks' import ForceDirectedGraph from 'src/components/ForceDirectedGraph/ForceDirectedGraph' import EmptyChart from 'src/components/EmptyChart/EmptyChart' diff --git a/src/app/doi.org/[...doi]/page.tsx b/src/app/doi.org/[...doi]/page.tsx index a567b4b7..12b85b7d 100644 --- a/src/app/doi.org/[...doi]/page.tsx +++ b/src/app/doi.org/[...doi]/page.tsx @@ -12,14 +12,12 @@ import { fetchDoiMetadata } from 'src/data/queries/doiQuery' import RelatedContent from './RelatedContent' import RelatedAggregateGraph from './RelatedAggregateGraph' import Loading from 'src/components/Loading/Loading' -import mapSearchparams, { SearchParams } from './mapSearchParams' interface Props { params: { doi: string[] - }, - searchParams: SearchParams + } } @@ -83,10 +81,8 @@ export async function generateMetadata({ params }: Props): Promise { } } -export default async function Page({ params, searchParams }: Props) { +export default async function Page({ params }: Props) { const doi = decodeURIComponent(params.doi.join('/')) - const { variables } = mapSearchparams(searchParams) - const vars = { id: doi, ...variables } // Redirect to organization page if DOI is a Crossref Funder ID @@ -94,7 +90,7 @@ export default async function Page({ params, searchParams }: Props) { const { data } = await fetchCrossrefFunder(doi) if (!data) notFound() - redirect(`/ror.org${rorFromUrl(data.organization.id)}?filterQuery=${vars.filterQuery}`) + redirect(`/ror.org${rorFromUrl(data.organization.id)}`) } @@ -106,10 +102,10 @@ export default async function Page({ params, searchParams }: Props) { return <> }> - + - + diff --git a/src/app/orcid.org/[orcid]/Content.tsx b/src/app/orcid.org/[orcid]/Content.tsx index fe52fa07..61959d35 100644 --- a/src/app/orcid.org/[orcid]/Content.tsx +++ b/src/app/orcid.org/[orcid]/Content.tsx @@ -3,7 +3,7 @@ import Container from 'react-bootstrap/Container' import Row from 'react-bootstrap/Row' import Col from 'react-bootstrap/Col' -import { QueryVar, fetchPerson } from 'src/data/queries/personQuery' +import { fetchPerson } from 'src/data/queries/personQuery' import Error from 'src/components/Error/Error' import ShareLinks from 'src/components/ShareLinks/ShareLinks' @@ -11,14 +11,14 @@ import Person from 'src/components/Person/Person' import { orcidFromUrl } from 'src/utils/helpers' interface Props { - variables: QueryVar + orcid: string isBot?: boolean } export default async function Content(props: Props) { - const { variables } = props + const { orcid } = props - const { data, error } = await fetchPerson(variables) + const { data, error } = await fetchPerson(orcid) if (error) return ( diff --git a/src/app/orcid.org/[orcid]/page.tsx b/src/app/orcid.org/[orcid]/page.tsx index 3c55584f..215861d6 100644 --- a/src/app/orcid.org/[orcid]/page.tsx +++ b/src/app/orcid.org/[orcid]/page.tsx @@ -7,14 +7,12 @@ import Content from './Content' import { fetchPersonMetadata } from 'src/data/queries/personQuery' import RelatedContent from './RelatedContent' import Loading from 'src/components/Loading/Loading' -import mapSearchparams, { SearchParams } from './mapSearchParams' interface Props { params: { orcid: string - }, - searchParams: SearchParams + } } @@ -78,10 +76,8 @@ export async function generateMetadata({ params }: Props): Promise { } } -export default async function Page({ params, searchParams }: Props) { +export default async function Page({ params }: Props) { const orcid = 'http://orcid.org/' + params.orcid - const { variables } = mapSearchparams(searchParams) - const vars = { id: orcid, ...variables } // Fetch Person metadata @@ -92,7 +88,7 @@ export default async function Page({ params, searchParams }: Props) { return <> }> - + diff --git a/src/app/ror.org/[rorid]/Content.tsx b/src/app/ror.org/[rorid]/Content.tsx index 9e56e4d0..d9267dac 100644 --- a/src/app/ror.org/[rorid]/Content.tsx +++ b/src/app/ror.org/[rorid]/Content.tsx @@ -4,7 +4,7 @@ import Row from 'react-bootstrap/Row' import Col from 'react-bootstrap/Col' import { Organization as OrganizationType } from 'src/data/types' -import { fetchOrganization, QueryVar } from 'src/data/queries/organizationQuery'; +import { fetchOrganization } from 'src/data/queries/organizationQuery'; import Error from 'src/components/Error/Error' import Title from 'src/components/Title/Title' @@ -14,14 +14,14 @@ import Organization from 'src/components/Organization/Organization' import { rorFromUrl } from 'src/utils/helpers' interface Props { - variables: QueryVar + rorid: string isBot?: boolean } export default async function Content(props: Props) { - const { variables, isBot = false } = props + const { rorid, isBot = false } = props - const { data, error } = await fetchOrganization(variables) + const { data, error } = await fetchOrganization(rorid) if (error) return ( @@ -55,7 +55,7 @@ export default async function Content(props: Props) { type: 'ror/funders', } ]} - variables={variables as any} + variables={{ id: rorid }} />} diff --git a/src/app/ror.org/[rorid]/page.tsx b/src/app/ror.org/[rorid]/page.tsx index 7d8dafbd..07411159 100644 --- a/src/app/ror.org/[rorid]/page.tsx +++ b/src/app/ror.org/[rorid]/page.tsx @@ -5,14 +5,12 @@ import Content from './Content' import RelatedContent from './RelatedContent' import Loading from 'src/components/Loading/Loading' import { fetchOrganizationMetadata } from 'src/data/queries/organizationQuery' -import mapSearchparams, { SearchParams } from './mapSearchParams' interface Props { params: { rorid: string - }, - searchParams: SearchParams + } } @@ -65,10 +63,8 @@ export async function generateMetadata({ params }: Props): Promise { -export default async function Page({ params, searchParams }: Props) { +export default async function Page({ params }: Props) { const { rorid } = params - const { variables } = mapSearchparams(searchParams) - const vars = { id: rorid, ...variables } // Fetch Organization metadata const { data } = await fetchOrganizationMetadata(rorid) @@ -77,7 +73,7 @@ export default async function Page({ params, searchParams }: Props) { return <> }> - + diff --git a/src/app/statistics/Content.tsx b/src/app/statistics/Content.tsx index 1b2109ba..07a11547 100644 --- a/src/app/statistics/Content.tsx +++ b/src/app/statistics/Content.tsx @@ -1,7 +1,10 @@ 'use client' import React from 'react' -import { Alert, Col, Container, Row } from 'react-bootstrap' +import Container from 'react-bootstrap/Container' +import Row from 'react-bootstrap/Row' +import Col from 'react-bootstrap/Col' +import Alert from 'react-bootstrap/Alert' import Loading from 'src/components/Loading/Loading' import { useStatisticsQuery } from 'src/data/queries/statisticsQuery' diff --git a/src/components/About/About.tsx b/src/components/About/About.tsx deleted file mode 100644 index 6d7d78d6..00000000 --- a/src/components/About/About.tsx +++ /dev/null @@ -1,82 +0,0 @@ -import React from 'react' -import { Row, Col } from 'react-bootstrap' - -type Props = { - title: string -} - -const About: React.FunctionComponent = ({ title }) => { - return ( - - -
-
-

{title}

-

- DataCite Commons is a web search interface for the{' '} - - PID Graph - - , the graph formed by the collection of scholarly resources such - as publications, datasets, people and research organizations, and - their connections. The PID Graph uses persistent identifiers and{' '} - - GraphQL - - , with PIDs and metadata provided by DataCite, Crossref, ORCID, - and others. -

-

- DataCite Commons was officially launched in October 2020 by the{' '} - - FREYA project - - , funded by the European Union’s Horizon 2020 research and - innovation programme under grant agreement No 777523. -

-

- DataCite Commons is partially supported by the{' '} - - PARSEC project - {' '} - funded by the Belmont Forum (Collaborative Research Action on - Science-Driven e-Infrastructures Innovation) managed through the - National Science Foundation (Grant ID 1929464). -

-

- - Provide input to the DataCite Roadmap - {' '} - |{' '} - - Information in DataCite Support - -

-
-
- -
- ) -} - -export default About diff --git a/src/components/CitationFormatter/CitationFormatter.tsx b/src/components/CitationFormatter/CitationFormatter.tsx index 832d263c..1eb5fda0 100644 --- a/src/components/CitationFormatter/CitationFormatter.tsx +++ b/src/components/CitationFormatter/CitationFormatter.tsx @@ -1,6 +1,7 @@ import React from 'react' import Error from '../Error/Error' -import { Col, Alert } from 'react-bootstrap' +import Col from 'react-bootstrap/Col' +import Alert from 'react-bootstrap/Alert' import ReactHtmlParser from 'html-react-parser' import { useFormattedCitationQuery } from 'src/data/queries/formattedCitationQuery' diff --git a/src/components/CiteAs/CiteAs.tsx b/src/components/CiteAs/CiteAs.tsx index c6fe4f5c..33de5bae 100644 --- a/src/components/CiteAs/CiteAs.tsx +++ b/src/components/CiteAs/CiteAs.tsx @@ -1,7 +1,7 @@ 'use client' import React from 'react' -import { Col } from 'react-bootstrap' +import Col from 'react-bootstrap/Col' import { Work } from 'src/data/types' import CitationFormatter from 'src/components/CitationFormatter/CitationFormatter' diff --git a/src/components/Claim/Claim.tsx b/src/components/Claim/Claim.tsx index c0d51d6d..3806f48c 100644 --- a/src/components/Claim/Claim.tsx +++ b/src/components/Claim/Claim.tsx @@ -3,7 +3,7 @@ import React from 'react' import { useEffect } from 'react'; import { useMutation, ApolloCache } from '@apollo/client' -import { Button } from 'react-bootstrap' +import Button from 'react-bootstrap/Button' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faOrcid } from '@fortawesome/free-brands-svg-icons' diff --git a/src/components/ClaimStatus/ClaimStatus.tsx b/src/components/ClaimStatus/ClaimStatus.tsx index e30511eb..ac96a108 100644 --- a/src/components/ClaimStatus/ClaimStatus.tsx +++ b/src/components/ClaimStatus/ClaimStatus.tsx @@ -1,5 +1,8 @@ import React from 'react' -import { Button, OverlayTrigger, Tooltip, Badge } from 'react-bootstrap' +import Button from 'react-bootstrap/Button' +import Badge from 'react-bootstrap/Badge' +import OverlayTrigger from 'react-bootstrap/OverlayTrigger' +import Tooltip from 'react-bootstrap/Tooltip' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faOrcid } from '@fortawesome/free-brands-svg-icons' import { Claim } from 'src/data/types' diff --git a/src/components/DataSources/DataSources.tsx b/src/components/DataSources/DataSources.tsx index 322c4f03..d0e21f2e 100644 --- a/src/components/DataSources/DataSources.tsx +++ b/src/components/DataSources/DataSources.tsx @@ -1,5 +1,6 @@ import React from 'react' -import { Row, Col } from 'react-bootstrap' +import Row from 'react-bootstrap/Row' +import Col from 'react-bootstrap/Col' type Props = { dataciteCount: number diff --git a/src/components/Error/Error.tsx b/src/components/Error/Error.tsx index f81eeaf9..2710d721 100644 --- a/src/components/Error/Error.tsx +++ b/src/components/Error/Error.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { Alert } from 'react-bootstrap' +import Alert from 'react-bootstrap/Alert' type Props = { title: string diff --git a/src/components/ExampleText/ExampleText.tsx b/src/components/ExampleText/ExampleText.tsx index 0326a3c8..42fa7cea 100644 --- a/src/components/ExampleText/ExampleText.tsx +++ b/src/components/ExampleText/ExampleText.tsx @@ -1,5 +1,7 @@ import React, { PropsWithChildren } from 'react' -import { Row, Col, Alert } from 'react-bootstrap' +import Row from 'react-bootstrap/Row' +import Col from 'react-bootstrap/Col' +import Alert from 'react-bootstrap/Alert' export default function ExampleText({ children }: PropsWithChildren) { return ( diff --git a/src/components/FacetList/FacetList.tsx b/src/components/FacetList/FacetList.tsx index c5b0c7f1..c71d45a7 100644 --- a/src/components/FacetList/FacetList.tsx +++ b/src/components/FacetList/FacetList.tsx @@ -1,12 +1,14 @@ 'use client' import React from 'react' -import { OverlayTrigger, Tooltip } from 'react-bootstrap' +import Row from 'react-bootstrap/Row' +import Col from 'react-bootstrap/Col' +import OverlayTrigger from 'react-bootstrap/OverlayTrigger' +import Tooltip from 'react-bootstrap/Tooltip' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import FacetListItem from './FacetListItem' import { Facet } from 'src/data/types' import { faQuestionCircle } from '@fortawesome/free-regular-svg-icons' -import { Col, Row } from 'react-bootstrap' interface FacetListProps { diff --git a/src/components/FacetList/FacetListItem.tsx b/src/components/FacetList/FacetListItem.tsx index 25af3893..d5a63e4b 100644 --- a/src/components/FacetList/FacetListItem.tsx +++ b/src/components/FacetList/FacetListItem.tsx @@ -2,6 +2,8 @@ import React from 'react' import Link from 'next/link' +import Row from 'react-bootstrap/Row' +import Col from 'react-bootstrap/Col' import { useSearchParams } from 'next/navigation' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { @@ -9,7 +11,6 @@ import { faCircle, faDotCircle, } from '@fortawesome/free-regular-svg-icons' import { Facet } from 'src/data/types' -import { Col, Row } from 'react-bootstrap' import styles from './FacetListItem.module.scss' interface Props { diff --git a/src/components/FairFilter/FairFilter.tsx b/src/components/FairFilter/FairFilter.tsx index e5e925bf..f1b11686 100644 --- a/src/components/FairFilter/FairFilter.tsx +++ b/src/components/FairFilter/FairFilter.tsx @@ -1,7 +1,10 @@ 'use client' import React from 'react' -import { OverlayTrigger, Tooltip } from 'react-bootstrap' +import Row from 'react-bootstrap/Row' +import Col from 'react-bootstrap/Col' +import OverlayTrigger from 'react-bootstrap/OverlayTrigger' +import Tooltip from 'react-bootstrap/Tooltip' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faSquare, @@ -10,7 +13,6 @@ import { } from '@fortawesome/free-regular-svg-icons' import { useSearchParams } from 'next/navigation' import Link from 'next/link' -import { Col, Row } from 'react-bootstrap' type Props = { url: string diff --git a/src/components/Header/Search.tsx b/src/components/Header/Search.tsx index 9ad9a571..297cacc5 100644 --- a/src/components/Header/Search.tsx +++ b/src/components/Header/Search.tsx @@ -5,7 +5,8 @@ import { useSearchParams, useRouter, usePathname } from 'next/navigation' import { useDebouncedCallback } from 'use-debounce'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faTimes, faSearch } from '@fortawesome/free-solid-svg-icons' -import { InputGroup, Button } from 'react-bootstrap' +import InputGroup from 'react-bootstrap/InputGroup' +import Button from 'react-bootstrap/Button' import styles from './Search.module.css' export default function Search() { diff --git a/src/components/HelpIcon/HelpIcon.tsx b/src/components/HelpIcon/HelpIcon.tsx index 1b097a4d..0cd64fe8 100644 --- a/src/components/HelpIcon/HelpIcon.tsx +++ b/src/components/HelpIcon/HelpIcon.tsx @@ -1,7 +1,8 @@ 'use client' import React, { CSSProperties } from 'react' -import { OverlayTrigger, Tooltip } from 'react-bootstrap' +import OverlayTrigger from 'react-bootstrap/OverlayTrigger' +import Tooltip from 'react-bootstrap/Tooltip' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faQuestionCircle } from '@fortawesome/free-regular-svg-icons' diff --git a/src/components/Loading/Loading.tsx b/src/components/Loading/Loading.tsx index 586f3ed3..3feec8b0 100644 --- a/src/components/Loading/Loading.tsx +++ b/src/components/Loading/Loading.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { Col } from 'react-bootstrap' +import Col from 'react-bootstrap/Col' import ContentLoader from 'react-content-loader' const Loading: React.FunctionComponent = () => ( diff --git a/src/components/Pager/Pager.tsx b/src/components/Pager/Pager.tsx index 4bd39eed..f2aee9d0 100644 --- a/src/components/Pager/Pager.tsx +++ b/src/components/Pager/Pager.tsx @@ -1,7 +1,7 @@ 'use client' import React from 'react' -import { Pagination } from 'react-bootstrap' +import Pagination from 'react-bootstrap/Pagination' import { ReadonlyURLSearchParams, useSearchParams } from 'next/navigation' type Props = { diff --git a/src/components/PersonTable/PersonTable.tsx b/src/components/PersonTable/PersonTable.tsx index a2603a4f..12884520 100644 --- a/src/components/PersonTable/PersonTable.tsx +++ b/src/components/PersonTable/PersonTable.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { Table } from 'react-bootstrap' +import Table from 'react-bootstrap/Table' import startCase from 'lodash/startCase' import { Person } from 'src/components/WorkPerson/WorkPerson' import Link from 'next/link' diff --git a/src/components/RepositoryDetail/RepositoryDetail.tsx b/src/components/RepositoryDetail/RepositoryDetail.tsx index fc7f93ff..af079d76 100644 --- a/src/components/RepositoryDetail/RepositoryDetail.tsx +++ b/src/components/RepositoryDetail/RepositoryDetail.tsx @@ -1,6 +1,7 @@ import React from 'react' import Link from 'next/link' -import { Button, Badge } from 'react-bootstrap'; +import Button from 'react-bootstrap/Button' +import Badge from 'react-bootstrap/Badge' import VerticalBarChart from 'src/components/VerticalBarChart/VerticalBarChart' import ProductionChart from 'src/components/ProductionChart/ProductionChart' import { faNewspaper } from '@fortawesome/free-solid-svg-icons' diff --git a/src/components/RepositoryMetadata/RepositoryMetadata.tsx b/src/components/RepositoryMetadata/RepositoryMetadata.tsx index 3ece37ef..f3faf1db 100644 --- a/src/components/RepositoryMetadata/RepositoryMetadata.tsx +++ b/src/components/RepositoryMetadata/RepositoryMetadata.tsx @@ -1,9 +1,10 @@ import React from 'react' -import { Badge } from 'react-bootstrap' +import Row from 'react-bootstrap/Row' +import Col from 'react-bootstrap/Col' +import Badge from 'react-bootstrap/Badge' import truncate from 'lodash/truncate' import Link from 'next/link' import { Repository } from 'src/data/types' -import { Row, Col } from 'react-bootstrap' type Props = { diff --git a/src/components/SearchBox/SearchBox.tsx b/src/components/SearchBox/SearchBox.tsx index d67ab198..6ccbc43c 100644 --- a/src/components/SearchBox/SearchBox.tsx +++ b/src/components/SearchBox/SearchBox.tsx @@ -1,6 +1,10 @@ import React, { useState } from 'react' import { useRouter, useSearchParams } from 'next/navigation' -import { Col, Row, Button, InputGroup, FormControl } from 'react-bootstrap' +import Row from 'react-bootstrap/Row' +import Col from 'react-bootstrap/Col' +import Button from 'react-bootstrap/Button' +import InputGroup from 'react-bootstrap/InputGroup' +import FormControl from 'react-bootstrap/FormControl' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faTimes, faSearch } from '@fortawesome/free-solid-svg-icons' diff --git a/src/components/SearchOrganization/SearchOrganization.tsx b/src/components/SearchOrganization/SearchOrganization.tsx index c2edc298..35c574c5 100644 --- a/src/components/SearchOrganization/SearchOrganization.tsx +++ b/src/components/SearchOrganization/SearchOrganization.tsx @@ -1,7 +1,9 @@ 'use client' import React from 'react' -import { Row, Col, Alert } from 'react-bootstrap' +import Row from 'react-bootstrap/Row' +import Col from 'react-bootstrap/Col' +import Alert from 'react-bootstrap/Alert' import { pluralize } from '../../utils/helpers' import Pager from 'src/components/Pager/Pager' diff --git a/src/components/SearchPerson/SearchPerson.tsx b/src/components/SearchPerson/SearchPerson.tsx index c2aaf46e..c50a9ddd 100644 --- a/src/components/SearchPerson/SearchPerson.tsx +++ b/src/components/SearchPerson/SearchPerson.tsx @@ -2,7 +2,9 @@ import React from 'react' import Loading from 'src/components/Loading/Loading' -import { Alert, Row, Col } from 'react-bootstrap' +import Row from 'react-bootstrap/Row' +import Col from 'react-bootstrap/Col' +import Alert from 'react-bootstrap/Alert' import Error from 'src/components/Error/Error' import PersonMetadata from 'src/components/PersonMetadata/PersonMetadata' import Pager from 'src/components/Pager/Pager' diff --git a/src/components/SearchRepository/SearchRepository.tsx b/src/components/SearchRepository/SearchRepository.tsx index 4ba922ea..4fc79d57 100644 --- a/src/components/SearchRepository/SearchRepository.tsx +++ b/src/components/SearchRepository/SearchRepository.tsx @@ -1,8 +1,11 @@ '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' import Link from 'next/link' -import { Row, Col, Alert, Container } from 'react-bootstrap' import Pager from 'src/components/Pager/Pager' import FairFilter from 'src/components/FairFilter/FairFilter' diff --git a/src/components/SearchWork/SearchWork.tsx b/src/components/SearchWork/SearchWork.tsx index 52826d11..9d911feb 100644 --- a/src/components/SearchWork/SearchWork.tsx +++ b/src/components/SearchWork/SearchWork.tsx @@ -2,7 +2,9 @@ import React from 'react' import Loading from '../Loading/Loading' -import { Row, Col, Alert } from 'react-bootstrap' +import Row from 'react-bootstrap/Row' +import Col from 'react-bootstrap/Col' +import Alert from 'react-bootstrap/Alert' import Error from 'src/components/Error/Error' import { QueryVar, useSearchDoiQuery } from 'src/data/queries/searchDoiQuery' diff --git a/src/components/Teaser/Teaser.tsx b/src/components/Teaser/Teaser.tsx index 34808c5a..cfca881b 100644 --- a/src/components/Teaser/Teaser.tsx +++ b/src/components/Teaser/Teaser.tsx @@ -1,5 +1,7 @@ import React from 'react' -import { Row, Col, Alert } from 'react-bootstrap' +import Row from 'react-bootstrap/Row' +import Col from 'react-bootstrap/Col' +import Alert from 'react-bootstrap/Alert' type Props = { title: string diff --git a/src/components/UsageChart/UsageChart.tsx b/src/components/UsageChart/UsageChart.tsx index 34973c35..207dc174 100644 --- a/src/components/UsageChart/UsageChart.tsx +++ b/src/components/UsageChart/UsageChart.tsx @@ -3,7 +3,8 @@ import React from 'react' import { VegaLite } from 'react-vega' import { pluralize } from 'src/utils/helpers' -import { Container, Row } from 'react-bootstrap' +import Container from 'react-bootstrap/Container' +import Row from 'react-bootstrap/Row' import { VisualizationSpec } from 'vega-embed' import { subYears, diff --git a/src/components/WorkFacets/WorkFacets.tsx b/src/components/WorkFacets/WorkFacets.tsx index 756c6d94..55629e50 100644 --- a/src/components/WorkFacets/WorkFacets.tsx +++ b/src/components/WorkFacets/WorkFacets.tsx @@ -1,12 +1,13 @@ 'use client' import React from 'react' +import Row from 'react-bootstrap/Row' +import Col from 'react-bootstrap/Col' import { useSearchParams } from 'next/navigation' import SearchBox from '../SearchBox/SearchBox' import AuthorsFacet from '../AuthorsFacet/AuthorsFacet' import { Work, Facet } from 'src/data/types' import FacetList from '../FacetList/FacetList' -import { Col, Row } from 'react-bootstrap' interface Props { data: Facets diff --git a/src/components/WorksDashboard/WorksDashboard.tsx b/src/components/WorksDashboard/WorksDashboard.tsx index 0c461448..8ee46be6 100644 --- a/src/components/WorksDashboard/WorksDashboard.tsx +++ b/src/components/WorksDashboard/WorksDashboard.tsx @@ -1,7 +1,8 @@ 'use client' import React, { PropsWithChildren } from 'react' -import { Row, Col } from 'react-bootstrap' +import Row from 'react-bootstrap/Row' +import Col from 'react-bootstrap/Col' import clone from 'lodash/clone' import { Works } from 'src/data/types' import ProductionChart from '../ProductionChart/ProductionChart' diff --git a/src/components/WorksListing/WorksListing.tsx b/src/components/WorksListing/WorksListing.tsx index ab78cf4f..76732956 100644 --- a/src/components/WorksListing/WorksListing.tsx +++ b/src/components/WorksListing/WorksListing.tsx @@ -1,7 +1,9 @@ 'use client' import React from 'react' -import { Row, Col, Alert } from 'react-bootstrap' +import Row from 'react-bootstrap/Row' +import Col from 'react-bootstrap/Col' +import Alert from 'react-bootstrap/Alert' import WorkFacets from 'src/components/WorkFacets/WorkFacets' import WorkMetadata from 'src/components/WorkMetadata/WorkMetadata' diff --git a/src/data/queries/doiQuery.ts b/src/data/queries/doiQuery.ts index 21f3a961..f72c9cc9 100644 --- a/src/data/queries/doiQuery.ts +++ b/src/data/queries/doiQuery.ts @@ -5,7 +5,7 @@ import { workFragment } from 'src/data/queries/queryFragments' export async function fetchDoiMetadata(id: string) { - const { data } = await apolloClient.query({ + const { data } = await apolloClient.query({ query: DOI_METADATA_QUERY, variables: { id }, errorPolicy: 'all' @@ -14,10 +14,10 @@ export async function fetchDoiMetadata(id: string) { return { data } } -export async function fetchDoi(variables: QueryVar) { +export async function fetchDoi(id: string) { const { data, error } = await apolloClient.query({ query: DOI_QUERY, - variables, + variables: { id }, errorPolicy: 'all' }) @@ -98,10 +98,6 @@ export const DOI_QUERY = gql` ${workFragment} ` -export interface MetadataQueryVar { - id: string -} - export interface MetadataQueryData { work: WorkMetadata } @@ -112,12 +108,4 @@ export interface QueryData { export interface QueryVar { id: string - filterQuery?: string - cursor?: string - published?: string - resourceTypeId?: string - language?: string - license?: string - fieldOfScience?: string - registrationAgency?: string } diff --git a/src/data/queries/organizationQuery.ts b/src/data/queries/organizationQuery.ts index 85517df2..0c86a83d 100644 --- a/src/data/queries/organizationQuery.ts +++ b/src/data/queries/organizationQuery.ts @@ -4,7 +4,7 @@ import apolloClient from 'src/utils/apolloClient/apolloClient' export async function fetchOrganizationMetadata(id: string) { - const { data } = await apolloClient.query({ + const { data } = await apolloClient.query({ query: ORGANIZATION_METADATA_QUERY, variables: { id }, errorPolicy: 'all' @@ -13,10 +13,10 @@ export async function fetchOrganizationMetadata(id: string) { return { data } } -export async function fetchOrganization(variables: QueryVar) { +export async function fetchOrganization(id: string) { const { data, error } = await apolloClient.query({ query: ORGANIZATION_QUERY, - variables, + variables: { id }, errorPolicy: 'all' }) @@ -83,10 +83,6 @@ export const ORGANIZATION_QUERY = gql` } ` -export interface MetadataQueryVar { - id: string -} - export interface MetadataQueryData { organization: OrganizationMetadata } @@ -98,14 +94,4 @@ export interface QueryData { export interface QueryVar { id: string - gridId?: string - crossrefFunderId?: string - filterQuery?: string - cursor?: string - published?: string - resourceTypeId?: string - language?: string - fieldOfScience?: string - license?: string - registrationAgency?: string } diff --git a/src/data/queries/personQuery.ts b/src/data/queries/personQuery.ts index 283bb7fc..52af9cb4 100644 --- a/src/data/queries/personQuery.ts +++ b/src/data/queries/personQuery.ts @@ -4,7 +4,7 @@ import apolloClient from 'src/utils/apolloClient/apolloClient' export async function fetchPersonMetadata(id: string) { - const { data, error } = await apolloClient.query({ + const { data, error } = await apolloClient.query({ query: PERSON_METADATA_QUERY, variables: { id }, errorPolicy: 'all' @@ -13,10 +13,10 @@ export async function fetchPersonMetadata(id: string) { return { data, error } } -export async function fetchPerson(variables: QueryVar) { +export async function fetchPerson(id: string) { const { data, error } = await apolloClient.query({ query: PERSON_QUERY, - variables, + variables: { id }, errorPolicy: 'all' }) @@ -84,10 +84,6 @@ export const PERSON_QUERY = gql` } ` -export interface MetadataQueryVar { - id: string -} - export interface MetadataQueryData { person: PersonMetadata } @@ -99,12 +95,4 @@ export interface QueryData { export interface QueryVar { id: string - filterQuery?: string - cursor?: string - published?: string - resourceTypeId?: string - language?: string - license?: string - fieldOfScience?: string - registrationAgency?: string } diff --git a/src/data/queries/repositoryQuery.ts b/src/data/queries/repositoryQuery.ts index a3251b7a..38d77669 100644 --- a/src/data/queries/repositoryQuery.ts +++ b/src/data/queries/repositoryQuery.ts @@ -4,7 +4,7 @@ import apolloClient from 'src/utils/apolloClient/apolloClient' export async function fetchRepositoryMetadata(id: string) { - const { data, error } = await apolloClient.query({ + const { data, error } = await apolloClient.query({ query: REPOSITORY_METADATA_QUERY, variables: { id }, errorPolicy: 'all' @@ -97,10 +97,6 @@ export const REPOSITORY_QUERY = gql` } ` -export interface MetadataQueryVar { - id: string -} - export interface MetadataQueryData { repository: RepositoryMetadata }