Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/docConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,10 @@ function filterByCategoryAndSoftware(category, software) {
return docs.filter((doc) => doc.category === category && doc.software === software);
}

function hasActiveDocs(category, software) {
return docs.some((doc) => doc.category === category && doc.software === software && doc.active === true);
}

function getInactiveDocLocations() {
return docs.filter((doc) => doc.active === false && doc.doc_location).map((doc) => doc.doc_location);
}
Expand All @@ -483,6 +487,7 @@ function shouldExcludeFromBuild(docsRelativePath) {
module.exports = {
docs,
filterByCategoryAndSoftware,
hasActiveDocs,
getInactiveDocLocations,
getDraftDocLocations,
shouldExcludeFromBuild,
Expand Down
9 changes: 5 additions & 4 deletions src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import SystemResponseIcon from '../components/icons/SystemResponseIcon';
import ToolboxIcon from '../components/icons/ToolboxIcon';
import WebAppIcon from '../components/icons/WebAppIcon';
import TourButton from '../components/TourButton';
import { hasActiveDocs } from '../docConfig';
import '../css/custom.css';

export default function Home() {
Expand Down Expand Up @@ -123,28 +124,28 @@ export default function Home() {
title: 'Rainfall Runoff Frequency Tool',
description: 'Rapid risk framework',
href: addBaseUrl('web-applications/rrft'),
active: false,
active: hasActiveDocs('web-applications', 'rrft'),
},
{
IconComponent: LSTIcon,
title: 'Levee Screening Tool',
description: 'Levee risk screening and assessment',
href: addBaseUrl('web-applications/lst'),
active: false,
active: hasActiveDocs('web-applications', 'lst'),
},
{
IconComponent: DSTIcon,
title: 'Dam Screening Tool',
description: 'Dam risk screening',
href: addBaseUrl('web-applications/dst'),
active: false,
active: hasActiveDocs('web-applications', 'dst'),
},
{
IconComponent: SystemResponseIcon,
title: 'System Response Library',
description: 'System response models for screening',
href: addBaseUrl('web-applications/system-response'),
active: false,
active: hasActiveDocs('web-applications', 'system-response'),
},
],
},
Expand Down
22 changes: 14 additions & 8 deletions src/theme/Layout/buildNavLinks.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { hasActiveDocs } from '../../docConfig';

/**
* Build the nested "links" structure for <SiteWrapper>.
* Pass in useBaseUrl (hook result) and the latestVersions object.
Expand Down Expand Up @@ -328,18 +330,21 @@ export default function buildNavLinks(useBaseUrl, latestVersions = {}) {
children: [
{
id: 'dst',
text: 'Dam Screening Tool (Coming Soon)',
/*href: dstHref,*/
...(hasActiveDocs('web-applications', 'dst')
? { text: 'Dam Screening Tool', href: dstHref }
: { text: 'Dam Screening Tool (Coming Soon)' }),
},
{
id: 'system-response',
text: 'System Response Library (Coming Soon)',
/*href: systemResponseHref,*/
...(hasActiveDocs('web-applications', 'system-response')
? { text: 'System Response Library', href: systemResponseHref }
: { text: 'System Response Library (Coming Soon)' }),
},
{
id: 'lst',
text: 'Levee Screening Tool (Coming Soon)',
/*href: lstHref,*/
...(hasActiveDocs('web-applications', 'lst')
? { text: 'Levee Screening Tool', href: lstHref }
: { text: 'Levee Screening Tool (Coming Soon)' }),
/*children: [
{
id: 'users-guide',
Expand All @@ -350,8 +355,9 @@ export default function buildNavLinks(useBaseUrl, latestVersions = {}) {
},
{
id: 'rrft',
text: 'Rainfall Runoff Frequency Tool (Coming Soon)',
/*href: rrftHref,*/
...(hasActiveDocs('web-applications', 'rrft')
? { text: 'Rainfall Runoff Frequency Tool', href: rrftHref }
: { text: 'Rainfall Runoff Frequency Tool (Coming Soon)' }),
},
],
},
Expand Down
Loading