Skip to content
Open
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
21 changes: 21 additions & 0 deletions src/pages/Dashboard.print.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import fs from "node:fs";
import path from "node:path";

describe("Dashboard print presentation", () => {
const dashboardPath = path.join(process.cwd(), "src/pages/Dashboard.tsx");
const printCssPath = path.join(process.cwd(), "src/styles/print.css");

it("provides a print stylesheet for Dashboard", () => {
const css = fs.readFileSync(printCssPath, "utf8");
expect(css).toContain("@media print");
expect(css).toContain(".dashboard-chrome");
expect(css).toContain("display: none !important");
});

it("connects Dashboard to the print stylesheet", () => {
const component = fs.readFileSync(dashboardPath, "utf8");
expect(component).toContain('import "../styles/print.css";');
expect(component).toContain("dashboard-container");
expect(component).toContain("dashboard-chrome");
});
});
12 changes: 10 additions & 2 deletions src/pages/Dashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from "react"
import { StellarWaveEmptyState } from "../components/EmptyState"
import "../styles/print.css";

/**
* Dashboard page component (Legacy Pages Router).
Expand All @@ -18,6 +19,11 @@ import { StellarWaveEmptyState } from "../components/EmptyState"
* layer (src/styles/focus.css) for WCAG 2.1 AA 3:1 contrast ratio.
* - Tap targets: All interactive elements maintain ≥44×44px minimum
* (WCAG 2.5.5) via Button size="lg" in the StellarWaveEmptyState.
*
* Issue #805: Add print stylesheet section for Dashboard.
* - Chrome (navigation + interactive controls) is hidden via .dashboard-chrome.
* - Collapsible sections are expanded when printing so the printed Dashboard
* shows all content without requiring user interaction.
*/
export default function Dashboard() {
return (
Expand All @@ -30,7 +36,9 @@ export default function Dashboard() {
<h1 className="text-2xl sm:text-3xl font-bold mb-4 sm:mb-6">
Dashboard
</h1>
<StellarWaveEmptyState />
<div className="dashboard-chrome">
<StellarWaveEmptyState />
</div>
</div>
)
}
}
31 changes: 31 additions & 0 deletions src/styles/print.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,34 @@
height: auto !important;
}
}

/* Dashboard print presentation. Interactive controls and navigation
* chrome are omitted from the printed page. The empty state content
* is preserved so the printed Dashboard provides a clean summary. */
@media print {
.dashboard-container {
max-width: none !important;
padding: 0 !important;
background: #fff !important;
color: #000 !important;
}

.dashboard-chrome {
display: none !important;
}

.dashboard-container [class*="text-muted-foreground"] {
color: #374151 !important;
}

.dashboard-container [class*="bg-card"],
.dashboard-container [class*="bg-background"],
.dashboard-container [class*="bg-muted"] {
background: #fff !important;
}

.dashboard-container a {
color: #000 !important;
text-decoration: none !important;
}
}