import {
fingeringMarks,
fingeringProse,
type Fingering,
} from "@/lib/fingering";
type HoleState = Fingering["holes"][number];
function Hole({
cx,
cy,
r,
state,
}: {
cx: number;
cy: number;
r: number;
state: HoleState;
}) {
return (
{state === "closed" ? : null}
{state === "half" ? (
) : null}
);
}
export function FingeringDiagram({
fingering,
pitch,
size = "lg",
}: {
fingering: Fingering | null;
pitch: string;
size?: "lg" | "sm";
}) {
const width = size === "lg" ? 112 : 88;
if (!fingering) {
return (
Outside C5–D7. No fingering.
);
}
const [h1, h2, h3, h4, h5, h6a, h6b, h7a, h7b] = fingering.holes;
const label = `${pitch}. ${fingeringProse(fingering)}. ${fingeringMarks(fingering).join(", ")}`;
return (
);
}
export function RestMark({ label }: { label: string }) {
const kind = label.includes("whole")
? "whole"
: label.includes("half")
? "half"
: label.includes("sixteenth")
? "sixteenth"
: label.includes("eighth")
? "eighth"
: "quarter";
return (
);
}