From f61e852d45dcf3ad9264fbc033c2c20179fdfc66 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sun, 10 Aug 2025 06:16:25 +0000 Subject: [PATCH] Improve graph layout and edge labels The graph has been adjusted to occupy the full width, reducing crowding. Edge labels have been clarified to explain the meaning of duplicate icons, such as two bones or two flowers side-by-side. --- src/components/DogsBunnyPuzzle.tsx | 108 ++++++++++++----------------- 1 file changed, 46 insertions(+), 62 deletions(-) diff --git a/src/components/DogsBunnyPuzzle.tsx b/src/components/DogsBunnyPuzzle.tsx index 9422319..603b553 100644 --- a/src/components/DogsBunnyPuzzle.tsx +++ b/src/components/DogsBunnyPuzzle.tsx @@ -53,14 +53,14 @@ const DogsBunnyPuzzle: React.FC = ({ const generatePuzzle = useCallback((diff: string, puzzleSeed?: string): PuzzleState => { const rng = puzzleSeed ? seededRandom(puzzleSeed) : Math.random; - // Create locations in a circular/connected pattern + // Create locations in a circular/connected pattern using more space const locations: Location[] = [ - { id: 'loc1', type: 'carrot', x: 150, y: 50 }, - { id: 'loc2', type: 'bone', x: 350, y: 100 }, - { id: 'loc3', type: 'flower', x: 400, y: 250 }, - { id: 'loc4', type: 'well', x: 300, y: 350 }, - { id: 'loc5', type: 'empty', x: 150, y: 350 }, - { id: 'loc6', type: 'empty', x: 50, y: 250 }, + { id: 'loc1', type: 'carrot', x: 100, y: 80 }, + { id: 'loc2', type: 'bone', x: 450, y: 120 }, + { id: 'loc3', type: 'flower', x: 520, y: 300 }, + { id: 'loc4', type: 'well', x: 400, y: 450 }, + { id: 'loc5', type: 'empty', x: 150, y: 450 }, + { id: 'loc6', type: 'empty', x: 50, y: 300 }, ]; // Create characters - bunnies start away from carrot, dog away from bone @@ -344,8 +344,8 @@ const DogsBunnyPuzzle: React.FC = ({
{/* Edges */} @@ -369,69 +369,53 @@ const DogsBunnyPuzzle: React.FC = ({ strokeWidth={isValid ? "3" : "1"} strokeDasharray={isValid ? "none" : "5,5"} /> - {/* Condition labels */} - {edge.conditions.length === 1 ? ( - // Single condition - use circle with red outline for negated - + {/* Condition labels - simplified to show first condition only */} + + {edge.conditions.length === 1 ? ( + // Single condition - - {getConditionIcon(edge.conditions[0])} - - {formatCondition(edge.conditions[0])} - - ) : ( - // Multiple conditions - use rounded rectangle - + ) : ( + // Multiple conditions - show as rounded rectangle with dots c.includes('NOBODY')) ? "#ef4444" : "hsl(var(--border))"} + strokeWidth="2" /> - {edge.conditions.slice(0, 3).map((condition, condIndex) => ( - - {getConditionIcon(condition)} - - ))} - {edge.conditions.length > 3 && ( - - +{edge.conditions.length - 3} - - )} - {edge.conditions.map(formatCondition).join(', ')} - - )} + )} + + {getConditionIcon(edge.conditions[0])} + + {edge.conditions.length > 1 && ( + + +{edge.conditions.length - 1} + + )} + {edge.conditions.map(formatCondition).join(' AND ')} + ); })}