diff --git a/electron/changelog.json b/electron/changelog.json index 8498c8b..2f21938 100644 --- a/electron/changelog.json +++ b/electron/changelog.json @@ -197,6 +197,6 @@ "1.4.1": { "title": "Release Notes for 1.4.1", "date": "07/04/2025", - "notes": "Improvements:\r\n* Increased performance of scenario manager.\r\n* Report lines will now display better on smaller screens." + "notes": "Improvements:\r\n* Increased performance of scenario manager.\r\n* Report lines will now display better on smaller screens.\r\n* Job RPS printouts will now display in landscape mode and ignore dark mode styling." } } diff --git a/src/components/molecules/jobs-detail-description/jobs-detail-description.molecule.jsx b/src/components/molecules/jobs-detail-description/jobs-detail-description.molecule.jsx index 855b4bf..4aa6fda 100644 --- a/src/components/molecules/jobs-detail-description/jobs-detail-description.molecule.jsx +++ b/src/components/molecules/jobs-detail-description/jobs-detail-description.molecule.jsx @@ -19,9 +19,53 @@ export default function JobsDetailDescriptionMolecule({ loading, job, jobDetailR return job?.joblines?.find((jl) => !jl.ignore && jl.quantity > 1); }, [job]); + // Store original theme state + const originalThemeRef = useRef(null); + const handlePrint = useReactToPrint({ contentRef: jobDetailRef, - bodyClass: "audit-container-print" + bodyClass: "audit-container-print", + onBeforeGetContent: () => { + // Store original theme state + originalThemeRef.current = { + dataTheme: document.documentElement.getAttribute('data-theme'), + bodyClasses: Array.from(document.body.classList), + htmlClasses: Array.from(document.documentElement.classList), + }; + + // Force light mode for printing + document.documentElement.setAttribute('data-theme', 'light'); + document.body.classList.remove('dark', 'ant-dark'); + document.documentElement.classList.remove('dark', 'ant-dark'); + + // Set light mode CSS variables for Ant Design + document.documentElement.style.setProperty('--ant-color-bg-base', '#ffffff'); + document.documentElement.style.setProperty('--ant-color-text', '#000000'); + document.documentElement.style.setProperty('--ant-color-text-secondary', 'rgba(0, 0, 0, 0.65)'); + document.documentElement.style.setProperty('--ant-color-border', '#d9d9d9'); + }, + onAfterPrint: () => { + // Restore original theme after printing + if (originalThemeRef.current) { + const { dataTheme, bodyClasses, htmlClasses } = originalThemeRef.current; + + if (dataTheme) { + document.documentElement.setAttribute('data-theme', dataTheme); + } else { + document.documentElement.removeAttribute('data-theme'); + } + + // Restore original classes + document.body.className = bodyClasses.join(' '); + document.documentElement.className = htmlClasses.join(' '); + } + + // Reset CSS variables + document.documentElement.style.removeProperty('--ant-color-bg-base'); + document.documentElement.style.removeProperty('--ant-color-text'); + document.documentElement.style.removeProperty('--ant-color-text-secondary'); + document.documentElement.style.removeProperty('--ant-color-border'); + } }); if (loading) return ; diff --git a/src/components/organisms/jobs-detail/jobs-detail.organism.jsx b/src/components/organisms/jobs-detail/jobs-detail.organism.jsx index 014abaf..45c517d 100644 --- a/src/components/organisms/jobs-detail/jobs-detail.organism.jsx +++ b/src/components/organisms/jobs-detail/jobs-detail.organism.jsx @@ -59,6 +59,13 @@ export function JobsDetailOrganism({ selectedJobId, setSelectedJobTargetPc }) { return (
+