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
45 changes: 0 additions & 45 deletions src/components/clinical-dashboard/global-search-shell.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -260,30 +260,6 @@ function readInitialBrowserSubmittedSearchParamString(): string {
return params.get("run") === "1" && query ? search : "";
}

export function infoPageBackHref(pathname: string): string | null {
if (pathname.startsWith("/services/")) return appModeHomeHref("services");
if (pathname.startsWith("/forms/")) return appModeHomeHref("forms");
if (pathname.startsWith("/medications/")) return appModeHomeHref("prescribing");
if (pathname.startsWith("/differentials/")) return appModeHomeHref("differentials");
if (pathname.startsWith("/dsm/")) return appModeHomeHref("dsm");
if (pathname.startsWith("/specifiers/")) return appModeHomeHref("specifiers");
if (pathname.startsWith("/formulation/")) return appModeHomeHref("formulation");
if (pathname.startsWith("/therapy-compass/")) return appModeHomeHref("therapy-compass");
if (pathname.startsWith("/factsheets/")) return appModeHomeHref("factsheets");
if (pathname.startsWith("/documents/")) return documentsSearchHref();
return null;
}

/** Stable in-app back target for non-info mobile back (e.g. submitted differential search). */
export function mobileBackHref(pathname: string, searchMode: string, hasQuery: boolean): string | null {
const infoHref = infoPageBackHref(pathname);
if (infoHref) return infoHref;
if (pathname === "/differentials" && searchMode === "differentials" && hasQuery) {
return appModeHomeHref("differentials", { focus: true });
}
return null;
}

function isToolDetailWithFooterSearch(pathname: string): boolean {
return (
(pathname.startsWith("/services/") && pathname !== "/services") ||
Expand DownExpand Up@@ -864,27 +840,6 @@ function GlobalStandaloneSearchShellBody({
onNewChat={startNewAnswerChat}
showDesktopNewChat={!shouldShowDesktopSidebar}
onOpenMobileSidebar={() => setMobileMenuOpen(true)}
mobileLeadingAction={
isInfoPage
? "back"
: pathname === "/differentials" && searchMode === "differentials" && requestedQuery
? "back"
: "menu"
}
onMobileBack={() => {
const fallbackHref = mobileBackHref(pathname, searchMode, Boolean(requestedQuery));
if (fallbackHref) {
if (!isInfoPage) setQuery("");
router.push(fallbackHref);
return;
}
if (!isInfoPage) {
setQuery("");
navigateToMode(searchMode, { focus: true });
return;
}
router.back();
}}
queryModeOptions={mockupQueryModeOptions}
queryInputRef={inputRef}
recentQueries={recentQueries}
Expand Down
18 changes: 4 additions & 14 deletions src/components/clinical-dashboard/master-search-header.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,7 +29,6 @@ import {
Search,
Send,
ShieldCheck,
ArrowLeft,
X,
} from "lucide-react";

Expand DownExpand Up@@ -197,8 +196,6 @@ export function MasterSearchHeader({
desktopPageComposerSlotId,
heroComposerBreakpoint = "all",
mobileBottomSearchAddonSlotId,
mobileLeadingAction = "menu",
onMobileBack,
hideOnScroll,
onBottomComposerHiddenChange,
showDesktopNewChat = true,
Expand DownExpand Up@@ -263,8 +260,6 @@ export function MasterSearchHeader({
heroComposerBreakpoint?: "all" | "sm-up";
/** Mobile/tablet slot rendered above the search pill for page-specific composer addons. */
mobileBottomSearchAddonSlotId?: string;
mobileLeadingAction?: "menu" | "back";
onMobileBack?: () => void;
/** Phone-only hide-on-scroll for the universal header and bottom search dock.
* "overlay" translates the sticky header away (host scrolls the document,
* content already flows beneath); "collapse" also releases the header's
Expand DownExpand Up@@ -604,7 +599,6 @@ export function MasterSearchHeader({
: "answer";
const actionMenuItems = modeActionItemsFor(actionMenuSetId);
const actionMenuButtonLabel = `Open ${selectedAppMode.label.toLowerCase()} options`;
const useMobileBackControl = mobileLeadingAction === "back";

function currentUsesScopeSheet() {
return window.matchMedia(scopeSheetMediaQuery).matches;
Expand DownExpand Up@@ -2031,20 +2025,16 @@ export function MasterSearchHeader({
<div className="flex min-w-0 items-center gap-2 sm:gap-3">
<button
type="button"
onClick={useMobileBackControl ? onMobileBack : onOpenMobileSidebar}
onClick={onOpenMobileSidebar}
className={cn(
"universal-header-icon-control h-tap w-tap shrink-0 place-items-center rounded-full text-[color:var(--text-muted)] transition hover:bg-[color:var(--surface-subtle)] hover:text-[color:var(--text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[color:var(--focus)]",
// From md the desktop icon rail owns navigation, so the drawer
// trigger is phone-only outside workflow headers.
isWorkflowHeader || useMobileBackControl ? "grid" : "grid md:hidden",
isWorkflowHeader ? "grid" : "grid md:hidden",
)}
aria-label={useMobileBackControl ? "Go back" : "Open Clinical Guide menu"}
aria-label="Open Clinical Guide menu"
>
{useMobileBackControl ? (
<ArrowLeft aria-hidden="true" className="h-5 w-5" />
) : (
<Menu aria-hidden="true" className="h-5 w-5" />
)}
<Menu aria-hidden="true" className="h-5 w-5" />
</button>
{isServicesMode ? (
<div className="hidden min-w-0 items-center gap-3 lg:flex">
Expand Down
39 changes: 0 additions & 39 deletions tests/global-search-shell-back-href.test.ts

This file was deleted.

Loading