Skip to content

Commit

Permalink
feat(notice-board): integate notice board in about and search pages
Browse files Browse the repository at this point in the history
  • Loading branch information
wri7tno committed Oct 12, 2023
1 parent e89a8c4 commit afca48e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
12 changes: 12 additions & 0 deletions pages/about.js
Original file line number Diff line number Diff line change
@@ -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) => (
<PageWrapper
title="About GFW | Global Forest Watch"
description="Global Forest Watch is an online platform that provides data and tools for monitoring forests."
notifications={props.notifications}
>
<About {...props} />
</PageWrapper>
Expand All @@ -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;
22 changes: 21 additions & 1 deletion pages/search.js
Original file line number Diff line number Diff line change
@@ -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) => (
<PageLayout
title="Search | Global Forest Watch"
description="Search forest information, including forest data, news, updates and more."
notifications={props.notifications}
noIndex
>
<Search />
</PageLayout>
);

// 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;

0 comments on commit afca48e

Please sign in to comment.