kasuti: grey-tint both fabrics on a dead-end

Lifted the legal-stitches check into a deadEnd flag shared by the
banner and both fabric panels. When the user runs out of legal moves
on the active side, both SVG canvases fade to bg-muted (a light grey)
with a smooth transition — a passive cue to match the existing amber
banner.

https://claude.ai/code/session_01KNdXjQczMCRGMK7K3Qderw
This commit is contained in:
Claude 2026-04-22 10:02:05 +00:00
parent 34679d1ae1
commit aad29dd832
No known key found for this signature in database

View file

@ -743,6 +743,7 @@ const KasutiEmbroidery: React.FC = () => {
const totalEdges = placed.edges.length; const totalEdges = placed.edges.length;
const frontRemaining = totalEdges - drawnFront.size; const frontRemaining = totalEdges - drawnFront.size;
const backRemaining = totalEdges - drawnBack.size; const backRemaining = totalEdges - drawnBack.size;
const deadEnd = !completed && currentVertex !== null && legalNextVertices.length === 0;
return ( return (
<div className="w-full max-w-5xl mx-auto p-4 space-y-6"> <div className="w-full max-w-5xl mx-auto p-4 space-y-6">
@ -868,6 +869,7 @@ const KasutiEmbroidery: React.FC = () => {
legalNext={legalNextVertices} legalNext={legalNextVertices}
canStartAt={canStartAt} canStartAt={canStartAt}
completed={completed} completed={completed}
deadEnd={deadEnd}
remaining={frontRemaining} remaining={frontRemaining}
/> />
<FabricPanel <FabricPanel
@ -889,6 +891,7 @@ const KasutiEmbroidery: React.FC = () => {
legalNext={legalNextVertices} legalNext={legalNextVertices}
canStartAt={canStartAt} canStartAt={canStartAt}
completed={completed} completed={completed}
deadEnd={deadEnd}
remaining={backRemaining} remaining={backRemaining}
/> />
</div> </div>
@ -900,7 +903,7 @@ const KasutiEmbroidery: React.FC = () => {
</div> </div>
)} )}
{!completed && currentVertex && legalNextVertices.length === 0 && ( {deadEnd && (
<div className="text-center p-4 rounded-xl bg-amber-100 dark:bg-amber-900/30 border border-amber-500 text-amber-800 dark:text-amber-200 text-sm"> <div className="text-center p-4 rounded-xl bg-amber-100 dark:bg-amber-900/30 border border-amber-500 text-amber-800 dark:text-amber-200 text-sm">
No legal stitches from here on the {activeSide}. Undo a step or reset to try a No legal stitches from here on the {activeSide}. Undo a step or reset to try a
different route. different route.
@ -931,6 +934,7 @@ interface FabricPanelProps {
legalNext: V[]; legalNext: V[];
canStartAt: (v: V) => boolean; canStartAt: (v: V) => boolean;
completed: boolean; completed: boolean;
deadEnd: boolean;
remaining: number; remaining: number;
} }
@ -950,6 +954,7 @@ const FabricPanel: React.FC<FabricPanelProps> = ({
legalNext, legalNext,
canStartAt, canStartAt,
completed, completed,
deadEnd,
remaining, remaining,
}) => { }) => {
const isActive = activeSide === side && !completed; const isActive = activeSide === side && !completed;
@ -1030,7 +1035,9 @@ const FabricPanel: React.FC<FabricPanelProps> = ({
<svg <svg
width={SVG_DIM} width={SVG_DIM}
height={SVG_DIM} height={SVG_DIM}
className="rounded-lg bg-card" className={`rounded-lg transition-colors ${
deadEnd ? 'bg-muted' : 'bg-card'
}`}
style={{ style={{
outline: '1px solid var(--border)', outline: '1px solid var(--border)',
}} }}