diff --git a/next/components/molecules/ThemeCatalog.js b/next/components/molecules/ThemeCatalog.js index e6e7360b..42165eec 100644 --- a/next/components/molecules/ThemeCatalog.js +++ b/next/components/molecules/ThemeCatalog.js @@ -253,7 +253,7 @@ function CardThemes ({ responsive, datasetsCards = [], loading, locale }) { key={i} name={elm?.name} themes={elm?.themes} - organization={elm?.organizations?.[0]} + organizations={elm?.organizations} tags={elm?.tags} tables={{ id: elm?.first_table_id || elm?.first_closed_table_id, diff --git a/next/components/organisms/DatasetSearchCard.js b/next/components/organisms/DatasetSearchCard.js index ff607747..28d658a8 100644 --- a/next/components/organisms/DatasetSearchCard.js +++ b/next/components/organisms/DatasetSearchCard.js @@ -23,7 +23,7 @@ export default function Dataset({ name, spatialCoverage, temporalCoverageText, - organization, + organizations, tables, rawDataSources, informationRequests, @@ -187,8 +187,10 @@ export default function Dataset({ _hover={{ opacity: 0.9 }} > {organization[`name${capitalize(locale)}`] - {organization[`name${capitalize(locale)}`] || organization?.name} + {organizations[0]?.[`name${capitalize(locale)}`] || organizations[0]?.name} diff --git a/next/components/organisms/DatasetThemeCatalogCard.js b/next/components/organisms/DatasetThemeCatalogCard.js index 672a4579..cd7274b1 100644 --- a/next/components/organisms/DatasetThemeCatalogCard.js +++ b/next/components/organisms/DatasetThemeCatalogCard.js @@ -16,7 +16,7 @@ import { DatasetCardTag } from "../atoms/DatasetCardTag"; export default function DatasetCard({ name, themes = [], - organization, + organizations, tags = [], tables, rawDataSources, @@ -136,7 +136,7 @@ export default function DatasetCard({ {name} - + - {organization[`name${capitalize(locale)}`] || organization.name || organization.slug} + {organizations?.[0]?.[`name${capitalize(locale)}`] || organizations?.[0]?.name || organizations?.[0]?.slug} diff --git a/next/components/organisms/TablePage.js b/next/components/organisms/TablePage.js index 1f8c38be..e3138c67 100644 --- a/next/components/organisms/TablePage.js +++ b/next/components/organisms/TablePage.js @@ -167,38 +167,49 @@ export default function TablePage({ id }) { } const PublishedOrDataCleanedBy = ({ resource }) => { + if (!resource || typeof resource !== 'object' || Object.keys(resource).length === 0) { + return ( + + {t('table.notProvided')} + + ); + } + + const people = Object.values(resource); + return ( - - {resource?.firstName && resource?.lastName ? - - {`${resource.firstName} ${resource.lastName}`} - - : - - {t('table.notProvided')} - - } - {resource?.email && } - {resource?.github && } - {resource?.website && } - {resource?.twitter && } - - ) - } + + {people.map((person, index) => ( + + + {person?.firstName && person?.lastName + ? `${person.firstName} ${person.lastName}` + : t('table.notProvided') + } + + {person?.email && } + {person?.github && } + {person?.website && } + {person?.twitter && } + + ))} + + ); + }; const StackSkeleton = ({ children, ...props }) => { return ( diff --git a/next/pages/api/datasets/getDataset.js b/next/pages/api/datasets/getDataset.js index 03406774..a3dd182c 100644 --- a/next/pages/api/datasets/getDataset.js +++ b/next/pages/api/datasets/getDataset.js @@ -40,13 +40,17 @@ export default async function getDataset(id, locale = 'pt') { } } } - organization { - _id - slug - name - name${capitalize(locale)} - website - picture + organizations { + edges { + node { + _id + slug + name + name${capitalize(locale)} + website + picture + } + } } informationRequests { edges { diff --git a/next/pages/api/tables/getTable.js b/next/pages/api/tables/getTable.js index d58fcad8..daf68df4 100644 --- a/next/pages/api/tables/getTable.js +++ b/next/pages/api/tables/getTable.js @@ -25,14 +25,14 @@ async function getTable(id, locale='pt') { dataset { _id slug - organization { - _id - slug - name - name${capitalize(locale)} - area { - _id - slug + organizations { + edges { + node { + _id + slug + name + name${capitalize(locale)} + } } } } diff --git a/next/pages/dataset/[dataset].js b/next/pages/dataset/[dataset].js index bd4b2100..e5b824db 100644 --- a/next/pages/dataset/[dataset].js +++ b/next/pages/dataset/[dataset].js @@ -155,7 +155,7 @@ export default function DatasetPage ({ dataset, spatialCoverageNames }) { borderRadius="16px" > @@ -262,7 +262,7 @@ export default function DatasetPage ({ dataset, spatialCoverageNames }) { fontSize="14px" lineHeight="20px" > - {dataset.organization?.[`name${capitalize(locale)}`] || dataset.organization?.name || t('noOrganization')} + {dataset.organizations?.edges?.[0]?.node?.[`name${capitalize(locale)}`] || dataset.organizations?.edges?.[0]?.node?.name || t('noOrganization')} diff --git a/next/pages/search.js b/next/pages/search.js index ed55ec5d..9f144759 100644 --- a/next/pages/search.js +++ b/next/pages/search.js @@ -300,7 +300,7 @@ export default function SearchDatasetPage() { spatialCoverage={(data?.spatial_coverage?.map(coverage => coverage.slug) || []) .sort((a, b) => a.localeCompare(b)) .join(', ')} - organization={data.organizations[0]} + organizations={data.organizations} tables={{ id: data?.first_table_id, number: data?.n_tables