Commit Graph

13 Commits

Author SHA1 Message Date
Jeff Emmett 501ef48e53 Add Docker deployment configuration
- Dockerfile for Next.js static export with nginx
- nginx.conf with proper SPA routing (try_files fallback)
- docker-compose.yml with Traefik labels for post-appitalism.app

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 11:13:34 -08:00
Jeff Emmett 4d47acf5c3
Merge pull request #1 from LinuxIsCool/main
Add Threshold-based flow funding demos.
2025-11-27 10:47:22 -08:00
Shawn Anderson 3a5c6ec289 Merge branch 'main' of github.com:LinuxIsCool/post-app-website-new 2025-11-24 16:06:27 -08:00
Shawn Anderson a7213aa0d4 Demo updates. 2025-11-24 16:05:47 -08:00
Jeff Emmett c25fe838e2 Add GitHub to Gitea mirror workflow
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 18:02:14 -08:00
Shawn Anderson cccb6cc20e Fix progressive outflow formula: ensure monotonic increase
Fixed critical bug where outflow would decrease when crossing from
building to capacity zone. The original formula caused a discontinuity.

**Problem:**
Old formula had outflow jumping from (inflow × ratio) in building zone
to (inflow - max) in capacity zone, causing outflow to DROP when
crossing the threshold.

Example (min=100, max=300):
- At inflow=300: outflow = 300 (100% sharing)
- At inflow=301: outflow = 1 (sudden drop!)

**Solution:**
1. Changed capacity threshold from max to 1.5 × max
2. Building zone now uses linear interpolation from 0 to 0.5 × max
3. Capacity zone retains max and shares all excess

New formula guarantees:
✓ Monotonically increasing outflow as inflow increases
✓ Continuous at all zone boundaries
✓ At inflow = min → outflow = 0
✓ At inflow = 1.5 × max → outflow = 0.5 × max
✓ At inflow > 1.5 × max → retain max, share excess

Zones:
- Deficit (inflow < min): outflow = 0
- Building (min ≤ inflow < 1.5×max): progressive linear growth
- Capacity (inflow ≥ 1.5×max): outflow = inflow - max

Changes:
- lib/flow-v2/engine-v2.ts: Updated getFlowZone() and calculateOutflow()

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-10 11:44:19 -08:00
v0 5ca7c44c2a feat: remove HybridLogo component entirely
Site now uses text-only branding without logo graphics.

#VERCEL_SKIP

Co-authored-by: Jeff Emmett <46964190+Jeff-Emmett@users.noreply.github.com>
2025-11-10 03:53:47 +00: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 86c7bf18e7 feat: clarify economic critique of app silos
Add "(and ultimately of capitalism)" to appitalism reference.

#VERCEL_SKIP

Co-authored-by: Jeff Emmett <46964190+Jeff-Emmett@users.noreply.github.com>
2025-11-02 04:29:30 +00:00
v0 49388622b0 chore: sync main changes into post-app-website-new
Update project files, components, and assets from main branch.

#VERCEL_SKIP

Co-authored-by: Jeff Emmett <46964190+Jeff-Emmett@users.noreply.github.com>
2025-11-02 04:15:06 +00: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