From afca48ea48bd8db0411c4aae1925e18c6fbe69b4 Mon Sep 17 00:00:00 2001 From: Luis Zenteno Date: Thu, 12 Oct 2023 10:54:17 -0600 Subject: [PATCH] feat(notice-board): integate notice board in about and search pages --- pages/about.js | 12 ++++++++++++ pages/search.js | 22 +++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/pages/about.js b/pages/about.js index cb49778fd9..c78a162592 100644 --- a/pages/about.js +++ b/pages/about.js @@ -1,13 +1,18 @@ import PageWrapper from 'wrappers/page'; import About from 'layouts/about'; +import PropTypes from 'prop-types'; + import { getImpactProjects, getSGFProjects } from 'services/projects'; import { getCountriesProvider } from 'services/country'; +import { getPublishedNotifications } from 'services/notifications'; + const AboutPage = (props) => ( @@ -17,14 +22,21 @@ export const getStaticProps = async () => { const { sgfProjects } = await getSGFProjects({ params: { per_page: 100 } }); const impactProjects = await getImpactProjects(); const countries = await getCountriesProvider(); + const notifications = await getPublishedNotifications(); return { props: { impactProjects, sgfProjects, countries: countries?.data?.rows, + notifications: notifications || [], }, + revalidate: 10, }; }; +AboutPage.propTypes = { + notifications: PropTypes.array, +}; + export default AboutPage; diff --git a/pages/search.js b/pages/search.js index 3facbb8f6b..7b04b76d28 100644 --- a/pages/search.js +++ b/pages/search.js @@ -1,14 +1,34 @@ import PageLayout from 'wrappers/page'; import Search from 'layouts/search'; -const SearchPage = () => ( +import PropTypes from 'prop-types'; + +import { getPublishedNotifications } from 'services/notifications'; + +const SearchPage = (props) => ( ); +// eslint-disable-next-line no-unused-vars +export const getServerSideProps = async ({ params, query, req }) => { + const notifications = await getPublishedNotifications(); + + return { + props: { + notifications: notifications || [], + }, + }; +}; + +SearchPage.propTypes = { + notifications: PropTypes.array, +}; + export default SearchPage;