feat(reports): professional PDF report with branded layout#93
Merged
Conversation
Rebuild the PDF export from flat tables into a designed report: branded cover band, executive KPI cards, colour-coded findings, period-activity deltas, a stacked alert-severity bar with legend, and accented detail tables with inline percentage bars and zebra rows. Headings stay glued to short tables across page breaks; a paginated footer numbers every page. Authored as .tsx (react-pdf primitives); vitest now overrides the tsconfig jsx:preserve via oxc so the module compiles under test.
Add a dedicated cover page naming the organisation (name, domain, period, risk score, classification) and restructure the body around pure information rather than dashboard widgets: an executive narrative, key findings, a what-changed-this-period summary, a notable-incidents table (top breaches), and an alert breakdown, followed by the detail tables. Content pages carry a running header and paginated footer. Thread company name/domain into ReportData via getReportData.
Point the Reports toolbar PDF button at the export route (format=pdf) so it downloads the server-built, multi-page PDF instead of opening the browser print dialog. Carries the active report filters.
Replace the generic blues with the app's brand tokens (violet primary, orange accent, warm cream, --severity-* colours as hex). Make the cover lead with the customer organisation name as the hero; DataShield is now only a small generated-by footnote.
Move the company lookup out of the getReportData orchestrator into its own org.ts slice, matching the other report modules. Replace the silent 'Unknown organisation' fallback with a thrown error: companyId comes from the session, so a missing row is broken integrity, not an empty result, and a placeholder name on a security report would mislead.
Replace the static datashield-report filename with a slugged company name, section and generation date so downloads are self-describing and collision-free.
Notable incidents could push its table to the next page while the heading stayed at the bottom of the previous one. Reserve space below each SectionHead and keep the incidents block atomic so titles never strand.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Multi-section PDF security report with a branded, information-led layout.
Test
npm run seed:devthen download PDF/CSV from the Reports pagedatashield_<company>_report_<date>.pdf