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
1 change: 1 addition & 0 deletions docs/site-map.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ This file is generated by `npm run sitemap:update`. Run `npm run sitemap:check`
- `/?mode=prescribing` - Medication mode. Search kind: `documents`. Query example: `/?mode=prescribing&q=acamprosate+renal+dose&focus=1&run=1`.
- `/?mode=tools` - Tools mode. Search kind: `tools`. Query example: `/?mode=tools&q=medications&focus=1&run=1`.
- `/therapy-compass` - Therapy mode. Search kind: `tools`. Query example: `/therapy-compass?q=behavioural+activation&focus=1&run=1`.
- `/factsheets` - Factsheets mode. Search kind: `tools`. Query example: `/factsheets/search?q=sertraline&focus=1&run=1`.

## Mode page index

Expand Down
1 change: 1 addition & 0 deletions scripts/generate-site-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ function renderModeRoutes() {
prescribing: appModeHomeHref("prescribing", { query: "acamprosate renal dose", focus: true, run: true }),
tools: appModeHomeHref("tools", { query: "medications", focus: true, run: true }),
"therapy-compass": appModeHomeHref("therapy-compass", { query: "behavioural activation", focus: true, run: true }),
factsheets: appModeHomeHref("factsheets", { query: "sertraline", focus: true, run: true }),
};

return appModeDefinitions.map((mode) =>
Expand Down
8 changes: 7 additions & 1 deletion src/app/factsheets/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ import type { Metadata } from "next";
import { notFound } from "next/navigation";

import { FactsheetDetailPage } from "@/components/factsheets/factsheet-detail-page";
import { findFactsheet } from "@/components/factsheets/factsheets-data";
import { factsheetSlugs, findFactsheet } from "@/components/factsheets/factsheets-data";

export const dynamicParams = false;

export function generateStaticParams() {
return factsheetSlugs().map((slug) => ({ slug }));
}

export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }): Promise<Metadata> {
const { slug } = await params;
Expand Down
8 changes: 6 additions & 2 deletions src/app/factsheets/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import type { ReactNode } from "react";

import { FactsheetShell } from "@/components/factsheets/factsheet-shell";
import { GlobalSearchShell } from "@/components/clinical-dashboard/global-search-shell";

export default function FactsheetsLayout({ children }: { children: ReactNode }) {
return <FactsheetShell>{children}</FactsheetShell>;
return (
<GlobalSearchShell initialMode="factsheets" desktopSearchPlacement="hero">
{children}
</GlobalSearchShell>
);
}
20 changes: 18 additions & 2 deletions src/app/factsheets/search/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
import type { Metadata } from "next";

import { filterFactsheets } from "@/components/factsheets/factsheets-data";
import { FactsheetsSearchPage } from "@/components/factsheets/factsheets-search-page";

export const metadata: Metadata = { title: "Search Patient Information | Clinical KB" };

export default function FactsheetsSearchRoute() {
return <FactsheetsSearchPage />;
// App Router hands repeated query params (?q=a&q=b) through as string[]; collapse to
// the first value the way the DSM/Services search routes do, so a malformed link
// filters on one value instead of throwing on `.trim()`.
function firstValue(value?: string | string[]) {
return Array.isArray(value) ? value[0] : value;
}

export default async function FactsheetsSearchRoute({
searchParams,
}: {
searchParams: Promise<{ q?: string | string[]; category?: string | string[] }>;
}) {
const params = await searchParams;
const query = (firstValue(params.q) ?? "").trim();
const category = firstValue(params.category);
const results = filterFactsheets(query, category);
return <FactsheetsSearchPage query={query} category={category} results={results} />;
}
28 changes: 28 additions & 0 deletions src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -2403,3 +2403,31 @@ html[data-motion="reduced"] .source-capsule-hit[aria-expanded="true"]:hover .sou
text-decoration: underline;
}
}

/* Patient factsheet print sheet.
* The clean A4 sheet is hidden on screen. When the user hits Download PDF / Print,
* the detail component toggles `factsheets-printing` on <html>; in print we then hide
* every rendered element and reveal ONLY the print sheet, so the shell chrome
* (sidebar, composer, action bar) never appears in the exported PDF. */
.factsheet-print-sheet {
display: none;
}

@media print {
html.factsheets-printing body * {
visibility: hidden !important;
Comment thread
BigSimmo marked this conversation as resolved.
}

html.factsheets-printing .factsheet-print-sheet,
html.factsheets-printing .factsheet-print-sheet * {
visibility: visible !important;
}

html.factsheets-printing .factsheet-print-sheet {
display: block !important;
position: absolute;
left: 0;
top: 0;
width: 100%;
}
}
1 change: 1 addition & 0 deletions src/components/clinical-dashboard/ClinicalSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const sidebarToolItems = [
{ id: "prescribing", label: "Medication", icon: Pill, href: "/?mode=prescribing" },
{ id: "tools", label: "Tools", icon: Wrench, href: "/?mode=tools" },
{ id: "therapy-compass", label: "Therapy", icon: appModeIcons["therapy-compass"], href: "/therapy-compass" },
{ id: "factsheets", label: "Factsheets", icon: appModeIcons.factsheets, href: "/factsheets" },
] as const;

// Drop any tool whose id is a dev-only app mode from the production nav. Non-mode
Expand Down
2 changes: 2 additions & 0 deletions src/components/clinical-dashboard/global-search-shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ function GlobalStandaloneSearchShellClient({
(searchMode === "dsm" && pathname === "/dsm") ||
(searchMode === "specifiers" && pathname === "/specifiers") ||
(searchMode === "formulation" && pathname === "/formulation") ||
(searchMode === "factsheets" && pathname === "/factsheets") ||
(searchMode === "tools" && pathname === "/tools"));
const isDifferentialPresentationWorkflow = pathname.startsWith("/differentials/presentations");
const shouldShowDesktopSidebar = !hideDesktopSidebar;
Expand Down Expand Up @@ -342,6 +343,7 @@ function GlobalStandaloneSearchShellClient({
router.prefetch("/dsm");
router.prefetch("/specifiers");
router.prefetch("/formulation");
router.prefetch("/factsheets");
}

function openGuide() {
Expand Down
Loading
Loading