/** * Drill's card area, in the same 84px box Explore uses for its info card. * * Three states: asking you to press a combo, asking you to name one, or showing * the verdict. Feedback is orange or an outline — the palette has no green or red. */ import { comboParts } from "../domain/format"; import type { Entry } from "../domain/types"; import type { DrillState } from "./drillReducer"; import { cx } from "./cx"; import styles from "./DrillCard.module.css"; export interface DrillCardProps { readonly state: DrillState; readonly onCheck: () => void; readonly onClear: () => void; readonly onReveal: () => void; readonly onNext: () => void; readonly onPickOption: (name: string) => void; } function Chips({ entry }: { entry: Entry }) { return ( {comboParts(entry).map((part, i) => ( {i > 0 ? + : null} {part} ))} ); } export function DrillCard({ state, onCheck, onClear, onReveal, onNext, onPickOption, }: DrillCardProps) { const { card, chord, answered, lastCorrect, direction, input } = state; if (!card) { return (

No cards in this deck.

); } if (answered) { return (
{lastCorrect ? "CORRECT" : "NOT QUITE"} P.{card.page}

{card.desc || card.name}

); } if (direction === "name") { return (
WHICH IS IT?
{state.options.map((name) => ( ))}
); } return (
{input === "hold" ? "HOLD THE COMBO" : "TAP EACH, THEN CHECK"}

{card.name}

{chord.length === 0 ? "—" : chord.join(" + ").toUpperCase()} {input === "tap" ? ( ) : null}
); }