// "What does this look like?" — a right-side drawer over the rail with generic teaching material for one finding
// type: definition, key signs, sign schematics (round 5), look-alikes, and example films from a separate reference set with the expert outline in
// cyan. It never says anything about the case being read, so it is available before submit.
// Mount once on a page; open it from anywhere with openReference(label) or .
import { useEffect, useRef, useState } from 'react';
import { track } from '../analytics';
import { useQuery } from '@tanstack/react-query';
import { assetUrl } from '../api/client';
import { fetchReference } from '../api/reference';
import { labelDisplay } from '../api/labels';
import type { ReferenceExample, ReferenceFilm, ReferenceLabel } from './guard';
import { uiTerms } from './guard';
import { openReference, useReference } from './store';
import { SignsToKnow } from './SignsToKnow';
import { VolumeExample } from './VolumeExample';
import s from './Reference.module.css';
const REVIEW: Record = {
ai_draft: 'AI draft — not yet reviewed',
student_reviewed: 'Student reviewed',
radiologist_reviewed: 'Radiologist reviewed',
};
export const EXAMPLES_NOTE = 'Examples from a separate reference set, not from your cases.';
/** The small "i" next to a finding name. */
export function InfoButton({ label, display, dark = false }: { label: string; display?: string; dark?: boolean }) {
const name = display ?? labelDisplay(label);
return (
);
}
function Film({ film, finding, caption, showOutline, alt, small = false }: {
film: ReferenceFilm; finding?: ReferenceExample['finding']; caption: string; showOutline: boolean; alt: string; small?: boolean;
}) {
const [failed, setFailed] = useState(false);
const pts = finding?.polygon?.map(([x, y]) => `${x},${y}`).join(' ');
const b = finding?.bbox;
return (