diff --git a/apps/charterafrica/src/components/Tool/DescriptionAndShare.js b/apps/charterafrica/src/components/Tool/DescriptionAndShare.js index cd49706b6..a10f5b7b6 100644 --- a/apps/charterafrica/src/components/Tool/DescriptionAndShare.js +++ b/apps/charterafrica/src/components/Tool/DescriptionAndShare.js @@ -8,6 +8,7 @@ import ShareThisPage from "@/charterafrica/components/ShareThisPage"; const DescriptionAndShare = React.forwardRef( function DescriptionAndShare(props, ref) { const { sx, description, lastActive, activeText } = props; + const lastActiveText = lastActive ? `${activeText} ${lastActive}` : null; return ( - {activeText} {lastActive} + {lastActiveText} diff --git a/apps/charterafrica/src/components/Tool/OrgThemeAndOperatingCountries.js b/apps/charterafrica/src/components/Tool/OrgThemeAndOperatingCountries.js index 93734db76..6aa038f1b 100644 --- a/apps/charterafrica/src/components/Tool/OrgThemeAndOperatingCountries.js +++ b/apps/charterafrica/src/components/Tool/OrgThemeAndOperatingCountries.js @@ -8,7 +8,7 @@ const OrgThemeAndOperatingCountries = React.forwardRef( function OrgThemeAndOperatingCountries(props, ref) { const { sx, organisation, theme, operatingCountries } = props; const countries = operatingCountries?.join(", "); - if (!organisation) { + if (!organisation && !theme) { return null; } return ( @@ -25,8 +25,8 @@ const OrgThemeAndOperatingCountries = React.forwardRef( >
- {organisation.name} + {organisation?.name} - + > + + {goToRepo?.label} + + ) : null} - - - {collectionText} - - - {classification} - - + {classification ? ( + + + {collectionText} + + + {classification} + + + ) : null} renders unchanged 1`] = ` />
-
- 0 -
-
+ />
renders unchanged 1`] = ` />
-
- 0 -
-
+ />
renders unchanged 1`] = `
- - 6 Months ago + undefined 6 Months ago
renders unchanged 1`] = ` >
- -
-
(!obj[field] ? field : null)) + .filter(Boolean); + if (emptyFields.length > 0) { + return `The following fields are missing ${emptyFields.join(", ")}`; + } + return null; +} + function getRepoLink(source = "github", slug = "") { if (source === "github" && slug) { return `https://github.com/${slug}`; @@ -70,8 +80,9 @@ export function processTool(item, config, { partnersData }) { } = config; const data = { ...item.fields, id: item.id }; const externalId = getValue(data, toolTableColumns.slug)?.trim(); - if (!externalId?.length) { - const message = `Missing externalId for Tool ${data.id}. Skipping`; + const name = getValue(data, toolTableColumns.name)?.trim(); + if (!name) { + const message = `Missing name for Tool ${data.id}. Skipping`; Sentry.captureMessage(message); return null; } @@ -115,12 +126,28 @@ export function processTool(item, config, { partnersData }) { data, ); const source = getSourceType(getValue(data, toolTableColumns.source.url)); + const avatarUrl = + getValue(data, toolTableColumns.avatarUrl)?.[0]?.url ?? null; + const fieldsToCheck = { + avatarUrl, + name, + description, + operatingCountries, + theme, + }; + const missingFields = checkFields(fieldsToCheck); + if (missingFields) { + const message = `Tool ${name}: ${missingFields}`; + Sentry.captureMessage(message); + return null; + } + return { airtableId: data.id, - avatarUrl: getValue(data, toolTableColumns.avatarUrl)?.[0]?.url ?? null, + avatarUrl, externalId, repoLink: getValue(data, toolTableColumns.source.url), - name: getValue(data, toolTableColumns.name), + name, link: getValue(data, toolTableColumns.url), operatingCountries, contributors: getValue(data, toolTableColumns.contributors), diff --git a/apps/charterafrica/src/lib/ecosystem/github/processData.js b/apps/charterafrica/src/lib/ecosystem/github/processData.js index 000299153..62fb75c3e 100644 --- a/apps/charterafrica/src/lib/ecosystem/github/processData.js +++ b/apps/charterafrica/src/lib/ecosystem/github/processData.js @@ -80,6 +80,9 @@ function fetchUserQuery(username) { } export async function fetchTool({ externalId }) { + if (!externalId) { + return null; + } let [repositoryOwner, repositoryName] = externalId .replace(/^https?:\/\/github\.com\//, "") .replace(/\/$/, "")