Commit Graph

7 Commits

Author SHA1 Message Date
Jeff Emmett bd5f92c7b3 Add newsletter signup component to homepage
The NewsletterSignup component was created but never added to the page.
This adds it between the CTA section and footer.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 19:03:03 +01:00
Jeff Emmett f0c5df1d86 Add Open Graph and Twitter Card metadata for social sharing
- Add og-image.jpg (1200x630) for link previews
- Add metadataBase, openGraph, and twitter metadata to layout.tsx

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 22:12:17 +01:00
Shawn Anderson a7213aa0d4 Demo updates. 2025-11-24 16:05:47 -08:00
Shawn Anderson a55cec9958 Implement Flow Funding V2: Continuous flow dynamics with progressive outflow
This commit adds a complete v2 implementation of the flow funding mechanism
with continuous flow dynamics, progressive outflow zones, and real-time
interactive visualization.

## V2 Implementation (New - Today's Work)

### Core Engine (/lib/flow-v2/)
- types.ts: Flow-oriented type system with FlowNode, FlowNetwork, FlowZone
- engine-v2.ts: Steady-state equilibrium solver with progressive outflow
  - Progressive zones: deficit (keep all), building (progressive share), capacity (redirect excess)
  - Iterative convergence algorithm
  - Dual time scale: per-second implementation, per-month UI
- scenarios-v2.ts: 5 preset networks demonstrating various topologies

### Interactive UI (/app/flow-v2/)
- Real-time external inflow sliders (0-$2000/mo per node)
- Dynamic edge width visualization based on flow rate (logarithmic scaling)
- Animated flow particles showing money movement (60 FPS)
- Zone-based node coloring: red (deficit), amber (building), green (capacity)
- Network overflow node (pure sink for unallocatable overflow)
- Comprehensive metrics: per-node and network-level statistics
- Play/pause animation controls
- Click-to-select node highlighting

### Key Features
- Progressive outflow formula implementing the water metaphor:
  * Deficit: outflow = 0
  * Building: outflow = inflow × ((inflow - min) / (max - min))
  * Capacity: outflow = inflow - max
- Steady-state convergence typically in 10-50 iterations
- Fully isolated implementation - no impact on existing routes

## V1 Implementation (Previous Session)

### Core Engine (/lib/flow-funding/)
- Discrete distribution algorithm with phases:
  * Initial distribution (prioritize minimums, fill capacity)
  * Overflow calculation and redistribution
  * Iterative convergence
- Network validation
- 5 preset scenarios

### UI Components
- /app/flowfunding/: Interactive v1 demo with animations
- /app/tbff/: Alternative visualization
- Timeline with time-travel
- Targeted funding mode (click-to-fund)
- Flow particle animations

## Routes
- /flow-v2: V2 continuous flow dynamics demo (NEW)
- /flowfunding: V1 discrete distribution demo
- /tbff: Alternative v1 visualization

All implementations are self-contained and don't affect other parts of the system.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-09 12:59:52 -08:00
Shawn Anderson de07dabb36 feat: implement undo/redo functionality with keyboard shortcuts
Implemented a clean, working undo/redo system using useRef to avoid React state management issues.

## Features Added
- **Undo**: Ctrl+Z (Cmd+Z on Mac) to undo the last action
- **Redo**: Ctrl+Shift+Z (Cmd+Shift+Z on Mac) to redo
- **Delete**: Delete key to remove selected shape
- **Escape**: Escape key to deselect
- UI buttons for undo/redo with proper enabled/disabled states

## Technical Implementation
- Uses `useRef` instead of `useState` for history to avoid stale closures
- Deep clones shapes when saving to prevent reference issues
- Maintains up to 50 history states (auto-prunes oldest)
- Properly initializes history with current canvas state on mount
- Uses `e.code === 'KeyZ'` for keyboard detection (shift-independent)
- Includes propagator cleanup when deleting arrows via Delete key

## Key Design Decisions
- **useRef over useState**: Avoids complex state synchronization and stale closure bugs
- **Deep cloning**: JSON.parse(JSON.stringify()) ensures each history entry is independent
- **Initialization guard**: Prevents saving to history before component fully initializes
- **Force re-render**: Uses dummy state update to refresh button disabled states

## Architecture
```typescript
historyRef.current = [state0, state1, state2, ...]
historyIndexRef.current = currentIndex
```

Operations:
- saveToHistory(): Truncates future, adds new state, increments index
- undo(): Decrements index, restores previous state
- redo(): Increments index, restores next state

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-09 11:07:29 -08:00
Shawn Anderson 97a4eee6f0 feat: implement Phase 1 - live arrows with propagators
Major features:
- Functional arrows that propagate values between shapes
- Arrow drawing with snap-to-shape centers
- Arrow selection with visual highlighting (cyan, 4px)
- Propagator system (inline FolkJS-inspired implementation)
- Shape value editor and arrow expression editor
- Test Propagation button to trigger data flow

Critical bug fixes:
- EventTarget storage in separate Map to survive React state updates
- Stale closure fix using functional setState pattern
- Negative dimension normalization for rectangles
- Arrow hit detection using point-to-line distance algorithm
- Propagator cleanup on arrow deletion

Code quality improvements:
- Extracted isPointInShape() helper (removed ~30 lines duplication)
- Added HIT_TOLERANCE constant (no magic numbers)
- Removed debug logging after troubleshooting
- Proper resource cleanup (dispose propagators)

Documentation:
- Created CANVAS_DEVELOPMENT_GUIDE.md (comprehensive technical reference)
- Created SESSION_2025-11-07.md (session journal with lessons learned)
- Updated README.md (project overview with 6-phase roadmap)
- Updated CLAUDE.md (added Development Journal section)
- All docs moved to .claude/journal/

Technical discoveries documented:
1. React state immutability & EventTarget storage pattern
2. Stale closure pattern in event handlers
3. Negative dimensions bug in canvas drawing
4. Point-to-line distance algorithm for hit detection
5. Code organization best practices

Files modified:
- app/italism/page.tsx: 769 lines (+150 net)
- README.md: Complete rewrite with practical info
- package.json: TypeScript config updates
- tsconfig.json: Next.js auto-updates

Status: Phase 1 Complete 
Next: Phase 2 (expression parser, arrow auto-update, flow animation)

🤖 Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 17:00:39 -08:00
v0 ec0cf6a4ed Initialized repository for chat Post-Appitalism Website
Co-authored-by: Jeff Emmett <46964190+Jeff-Emmett@users.noreply.github.com>
2025-11-02 04:01:46 +00:00