-
Notifications
You must be signed in to change notification settings - Fork 0
feat(differentials): four-page Search / Diagnoses / Presentations / Compare nav #1774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
93ea437
feat(differentials): finish four-page Search/Diagnoses/Presentations/…
cursoragent bdb121d
docs(ledger): record differentials four-page nav handoff
cursoragent 5e11e6e
Merge origin/main into cursor/differentials-four-page-nav-5ebf (resol…
cursoragent ea32866
Merge branch 'main' into cursor/differentials-four-page-nav-5ebf
BigSimmo 384a1be
fix(differentials): clear compare-queue review and CI blockers
cursoragent bcad7ab
docs: record PR #1774 babysit ledger and compare Search ids note
cursoragent 87dd3c9
merge remote PR tip (main sync) into local babysit fixes
cursoragent 8b1a9fe
Merge origin/main into cursor/differentials-four-page-nav-5ebf
cursoragent b0cd1e2
Merge origin/main into cursor/differentials-four-page-nav-5ebf
cursoragent ab95bc4
Merge branch 'main' into cursor/differentials-four-page-nav-5ebf
BigSimmo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
145 changes: 145 additions & 0 deletions
145
src/components/differentials/differential-compare-queue-page.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,145 @@ | ||
| import Link from "next/link"; | ||
| import { ArrowLeft, GitCompareArrows, Search, X } from "lucide-react"; | ||
|
|
||
| import { differentialCompareSearchHref, differentialRouteWithQuery } from "@/lib/differentials-navigation"; | ||
|
|
||
| export type DifferentialCompareQueueItem = { | ||
| slug: string; | ||
| title: string; | ||
| }; | ||
|
|
||
| type DifferentialCompareQueuePageProps = { | ||
| query?: string; | ||
| items: DifferentialCompareQueueItem[]; | ||
| openComparisonHref: string; | ||
| }; | ||
|
|
||
| /** | ||
| * Compare queue (empty or selected diagnosis ids). Server Component so the | ||
| * route does not add a client chunk against the repo-wide gzip budget. | ||
| */ | ||
| export function DifferentialCompareQueuePage({ | ||
| query = "", | ||
| items, | ||
| openComparisonHref, | ||
| }: DifferentialCompareQueuePageProps) { | ||
| const trimmedQuery = query.trim(); | ||
| const selectedIds = items.map((item) => item.slug); | ||
| const editSelectionHref = differentialCompareSearchHref(trimmedQuery, selectedIds); | ||
|
|
||
| if (items.length === 0) { | ||
| return ( | ||
| <main | ||
| data-testid="differential-compare-empty" | ||
| className="min-h-[calc(100dvh-var(--shell-header-h))] bg-[color:var(--background)] px-4 py-10 text-[color:var(--text)] sm:px-6 lg:px-8" | ||
| > | ||
| <div className="mx-auto grid w-full max-w-3xl gap-6"> | ||
| <section className="rounded-lg border border-[color:var(--border-lux)] bg-[color:var(--surface-lux)] p-5 sm:p-6"> | ||
| <p className="text-xs font-bold uppercase tracking-eyebrow text-[color:var(--clinical-accent)]">Compare</p> | ||
| <h1 className="mt-1 text-3xl font-bold leading-tight text-[color:var(--text-heading)] sm:text-4xl"> | ||
| Tick diagnoses on Search to build a comparison | ||
| </h1> | ||
| <p className="mt-3 text-sm leading-7 text-[color:var(--text-muted)]"> | ||
| The compare queue is empty. Search differentials, select diagnoses, then return here to open a | ||
| side-by-side presentation workflow. | ||
| </p> | ||
| <div className="mt-5 flex flex-wrap gap-2"> | ||
| <Link | ||
| href={differentialCompareSearchHref(trimmedQuery)} | ||
| className="inline-flex min-h-tap items-center gap-2 rounded-lg border border-[color:var(--clinical-accent-border)] bg-[color:var(--clinical-accent)] px-4 text-sm font-bold text-[color:var(--clinical-accent-contrast)]" | ||
| > | ||
| <Search className="h-4 w-4" aria-hidden /> | ||
| {trimmedQuery ? "Back to Search results" : "Open Search"} | ||
| </Link> | ||
| <Link | ||
| href="/differentials/diagnoses" | ||
| className="inline-flex min-h-tap items-center gap-2 rounded-lg border border-[color:var(--border)] bg-[color:var(--surface)] px-4 text-sm font-bold text-[color:var(--text-heading)]" | ||
| > | ||
| Browse diagnoses | ||
| </Link> | ||
| </div> | ||
| </section> | ||
| </div> | ||
| </main> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <main | ||
| data-testid="differential-compare-queue" | ||
| className="min-h-[calc(100dvh-var(--shell-header-h))] bg-[color:var(--background)] px-4 py-10 text-[color:var(--text)] sm:px-6 lg:px-8" | ||
| > | ||
| <div className="mx-auto grid w-full max-w-3xl gap-6"> | ||
| <section className="rounded-lg border border-[color:var(--border-lux)] bg-[color:var(--surface-lux)] p-5 sm:p-6"> | ||
| <div className="flex flex-wrap items-start justify-between gap-3"> | ||
| <div className="min-w-0"> | ||
| <p className="text-xs font-bold uppercase tracking-eyebrow text-[color:var(--clinical-accent)]"> | ||
| Compare queue | ||
| </p> | ||
| <h1 className="mt-1 text-3xl font-bold leading-tight text-[color:var(--text-heading)] sm:text-4xl"> | ||
| {items.length} diagnosis{items.length === 1 ? "" : "es"} selected | ||
| </h1> | ||
| <p className="mt-3 text-sm leading-7 text-[color:var(--text-muted)]"> | ||
| Review the queue, remove any diagnosis you do not need, then open the comparison workspace. | ||
| </p> | ||
| {trimmedQuery ? ( | ||
| <p className="mt-2 text-sm font-bold text-[color:var(--clinical-accent)]">Query: {trimmedQuery}</p> | ||
| ) : null} | ||
| </div> | ||
| <Link | ||
| href={editSelectionHref} | ||
| className="inline-flex min-h-tap items-center gap-2 rounded-lg border border-[color:var(--border)] bg-[color:var(--surface)] px-3 text-sm font-bold text-[color:var(--text-heading)]" | ||
| > | ||
| <ArrowLeft className="h-4 w-4" aria-hidden /> | ||
| Search | ||
| </Link> | ||
| </div> | ||
| </section> | ||
|
|
||
| <section className="grid gap-2" aria-label="Selected diagnoses"> | ||
| {items.map((item) => { | ||
| const remainingIds = selectedIds.filter((id) => id !== item.slug); | ||
| return ( | ||
| <div | ||
| key={item.slug} | ||
| className="flex min-h-tap items-center justify-between gap-3 rounded-lg border border-[color:var(--border)] bg-[color:var(--surface)] px-3 py-2" | ||
| > | ||
| <Link | ||
| href={`/differentials/diagnoses/${item.slug}`} | ||
| className="min-w-0 text-sm font-bold text-[color:var(--text-heading)] hover:text-[color:var(--clinical-accent)]" | ||
| > | ||
| <span className="line-clamp-2">{item.title}</span> | ||
| </Link> | ||
| <Link | ||
| href={differentialRouteWithQuery("/differentials/compare", trimmedQuery, remainingIds)} | ||
| aria-label={`Remove ${item.title} from compare queue`} | ||
| className="grid h-tap w-tap shrink-0 place-items-center rounded-md border border-[color:var(--border)] text-[color:var(--text-muted)] hover:border-[color:var(--danger-border)] hover:text-[color:var(--danger)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[color:var(--focus)]" | ||
| > | ||
| <X className="h-4 w-4" aria-hidden /> | ||
| </Link> | ||
| </div> | ||
| ); | ||
| })} | ||
| </section> | ||
|
|
||
| <div className="flex flex-wrap gap-2"> | ||
| <Link | ||
| href={openComparisonHref} | ||
| data-testid="differential-compare-open" | ||
| className="inline-flex min-h-tap items-center gap-2 rounded-lg border border-[color:var(--clinical-accent-border)] bg-[color:var(--clinical-accent)] px-4 text-sm font-bold text-[color:var(--clinical-accent-contrast)]" | ||
| > | ||
| <GitCompareArrows className="h-4 w-4" aria-hidden /> | ||
| Open comparison | ||
| </Link> | ||
| <Link | ||
| href={editSelectionHref} | ||
| data-testid="differential-compare-edit-selection" | ||
| className="inline-flex min-h-tap items-center gap-2 rounded-lg border border-[color:var(--border)] bg-[color:var(--surface)] px-4 text-sm font-bold text-[color:var(--text-heading)]" | ||
| > | ||
| Edit selection on Search | ||
| </Link> | ||
| </div> | ||
| </div> | ||
| </main> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.