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
21 changes: 2 additions & 19 deletions src/components/therapy-compass/screens/search-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {

import { useTcBindings } from "../bindings";
import { outlineControl, softControl } from "../controls";
import { SearchIcon, SearchXIcon, XIcon } from "../icons";
import { SearchXIcon, XIcon } from "../icons";
import { EmptyState, LoadingState } from "../ui";
import { ResultCard } from "../therapy-card";

Expand All @@ -24,29 +24,12 @@ export function SearchScreen() {

return (
<section data-screen-label="Search" className="tc-screens-search-screen-001">
<h1 className="tc-screens-search-screen-002">Therapy</h1>
<p className="tc-screens-search-screen-003">
Find source-grounded therapy records by problem, symptom, skill or population.
</p>

<div className="tc-screens-search-screen-004">
<label className="tc-screens-search-screen-005">
<SearchIcon size={19} strokeWidth={1.8} className="tc-screens-search-screen-006" />
<input
value={q}
onChange={(e) => b.setQuery(e.target.value)}
placeholder="Search anxiety, trauma, CBT, relapse prevention…"
aria-label="Search therapies"
className="tc-screens-search-screen-007"
/>
</label>
</div>

<SearchResultsHeaderBand
modeId="therapy-compass"
query={q}
matchCount={results.length}
loading={b.loading}
headingLevel={1}
filterLabel="Filter therapy results"
mobileControls={
<div className="grid min-w-0 grid-cols-2 gap-1.5">
Expand Down
43 changes: 0 additions & 43 deletions src/components/therapy-compass/therapy-compass.css
Original file line number Diff line number Diff line change
Expand Up @@ -2982,49 +2982,6 @@
max-width: 1180px;
margin: 0 auto;
}
.tc-root .tc-screens-search-screen-002 {
margin: 0 0 6px;
font-size: 27px;
font-weight: 680;
color: var(--text-heading);
letter-spacing: -0.02em;
}
.tc-root .tc-screens-search-screen-003 {
margin: 0 0 22px;
font-size: 14.5px;
color: var(--text-muted);
}
.tc-root .tc-screens-search-screen-004 {
display: flex;
gap: 12px;
align-items: center;
margin-bottom: 16px;
flex-wrap: wrap;
}
.tc-root .tc-screens-search-screen-005 {
flex: 1;
min-width: 260px;
position: relative;
display: flex;
align-items: center;
}
.tc-root .tc-screens-search-screen-006 {
position: absolute;
left: 16px;
color: var(--text-soft);
}
.tc-root .tc-screens-search-screen-007 {
width: 100%;
height: 52px;
padding: 0 16px 0 46px;
border: 1px solid var(--border-strong);
border-radius: 13px;
background: var(--surface);
color: var(--text);
font-size: 16px;
font-family: inherit;
box-shadow: var(--shadow-tight);
}
.tc-root .tc-screens-search-screen-008 {
display: flex;
flex-wrap: wrap;
Expand Down
9 changes: 7 additions & 2 deletions tests/therapy-compass-mode-wiring.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const therapyMetadataFiles = [
];

describe("Therapy Compass production-mode wiring", () => {
it("uses Therapy for user-facing mode copy, search heading, and page metadata", () => {
it("uses Therapy for user-facing mode copy, search results ribbon, and page metadata", () => {
const appModesSrc = readFileSync(new URL("../src/lib/app-modes.ts", import.meta.url), "utf8");
const homeSrc = readFileSync(
new URL("../src/components/therapy-compass/screens/home-screen.tsx", import.meta.url),
Expand All @@ -47,8 +47,13 @@ describe("Therapy Compass production-mode wiring", () => {
expect(appModesSrc).toContain('label: "Therapy"');
expect(appModesSrc).toContain('submitAriaLabel: "Open Therapy"');
expect(homeSrc).toContain('title="Therapy"');
expect(searchSrc).toContain('className="tc-screens-search-screen-002">Therapy</h1>');
// Search route owns filters/results only; the results ribbon is the page h1.
expect(searchSrc).toContain("SearchResultsHeaderBand");
expect(searchSrc).toContain("headingLevel={1}");
expect(searchSrc).not.toContain("Search therapies");
expect(searchSrc).not.toContain("Find source-grounded therapy records");
expect(workspaceSrc).toContain("Therapy could not load");
// Therapy stays out of the six-item sidebar; mode discovery is via Tools/search.
expect(sidebarSrc).not.toContain('id: "therapy-compass"');
expect(appModesSrc).not.toContain("Therapy mode");
expect(homeSrc).not.toContain("Therapy mode");
Expand Down
13 changes: 6 additions & 7 deletions tests/ui-accessibility.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,26 +516,25 @@ test.describe("Clinical KB accessibility coverage", () => {

await page.setViewportSize({ width: 390, height: 844 });
await page.goto("/therapy-compass/search", { waitUntil: "domcontentloaded" });
await expect(page.getByRole("heading", { name: "Therapy", exact: true })).toBeVisible({ timeout: 60_000 });
await expect(page.getByRole("button", { name: "Search", exact: true })).toHaveAttribute("aria-current", "page");
const therapyRibbon = page.getByTestId("search-query-ribbon");
await expect(therapyRibbon.getByRole("heading", { name: "All" })).toBeVisible();
await expect(therapyRibbon.getByRole("heading", { name: "All", level: 1 })).toBeVisible({ timeout: 60_000 });
await expect(therapyRibbon.getByRole("group", { name: "Filter therapy results" })).toBeVisible();
await expect(page.getByRole("textbox", { name: "Search therapies" })).toHaveCount(0);
const therapyTopics = therapyRibbon.getByTestId("therapy-topic-filter-select");
const therapyAvailability = therapyRibbon.getByTestId("therapy-availability-filter-select");
await expect(therapyTopics).toBeVisible();
await expect(therapyTopics).toHaveAccessibleName("Add or remove a therapy topic filter");
await expect(therapyAvailability).toBeVisible();
await expect(therapyAvailability).toHaveAccessibleName("Change therapy availability filters");

const searchInput = page.getByRole("textbox", { name: "Search therapies" });
await searchInput.focus();
const inputFocus = await searchInput.evaluate((element) => {
await therapyTopics.focus();
const topicsFocus = await therapyTopics.evaluate((element) => {
const style = getComputedStyle(element);
return { outlineStyle: style.outlineStyle, outlineWidth: Number.parseFloat(style.outlineWidth) };
});
expect(inputFocus.outlineStyle).not.toBe("none");
expect(inputFocus.outlineWidth).toBeGreaterThanOrEqual(2);
expect(topicsFocus.outlineStyle).not.toBe("none");
expect(topicsFocus.outlineWidth).toBeGreaterThanOrEqual(2);

await therapyTopics.selectOption("CBT");
await expect(therapyTopics.locator('option[value=""]')).toHaveText("1 topics selected");
Expand Down
5 changes: 4 additions & 1 deletion tests/ui-route-coverage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,10 @@ test.describe("previously uncovered production routes", () => {
.getByRole("button", { name: "Anxiety in outpatient care", exact: true });
await expect(search).toBeEnabled();
await search.click();
await expect(currentPage.getByRole("heading", { name: "Therapy", level: 1, exact: true })).toBeVisible();
await expect(
currentPage.getByRole("heading", { name: "Anxiety in outpatient care", level: 1, exact: true }),
).toBeVisible();
await expect(currentPage.getByTestId("search-query-ribbon")).toBeVisible();
const nav = currentPage.getByRole("navigation", { name: "Therapy sections" });
// Phone: section nav portals into the header collapse host (outside
// .tc-root). Read canvas colour from the workspace root still in the
Expand Down
Loading