From 4acb3f62db38ddc4e5c6faf2119f116f0b2c9f12 Mon Sep 17 00:00:00 2001 From: Adam Gohs Date: Thu, 15 Oct 2026 14:40:34 -0400 Subject: [PATCH] Show review-stage draft wording in PR previews The draft strip and print band always said the document is pending RMC Director approval. That is true for a draft published to the main site, but PR previews show drafts still in peer, Lead Civil, and technical review, where the message misleads reviewers. Preview builds now read "Draft for review. This document has not been approved for publication." while the main site keeps the Director wording. --- docusaurus.config.js | 3 +++ src/components/DraftNotice.js | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index 6fea3bcdd..ded013ba5 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -57,6 +57,9 @@ export default { onBrokenAnchors: 'warn', url: process.env.DOCUSAURUS_URL || 'https://USACE-RMC.github.io', baseUrl: process.env.DOCUSAURUS_BASE_URL || '/RMC-Software-Documentation/', + customFields: { + isPreview: process.env.DOCUSAURUS_IS_PREVIEW === 'true', + }, favicon: 'img/USACE.png', organizationName: 'USACE-RMC', // Your GitHub organization or username projectName: 'RMC-Software-Documentation', // Your project name, make sure this matches your GitHub repo name diff --git a/src/components/DraftNotice.js b/src/components/DraftNotice.js index 51bb75734..ec9082179 100644 --- a/src/components/DraftNotice.js +++ b/src/components/DraftNotice.js @@ -1,5 +1,6 @@ import { useLocation } from '@docusaurus/router'; import useBaseUrl from '@docusaurus/useBaseUrl'; +import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import latestVersions from '@site/static/versions/latestVersions.json'; import { draftDocs } from '../draftDocs'; @@ -20,6 +21,13 @@ import { draftDocs } from '../draftDocs'; */ export const DRAFT_STATUS_TEXT = 'This document is pending final approval by the RMC Director.'; +// A PR preview shows the draft while it is still in review, before the Director stage. +export const PREVIEW_DRAFT_STATUS_TEXT = 'Draft for review. This document has not been approved for publication.'; + +function useDraftStatusText() { + const { siteConfig } = useDocusaurusContext(); + return siteConfig.customFields?.isPreview ? PREVIEW_DRAFT_STATUS_TEXT : DRAFT_STATUS_TEXT; +} function getDocInfo(pathname, docsBase) { // docsBase is derived from siteConfig.baseUrl, so this resolves under every @@ -63,12 +71,13 @@ export function useIsDraftDoc() { */ export const DraftStatusStrip = () => { const isDraft = useIsDraftDoc(); + const statusText = useDraftStatusText(); if (!isDraft) return null; return (
- {DRAFT_STATUS_TEXT} + {statusText}
); @@ -84,6 +93,7 @@ export const DraftStatusStrip = () => { */ export const DraftPrintFrame = ({ children }) => { const isDraft = useIsDraftDoc(); + const statusText = useDraftStatusText(); if (!isDraft) return <>{children}; return ( @@ -92,7 +102,7 @@ export const DraftPrintFrame = ({ children }) => { @@ -106,7 +116,7 @@ export const DraftPrintFrame = ({ children }) => {