Files
developer-roadmap/pages/[roadmap]/index.js

41 lines
1.2 KiB
JavaScript
Raw Normal View History

2019-11-01 02:27:06 +04:00
import Error from 'next/error';
import DefaultLayout from 'layouts/default';
2019-11-08 10:22:30 +04:00
import SiteNav from 'components/site-nav';
import PageFooter from 'components/page-footer';
import { serverOnlyProps } from 'lib/server';
import { getRequestedRoadmap } from 'lib/roadmap';
2020-01-18 22:47:48 +04:00
import siteConfig from 'content/site';
2019-11-09 14:56:56 +04:00
import Helmet from 'components/helmet';
import RoadmapSummary from 'components/roadmap-summary';
2019-12-01 15:01:22 +04:00
import DetailedRoadmap from 'components/detailed-roadmap';
2019-11-09 15:40:32 +04:00
2020-01-17 19:18:47 +04:00
const Roadmap = ({ roadmap, canonical }) => {
2019-11-01 02:27:06 +04:00
if (!roadmap) {
return <Error statusCode={ 404 } />
}
const showSummary = roadmap.upcoming || !roadmap.detailed;
2019-10-31 23:45:09 +04:00
return (
<DefaultLayout>
2020-01-17 19:18:47 +04:00
<Helmet
canonical={canonical}
2020-01-29 10:42:52 +05:00
title={ roadmap?.seo?.title || roadmap.title }
description={ roadmap?.seo?.description || roadmap.description }
keywords={ roadmap?.keywords || [] }
2020-01-17 19:18:47 +04:00
/>
2019-11-08 10:22:30 +04:00
<SiteNav />
2019-11-30 14:33:22 +04:00
{ showSummary ? <RoadmapSummary roadmap={roadmap} /> : <DetailedRoadmap roadmap={roadmap} /> }
2019-10-31 23:45:09 +04:00
<PageFooter />
</DefaultLayout>
);
};
Roadmap.getInitialProps = serverOnlyProps(({ req }) => {
return {
2020-01-17 19:18:47 +04:00
canonical: `${siteConfig.url.web}${req.url}`,
2019-10-31 23:45:09 +04:00
roadmap: getRequestedRoadmap(req),
};
});
export default Roadmap;