-
Notifications
You must be signed in to change notification settings - Fork 0
Link differentials diagnosis terms to info pages #1768
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
7 commits
Select commit
Hold shift + click to select a range
0e77e7b
Link differentials diagnosis terms to info pages.
cursoragent 03cb6a8
Record differentials diagnosis-link review in the ledger.
cursoragent d0b148d
Fix segment splitter, termLinks fallback, and Fragment key in safety …
Copilot 4d4292a
Merge origin/main into autopilot/pr-1768 to clear ledger conflict
BigSimmo 0daa9e2
fix(differentials): split only spaced slash diagnosis lists
BigSimmo ba590f9
docs(ledger): record PR #1768 Autopilot review-and-fix
cursoragent 384b80d
Merge remote-tracking branch 'origin/main' into cursor/differentials-…
cursoragent 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| import Link from "next/link"; | ||
| import { ChevronRight } from "lucide-react"; | ||
|
|
||
| import { cn } from "@/components/ui-primitives"; | ||
|
|
||
| /** Client-safe href builder — keep snapshot/catalog imports out of this module. */ | ||
| function differentialDiagnosisHref(slug: string): string { | ||
| return `/differentials/diagnoses/${slug}`; | ||
| } | ||
|
|
||
| export type DiagnosisTermTone = "danger" | "warning" | "accent" | "neutral"; | ||
|
|
||
| const chipToneClass: Record<DiagnosisTermTone, { linked: string; unlinked: string }> = { | ||
| danger: { | ||
| linked: | ||
| "border-[color:var(--danger-border)] bg-[color:var(--surface)] text-[color:var(--danger)] hover:border-[color:var(--danger)] hover:underline", | ||
| unlinked: "border-[color:var(--danger-border)] bg-[color:var(--surface)] text-[color:var(--danger)]", | ||
| }, | ||
| warning: { | ||
| linked: | ||
| "border-[color:var(--warning-border)] bg-[color:var(--warning-soft)] text-[color:var(--warning)] hover:border-[color:var(--warning)] hover:underline", | ||
| unlinked: "border-[color:var(--warning-border)] bg-[color:var(--warning-soft)] text-[color:var(--warning)]", | ||
| }, | ||
| accent: { | ||
| linked: | ||
| "border-[color:var(--clinical-accent-border)] bg-[color:var(--clinical-accent-soft)] text-[color:var(--clinical-accent)] hover:border-[color:var(--clinical-accent)] hover:underline", | ||
| unlinked: "border-[color:var(--border)] bg-[color:var(--surface-subtle)] text-[color:var(--text-muted)]", | ||
| }, | ||
| neutral: { | ||
| linked: | ||
| "border-[color:var(--border-strong)] bg-[color:var(--surface-subtle)] text-[color:var(--text-heading)] hover:border-[color:var(--clinical-accent)] hover:text-[color:var(--clinical-accent)] hover:underline", | ||
| unlinked: "border-[color:var(--border)] bg-[color:var(--surface-subtle)] text-[color:var(--text-muted)]", | ||
| }, | ||
| }; | ||
|
|
||
| const focusRing = | ||
| "focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[color:var(--focus)]"; | ||
|
|
||
| type DiagnosisTermChipProps = { | ||
| label: string; | ||
| slug?: string | null; | ||
| tone?: DiagnosisTermTone; | ||
| className?: string; | ||
| }; | ||
|
|
||
| /** | ||
| * Discrete diagnosis/risk chip. Links when a catalog slug is provided; otherwise | ||
| * renders a non-interactive chip so unlinked clinical risks stay readable. | ||
| */ | ||
| export function DiagnosisTermChip({ label, slug = null, tone = "neutral", className }: DiagnosisTermChipProps) { | ||
| const tones = chipToneClass[tone]; | ||
| if (slug) { | ||
| return ( | ||
| <Link | ||
| href={differentialDiagnosisHref(slug)} | ||
| aria-label={`Open diagnosis: ${label}`} | ||
| className={cn( | ||
| "inline-flex min-h-tap items-center gap-1 rounded-md border px-2.5 text-xs font-bold", | ||
| focusRing, | ||
| tones.linked, | ||
| className, | ||
| )} | ||
| > | ||
| {label} | ||
| <ChevronRight className="h-3.5 w-3.5 shrink-0" aria-hidden /> | ||
| </Link> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <span | ||
| className={cn( | ||
| "inline-flex min-h-tap items-center rounded-md border px-2.5 text-xs font-semibold", | ||
| tones.unlinked, | ||
| className, | ||
| )} | ||
| > | ||
| {label} | ||
| </span> | ||
| ); | ||
| } | ||
|
|
||
| type DiagnosisTermInlineProps = { | ||
| label: string; | ||
| slug?: string | null; | ||
| className?: string; | ||
| }; | ||
|
|
||
| /** Dense inline diagnosis link for comparison-table prose. */ | ||
| export function DiagnosisTermInline({ label, slug = null, className }: DiagnosisTermInlineProps) { | ||
| if (!slug) { | ||
| return <span className={className}>{label}</span>; | ||
| } | ||
|
|
||
| return ( | ||
| <Link | ||
| href={differentialDiagnosisHref(slug)} | ||
| aria-label={`Open diagnosis: ${label}`} | ||
| className={cn( | ||
| "font-semibold text-[color:var(--clinical-accent)] underline-offset-2 hover:underline", | ||
| focusRing, | ||
| className, | ||
| )} | ||
| > | ||
| {label} | ||
| </Link> | ||
| ); | ||
| } | ||
|
|
||
| type DiagnosisTermInlineListProps = { | ||
| segments: ReadonlyArray<{ text: string; slug: string | null }>; | ||
| className?: string; | ||
| }; | ||
|
|
||
| /** Render comma-separated inline segments, linking only resolved diagnoses. */ | ||
| export function DiagnosisTermInlineList({ segments, className }: DiagnosisTermInlineListProps) { | ||
| if (segments.length === 0) return null; | ||
| return ( | ||
| <span className={className}> | ||
| {segments.map((segment, index) => ( | ||
| <span key={`${segment.text}-${index}`}> | ||
| {index > 0 ? <span className="text-[color:var(--text-muted)]">, </span> : null} | ||
| <DiagnosisTermInline label={segment.text} slug={segment.slug} /> | ||
| </span> | ||
| ))} | ||
| </span> | ||
| ); | ||
| } |
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.