diff --git a/src/app/(protected)/workorders/_components/list/work-orders-list-header.tsx b/src/app/(protected)/workorders/_components/list/work-orders-list-header.tsx index 247e3674..9bbad8fc 100644 --- a/src/app/(protected)/workorders/_components/list/work-orders-list-header.tsx +++ b/src/app/(protected)/workorders/_components/list/work-orders-list-header.tsx @@ -13,6 +13,8 @@ type WorkOrdersListHeaderProps = { /** Omit until wizard shell slice mounts New WO. */ onNewWorkOrder?: () => void; activeFilterCount: number; + /** True while Advanced Filters are applied; results are global and the keyword box is inert. */ + advancedFiltersActive?: boolean; isFetching?: boolean; }; @@ -23,6 +25,7 @@ export function WorkOrdersListHeader({ onOpenAdvancedFilters, onNewWorkOrder, activeFilterCount, + advancedFiltersActive = false, isFetching = false, }: WorkOrdersListHeaderProps) { return ( @@ -34,8 +37,8 @@ export function WorkOrdersListHeader({ placeholder="Search this week…" aria-label="Search work orders" /> - {/* SH-194: keyword search is scoped to the active week; make that scope visible. */} - {search.trim() !== "" && Boolean(weekLabel) && ( + {/* Keyword search is scoped to the active week; make that scope visible. */} + {!advancedFiltersActive && search.trim() !== "" && Boolean(weekLabel) && ( buildResolvedBoardSearchParams({ advApplied: filters.advApplied, - // SH-194: Advanced Filters are global by design; the week-scoped keyword box has no effect. + // Advanced Filters are global by design; the week-scoped keyword box has no effect. search: "", page: filters.page, pageSize: filters.pageSize, diff --git a/src/app/(protected)/workorders/index.tsx b/src/app/(protected)/workorders/index.tsx index 3e7d3856..e12e040d 100644 --- a/src/app/(protected)/workorders/index.tsx +++ b/src/app/(protected)/workorders/index.tsx @@ -48,6 +48,7 @@ export default function WorkOrdersListPage() { onOpenAdvancedFilters={() => filters.setAdvOpen(true)} onNewWorkOrder={() => page.setWizardOpen(true)} activeFilterCount={filters.activeFilterCount} + advancedFiltersActive={filters.advApplied != null} isFetching={tableData.isFetching && !tableData.isLoading} /> } diff --git a/src/test/app/(protected)/workorders/work-orders-search-scope.test.tsx b/src/test/app/(protected)/workorders/work-orders-search-scope.test.tsx index 5904821f..dbf95538 100644 --- a/src/test/app/(protected)/workorders/work-orders-search-scope.test.tsx +++ b/src/test/app/(protected)/workorders/work-orders-search-scope.test.tsx @@ -47,7 +47,7 @@ function renderBoardSource() { return renderHook(() => useBoardWithFilters(), { wrapper }); } -describe("SH-194 keyword search scope indicator", () => { +describe("keyword search scope indicator", () => { it("shows no scope badge while the search box is empty", () => { renderWithProviders( { expect(screen.getByText("Searching within 5/4–5/8")).toBeInTheDocument(); }); + + it("hides the scope label while Advanced Filters are active", () => { + renderWithProviders( + , + { withAuth: false }, + ); + + expect(screen.queryByText(/searching within/i)).not.toBeInTheDocument(); + }); }); -describe("SH-194 keyword search vs Advanced Filters scope", () => { +describe("keyword search vs Advanced Filters scope", () => { beforeEach(() => { searchBoard.mockReset().mockResolvedValue(EMPTY_RESULT); getBoard.mockReset().mockResolvedValue(EMPTY_RESULT);