diff --git a/src/app/globals.css b/src/app/globals.css index 66a6b3affe..eb49f91688 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -1956,26 +1956,24 @@ summary::-webkit-details-marker { /* Premium hover transitions for source capsules */ .source-capsule-hover { - box-shadow: var(--glow-soft), var(--shadow-inset); transition: - transform 180ms cubic-bezier(0.34, 1.56, 0.64, 1), - box-shadow 180ms cubic-bezier(0.22, 1, 0.36, 1), border-color 150ms ease, - background-color 150ms ease !important; + box-shadow 150ms ease, + transform 150ms ease !important; } .source-capsule-hover:hover { - transform: translateY(-1px) scale(1.01); - box-shadow: var(--shadow-tight), var(--shadow-inset); + transform: translateY(-1px) !important; + box-shadow: var(--shadow-tight) !important; } .source-capsule-hover[aria-expanded="true"] { border-color: var(--clinical-accent); - box-shadow: var(--glow-soft), var(--shadow-inset); + box-shadow: var(--shadow-tight), var(--shadow-inset); } .source-capsule-hover[aria-expanded="true"]:hover { - transform: translateY(-1px) scale(1.01); + transform: translateY(-1px) !important; box-shadow: var(--shadow-tight), var(--shadow-inset); } diff --git a/src/components/clinical-dashboard/answer-content.tsx b/src/components/clinical-dashboard/answer-content.tsx index daf564c5fa..539445aa6a 100644 --- a/src/components/clinical-dashboard/answer-content.tsx +++ b/src/components/clinical-dashboard/answer-content.tsx @@ -10,6 +10,7 @@ import { ChevronDown, Copy, ExternalLink, + Layers, Loader2, ShieldCheck, Sparkles, @@ -23,12 +24,12 @@ import { chatMicroAction, cn, sourceCapsule, + sourceCapsuleCountBadge, statusDotMuted, statusDotReady, statusDotReview, subtleStatusPill, textMuted, - toneWarningQuiet, } from "@/components/ui-primitives"; import { sourceResultHref } from "@/components/clinical-dashboard/source-actions"; import { @@ -257,7 +258,7 @@ function primaryAnswerDisplayText(value: string) { .replace(/[;,:-]\s*$/, "")}...`; } -function sourceCapsuleText({ +function sourceCapsuleDisplay({ sourceCount, weakEvidence, grounded, @@ -265,11 +266,11 @@ function sourceCapsuleText({ sourceCount: number; weakEvidence: boolean; grounded: boolean; -}) { - if (sourceCount <= 0) return "No direct source found"; - if (!grounded) return "Review nearby sources"; - if (weakEvidence) return "Review sources"; - return `${sourceCount} source${sourceCount === 1 ? "" : "s"}`; +}): { label: string; showCountBadge: boolean } { + if (sourceCount <= 0) return { label: "No direct source found", showCountBadge: false }; + if (!grounded) return { label: "Review nearby sources", showCountBadge: false }; + if (weakEvidence) return { label: "Review sources", showCountBadge: false }; + return { label: "Sources", showCountBadge: true }; } export function sourceStatusDotClass(metadata: ReturnType | null | undefined) { @@ -572,7 +573,7 @@ export function NaturalLanguageAnswer({ }, []); const cleaned = primaryAnswerDisplayText(text); if (!cleaned) return null; - const capsuleText = sourceCapsuleText({ sourceCount, weakEvidence, grounded }); + const capsuleDisplay = sourceCapsuleDisplay({ sourceCount, weakEvidence, grounded }); const previewSources = capsulePreviewSources(bestSource, sources, sourceLinks); const quoteText = sourceLinks.find((source) => source.snippet)?.snippet || bestSource?.quote || bestSource?.snippet; const canOpenSourcePreview = previewSources.length > 0; @@ -587,31 +588,23 @@ export function NaturalLanguageAnswer({ setCopiedSourceQuote(false); } } - const cautionCapsule = weakEvidence || !grounded; const sourceCapsuleButton = ( - {sourceOnlyNoticeOpen ? ( -
setSourceOnlyNoticeOpen((current) => !current)} + className="inline-flex min-h-7 w-full max-w-[68ch] items-center gap-1.5 px-2 py-1 text-left transition hover:bg-[color:var(--warning-soft)]/55 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-[color:var(--focus)]" + aria-expanded={sourceOnlyNoticeOpen} + aria-controls="source-only-disclosure-detail" > -

- This answer was assembled from your documents without the AI model, so it may be less complete. Verify - dose, threshold, route, timing, monitoring, and risk details against the cited passages below. -

-
- ) : null} - - ) : null} - {sourceCapsuleButton} + + Source-only + · verify passages + + + {sourceOnlyNoticeOpen ? ( +
+

+ This answer was assembled from your documents without the AI model, so it may be less complete. + Verify dose, threshold, route, timing, monitoring, and risk details against the cited passages + below. +

+
+ ) : null} + + ) : null} + {sourceCapsuleButton} + {canOpenSourcePreview && !usePreviewSheet ? (