diff --git a/src/app/comparison-portal/layout.tsx b/src/app/comparison-portal/layout.tsx index 24d9aa18..9f3806af 100644 --- a/src/app/comparison-portal/layout.tsx +++ b/src/app/comparison-portal/layout.tsx @@ -10,12 +10,12 @@ export const metadata: Metadata = { template: `%s - ${siteConfig.name}`, }, description: - 'Compare real-time global hunger data across different countries and regions. Obtain food insecurity statistics from the WFP Hunger Map Comparison Portal, tailored to various time zones. A valuable resource for humanitarian efforts and research.', + 'Compare real-time global hunger data across different countries and regions. A valuable resource for humanitarian efforts and research.', keywords: siteConfig.keywords, openGraph: { title: `Comparison Portal - ${siteConfig.name}`, description: - 'Compare real-time global hunger data across different countries and regions. Obtain food insecurity statistics from the WFP Hunger Map Comparison Portal, tailored to various time zones. Essential for humanitarian aid and research.', + 'Compare real-time global hunger data across different countries and regions. Essential for humanitarian aid and research.', url: `${siteConfig.domain}/comparison-portal`, images: [ { @@ -31,7 +31,7 @@ export const metadata: Metadata = { card: 'summary_large_image', title: `Comparison Portal - ${siteConfig.name}`, description: - 'Access comparable global hunger data from the WFP Hunger Map Comparison Portal, tailored to different countries and time zones.', + 'Access comparable global hunger data from the WFP Hunger Map Comparison Portal, tailored to different countries and regions.', images: [ { url: '/Images/Comparison-preview.png', diff --git a/src/app/comparison-portal/loading.tsx b/src/app/comparison-portal/loading.tsx new file mode 100644 index 00000000..0afb1abf --- /dev/null +++ b/src/app/comparison-portal/loading.tsx @@ -0,0 +1,12 @@ +import ComparisonAccordionSkeleton from '@/components/ComparisonPortal/ComparisonAccordionSkeleton'; +import SelectionSkeleton from '@/components/ComparisonPortal/CountrySelectSkeleton'; + +export default function Loading() { + return ( + <> +

Comparison Portal

+ + + + ); +} diff --git a/src/app/comparison-portal/page.tsx b/src/app/comparison-portal/page.tsx index 00d5e41b..261df506 100644 --- a/src/app/comparison-portal/page.tsx +++ b/src/app/comparison-portal/page.tsx @@ -1,28 +1,15 @@ -import { Suspense } from 'react'; - -import ComparisonAccordionSkeleton from '@/components/ComparisonPortal/ComparisonAccordionSkeleton'; -import CountryComparison from '@/components/ComparisonPortal/CountryComparison'; -import CountrySelectionSkeleton from '@/components/ComparisonPortal/CountrySelectSkeleton'; +import ComparisonPortal from '@/components/ComparisonPortal/CountryComparison'; import container from '@/container'; import { GlobalDataRepository } from '@/domain/repositories/GlobalDataRepository'; -export default async function ComparisonPortal() { +export default async function Page() { const globalRepo = container.resolve('GlobalDataRepository'); const countryMapData = await globalRepo.getMapDataForCountries(); const globalFcsData = await globalRepo.getFcsData(); return ( -
+ <>

Comparison Portal

- - - - - } - > - - -
+ + ); } diff --git a/src/components/ComparisonPortal/ComparisonAccordionSkeleton.tsx b/src/components/ComparisonPortal/ComparisonAccordionSkeleton.tsx index 4bf61259..31e758fb 100644 --- a/src/components/ComparisonPortal/ComparisonAccordionSkeleton.tsx +++ b/src/components/ComparisonPortal/ComparisonAccordionSkeleton.tsx @@ -4,14 +4,13 @@ import { v4 as uuid } from 'uuid'; /** * A skeleton component for the ComparisonAccordion component. - * @returns {JSX.Element} The ComparisonAccordionSkeleton component + * @param {number} nItems Number of accordion items for the skeleton. */ -export default function ComparisonAccordionSkeleton(): JSX.Element { - const N_ITEMS = 5; +export default function ComparisonAccordionSkeleton({ nItems }: { nItems: number }): JSX.Element { return (
- {[...Array(N_ITEMS)].map(() => ( + {[...Array(nItems)].map(() => (
([]); + const [selectedTab, setSelectedTab] = useSelectedTab(); + const { selectedRegions, setSelectedRegions, selectedRegionComparisonCountry, setSelectedRegionComparisonCountry } = + useSelectedRegions(); return ( -
- - +
+ setSelectedTab(key as string)} + size="md" + variant="underlined" + classNames={{ + base: 'justify-center px-1', + cursor: 'w-full', + }} + fullWidth + > + + + + + + + + +
); } diff --git a/src/components/ComparisonPortal/CountryComparisonAccordion.tsx b/src/components/ComparisonPortal/CountryComparisonAccordion.tsx index 39614045..368e6ecc 100644 --- a/src/components/ComparisonPortal/CountryComparisonAccordion.tsx +++ b/src/components/ComparisonPortal/CountryComparisonAccordion.tsx @@ -1,5 +1,3 @@ -'use client'; - import { useMemo } from 'react'; import ComparisonAccordionSkeleton from '@/components/ComparisonPortal/ComparisonAccordionSkeleton'; @@ -68,7 +66,7 @@ export default function CountryComparisonAccordion({ return CountryComparisonOperations.getComparisonAccordionItems(chartData, selectedCountryNames, isLoading); }, [countryDataList, countryIso3DataList, selectedCountries]); - if (!accordionItems || (countryDataList.length < 2 && isLoading)) return ; + if (!accordionItems || (countryDataList.length < 2 && isLoading)) return ; if (countryDataList.length < 2) { return ( diff --git a/src/components/ComparisonPortal/CountrySelectSkeleton.tsx b/src/components/ComparisonPortal/CountrySelectSkeleton.tsx index 2bae650c..22ad2943 100644 --- a/src/components/ComparisonPortal/CountrySelectSkeleton.tsx +++ b/src/components/ComparisonPortal/CountrySelectSkeleton.tsx @@ -2,12 +2,12 @@ import { Skeleton } from '@nextui-org/skeleton'; import React from 'react'; /** - * A skeleton component for the CountrySelection component. - * @returns {JSX.Element} The CountrySelectionSkeleton component + * A skeleton for the Select component. + * @returns {JSX.Element} */ -export default function CountrySelectionSkeleton(): JSX.Element { +export default function SelectionSkeleton(): JSX.Element { return ( -
+