Commit Graph

651 Commits

Author SHA1 Message Date
Jeff Emmett 3cda68370e fix: improve admin request button error handling
- Added adminRequestError state to track request failures
- Parse and display server error messages to user
- Show red error button with retry option on failure
- Display error message below button explaining what went wrong

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 00:55:46 -05:00
Jeff Emmett 3a788539f7 fix: make share and settings dropdowns opaque
- Use explicit background colors instead of CSS variables
- Add dark mode detection to ShareBoardButton
- Prevents see-through dropdowns

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 00:01:59 -05:00
Jeff Emmett f2fc6f47d3 fix: register MycroZineGenerator shape with automerge schema
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 23:59:21 -05:00
Jeff Emmett d887a77de5 test: trigger webhook deploy 2025-12-19 23:49:44 -05:00
Jeff Emmett 98d460f95e feat: add Show Tutorial button, temporarily disable NetworkGraphPanel
- Add "Show Tutorial" button to mobile menu to trigger onboarding tour
- Comment out NetworkGraphPanel for main branch (code preserved)
- Add class name to CryptID dropdown for tour targeting

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 18:57:42 -05:00
Jeff Emmett 6a85381a6c feat: add onboarding tooltip tour for new users
- Create 6-step spotlight tour covering key features:
  - Local-first storage
  - Encrypted identity (CryptID)
  - Share & collaborate
  - Creative toolkit
  - Mycelial Intelligence
  - Keyboard shortcuts

- Features:
  - Auto-starts for first-time users (1.5s delay)
  - Spotlight effect with darkened backdrop
  - Keyboard navigation (Escape, arrows, Enter)
  - "Show Tutorial" button in settings (desktop + mobile)
  - Dark mode support
  - Progress dots indicator

- New files: src/ui/OnboardingTour/{index,OnboardingTour,TourTooltip,tourSteps}.ts(x)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 18:10:23 -05:00
Jeff Emmett 09eb17605e feat: mobile UI improvements + staging deployment setup
- Remove anonymous viewer popup (anonymous users can now edit)
- Mobile menu consolidation: gear icon with all menus combined
- Connection status notifications below MI bar (Offline use, Reconnecting, Live)
- Network graph panel starts collapsed on mobile
- MI bar positioned at top on mobile

Deployment:
- Add docker-compose.dev.yml for staging.jeffemmett.com (dev branch)
- Update production docker-compose.yml to remove staging route

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 15:14:05 -05:00
Jeff Emmett db070f47ee fix: resolve Three.js Text component error and modal close issues
- Downgrade three.js from 0.182 to 0.168 to fix customDepthMaterial
  getter-only property breaking change (drei issue #2403)
- Add stable useCallback for modal close handler to prevent
  reference instability
- Improve ESC key handler with ref pattern and capture phase
  to ensure reliable modal closing

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 15:08:55 -05:00
Jeff Emmett 0e7b0aa44f docs: update MycroZine task notes with RunPod proxy fix
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 23:21:24 -05:00
Jeff Emmett 7bfc6ff576 feat: route MycroZine image generation through RunPod proxy
- Updated generatePageImage to use zine.jeffemmett.com API
- Removed direct Gemini API calls (were geo-blocked in EU)
- Now uses RunPod US-based proxy for reliable image generation
- Fixed TypeScript types for API responses

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 23:18:13 -05:00
Jeff Emmett 8cf0bad804 feat: Gemini image generation for MycroZine + Tailscale dev support
MycroZine Generator:
- Implement actual Gemini image generation (replaces placeholders)
- Use Nano Banana Pro (gemini-2.0-flash-exp-image-generation) as primary
- Fallback to Gemini 2.0 Flash experimental
- Graceful degradation to placeholder if no API key

Client Config:
- Add geminiApiKey to ClientConfig interface
- Add isGeminiConfigured() and getGeminiConfig() functions
- Support user-specific API keys from localStorage

Local Development:
- Fix CORS to allow Tailscale IPs (100.x) and all private ranges
- Update cryptidEmailService to use same host for worker URL on local IPs
- Supports localhost, LAN (192.168.x, 10.x, 172.16-31.x), and Tailscale

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 21:35:20 -05:00
Jeff Emmett 525ea694b5 feat: add PWA support for offline cold load
- Add vite-plugin-pwa with Workbox caching strategy
- Cache all static assets (JS, CSS, HTML, fonts, WASM)
- Enable service worker in dev mode for testing
- Add PWA manifest with app name and icons
- Add SVG icons for PWA (192x192 and 512x512)
- Increase cache limit to 10MB for large chunks (Board ~8MB)
- Add runtime caching for API responses and Google Fonts

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 21:34:05 -05:00
Jeff Emmett 98a4aee927 feat: 3D network graph with trust clustering and broadcast mode
3D Visualization (NetworkGraph3D):
- Three.js force-directed graph with React Three Fiber
- Trust-level shells: trusted (inner), connected (middle), unconnected (outer)
- Node sizing proportional to decision power (incoming connections)
- Animated particle flows along edges showing delegation direction
- Zoom to user with smooth camera animation
- Orbit controls for 3D navigation (drag rotate, scroll zoom)

Broadcast Mode:
- "View as User" button syncs camera to selected user's view
- Visual indicator at top: "Viewing as [User] - ESC to exit"
- ESC or X key to stop following
- URL deep linking with ?followId parameter

UI Improvements:
- Panel now stacks directly above tldraw minimap
- Matched width (200px) with minimap for alignment
- Fixed D3 simulation stability (was reinitializing every render)
- 3-state display: minimized icon, normal panel, maximized 3D modal

Dependencies:
- three@^0.182.0
- @react-three/fiber@8.17.10 (React 18 compatible)
- @react-three/drei@9.114.3

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 21:06:50 -05:00
Jeff Emmett 0fde2edf05 Create task task-057 2025-12-18 20:10:40 -05:00
Jeff Emmett 13a6445a3d Update task task-055 2025-12-18 18:24:08 -05:00
Jeff Emmett 4ced79aac3 feat: smart backup system - skip unchanged boards
Instead of backing up every board daily (wasteful), we now:
1. Compute SHA-256 content hash for each board
2. Compare against last backed-up hash stored in R2
3. Only backup if content actually changed

Benefits:
- Reduces backup storage by 80-90%
- Enables extending retention beyond 90 days (less storage pressure)
- Each backup represents a real change, not duplicate snapshots
- Hash stored in `hashes/{room.key}.hash` for fast comparison

The cron still runs daily at midnight UTC, but now only boards
with actual changes get new backup entries.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 17:10:10 -05:00
Jeff Emmett 00a21f9610 feat: add worker unit tests for board permissions
Comprehensive test coverage for the board permissions system:
- handleGetPermission (authenticated/unauthenticated users)
- handleListPermissions (admin filtering)
- handleGrantPermission (editor assignment)
- handleRevokePermission (editor removal)
- handleUpdateBoard (protected status, global access)
- handleCreateAccessToken (security validation)
- handleListAccessTokens (admin-only access)
- handleRevokeAccessToken (token deletion)
- handleGetGlobalAdminStatus (admin checks)
- handleGetBoardInfo (board metadata)
- handleListEditors (editor listing)

Tests cover key security scenarios:
- Anonymous users get edit on new boards (permission model)
- Protected boards require authentication
- Access tokens cannot grant admin permissions
- View permission returned when database unavailable (secure default)

30 tests total, all passing.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 02:58:22 -05:00
Jeff Emmett 4f6ff1797f feat: add worker unit tests for CryptID auth handlers
- Create 25 unit tests for CryptID authentication handlers
- Add vitest.worker.config.ts for worker test environment
- Update CI workflow to run worker tests
- Test coverage for:
  - handleCheckUsername (validation, normalization)
  - handleLinkEmail (validation, database errors)
  - handleVerifyEmail (token validation)
  - handleRequestDeviceLink (validation, 404 handling)
  - handleLinkDevice (token validation)
  - handleLookup (publicKey validation)
  - handleGetDevices (auth validation)
  - handleRevokeDevice (auth and validation)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 02:46:28 -05:00
Jeff Emmett a662b4798f feat: add comprehensive test suite for CRDT, offline storage, and auth
- Add Vitest for unit tests with jsdom environment
- Add Playwright for E2E browser testing
- Create 27 unit tests for WebCrypto and IndexedDB
- Create 27 E2E tests covering:
  - Real-time collaboration (CRDT sync)
  - Offline storage and cold reload
  - CryptID authentication flows
- Add CI/CD workflow with coverage gates
- Configure test scripts in package.json

Test Results:
- Unit tests: 27 passed
- E2E tests: 26 passed, 1 flaky

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 02:42:01 -05:00
Jeff Emmett 8648a37f6f Update task task-056 2025-12-18 02:26:01 -05:00
Jeff Emmett 27cfc2d9e6 Create task task-056 2025-12-18 02:25:49 -05:00
Jeff Emmett 678df2bbca fix: properly reset pin state to prevent shape jumping on re-pin
When pinning a shape again after unpinning, leftover state from the
previous session was causing the shape to jump/resize unexpectedly.

Changes:
- Add clearPinState() helper to reset all refs and cancel animations
- Add cleanShapeMeta() helper to remove all pin-related meta properties
- Clear all state immediately when pinning starts (before setting new state)
- Clear refs immediately when unpinning (not in setTimeout)
- Remove pinnedAtZoom from meta cleanup (legacy from CSS scaling)
- Don't call updatePinnedPosition() on pin start - shape is already
  at correct position, only need to listen for future camera changes

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 19:57:21 -05:00
Jeff Emmett 1bde78bb29 fix: use store.listen for zero-lag pinned shape updates
Replace tick event with store.listen to react synchronously when the
camera record changes. This eliminates the one-frame delay that was
causing the shape and its indicator to lag behind camera movements.

Changes:
- Use editor.store.listen instead of editor.on('tick')
- Filter for camera record changes specifically
- Remove position threshold for maximum responsiveness
- Remove unused pinnedAtZoom since CSS scaling was removed

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 19:43:15 -05:00
Jeff Emmett 72c2e52ae7 fix: remove CSS transform scaling from pinned shapes
Pinned shapes should only stay fixed in screen position, not fixed in
visual size. The CSS transform: scale() was causing shapes to appear
differently sized when pinned.

Now pinned shapes:
- Stay at a fixed screen position (don't move when panning)
- Scale normally with zoom (get bigger/smaller like other shapes)
- Don't change appearance when pin is toggled

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 12:11:45 -05:00
Jeff Emmett cc1928852f fix: use tldraw tick event for synchronous pinned shape updates
Replace requestAnimationFrame polling with tldraw's 'tick' event which
fires synchronously with the render cycle. This ensures the pinned shape
position is updated BEFORE rendering, eliminating the visual lag where
the shape appeared to "chase" the camera during zooming.

Changes:
- Use editor.on('tick') instead of requestAnimationFrame polling
- Remove throttling (no longer needed with tick event)
- Reduce position tolerance from 0.5 to 0.01 for more precise tracking
- Simplify code by removing unnecessary camera tracking refs

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 20:12:08 -05:00
Jeff Emmett 6f57c767f4 fix: prevent ValidationError by not setting undefined values in shape.meta
When unpinning a shape, the previous code set pinnedAtZoom, originalX, and
originalY to undefined in shape.meta. This caused a ValidationError because
tldraw requires JSON serializable values (undefined is not valid JSON).

Fixed by using object destructuring to exclude these properties from meta
instead of setting them to undefined.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 20:04:55 -05:00
Jeff Emmett 6e29384a79 fix: improve pinned shape zoom behavior - maintain constant visual size
- Pinned shapes now stay exactly the same size visually during zoom
- Uses CSS transform scale instead of changing w/h props
- Content inside shapes renders identically at all zoom levels
- Stores pinnedAtZoom in shape.meta for reference
- Returns to original position smoothly when unpinned
- Removed size-changing logic that was causing content reflow issues

The transform approach ensures text, UI elements, and all content
inside pinned shapes remain pixel-perfect regardless of canvas zoom.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 20:00:29 -05:00
Jeff Emmett 5d9f41c64b refactor: reorder context menu and remove Collections
- Move "Create Tool" to top of context menu
- Move "Shortcut to Frames" to second position
- Remove "Collections" submenu (functionality still available via keyboard shortcuts)
- Cleaner menu structure prioritizing creation tools

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 19:49:35 -05:00
Jeff Emmett 865d6f7681 feat: replace MycrozineTemplate with MycroZineGenerator in toolbar and context menu
- Updated CustomToolbar.tsx to use MycroZineGenerator tool
- Updated CustomContextMenu.tsx to use MycroZineGenerator in Create Tool submenu
- Updated overrides.tsx with MycroZineGenerator tool definition
- Removed all references to old MycrozineTemplate

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 19:44:08 -05:00
Jeff Emmett 0256f97034 feat: add MycroZine Generator shape with 5-phase workflow
Implements interactive 8-page zine creation tool:
- Phase 1: Ideation - chat UI for topic/content planning
- Phase 2: Drafts - generates 8 pages, spawns on canvas
- Phase 3: Feedback - approve/edit individual pages
- Phase 4: Finalizing - regenerate pages with feedback
- Phase 5: Complete - print layout download, template save

Features:
- Style selector (punk-zine, minimal, collage, retro, academic)
- Tone selector (rebellious, playful, informative, poetic)
- Chat-based ideation workflow
- Page grid with approval/feedback UI
- LocalStorage template persistence
- Punk green (#00ff00) theme

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 19:35:28 -05:00
Jeff Emmett eb778a1848 Update task task-055 2025-12-15 19:34:43 -05:00
Jeff Emmett 30d23ba56f Update task task-055 2025-12-15 19:27:36 -05:00
Jeff Emmett 6db2d9c576 fix: improve backwards compatibility for older JSON imports
- Add validation for highlight shapes (same as draw)
- Improve segment validation to check for NaN/Infinity in point coordinates
- Add more custom shape types to valid shapes list
- Fix arrow shape validation (use start/end props instead of points array)
- Fix line shape validation (uses object format for points, not array)
- Better error messages for invalid shapes

Prevents "No nearest point found" errors when importing older files
with malformed path geometry data.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 19:13:20 -05:00
Jeff Emmett c2469a375d perf: optimize bundle size with lazy loading and dependency removal
- Add route-level lazy loading for all pages (Default, Board, Dashboard, etc.)
- Remove gun, webnative, holosphere dependencies (175 packages removed)
- Stub HoloSphereService for future Nostr integration (keeps h3-js for holon calculations)
- Stub FileSystemContext (webnative removed)
- Defer Daily.co initialization until needed
- Add loading spinner for route transitions
- Remove large-utils manual chunk from vite config

Initial page load significantly reduced - heavy Board component (7.5MB)
now loads on-demand instead of upfront.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 18:59:52 -05:00
Jeff Emmett 356630d8f1 Create task task-055 2025-12-15 18:41:25 -05:00
Jeff Emmett 7d9f63430a Update task task-053 2025-12-15 18:41:25 -05:00
Jeff Emmett 4c51b0a602 Create task task-053 2025-12-15 18:41:10 -05:00
Jeff Emmett 14624b1372 Update task task-054 2025-12-15 18:40:44 -05:00
Jeff Emmett 0dab90d6e6 Update task task-053 2025-12-15 18:40:44 -05:00
Jeff Emmett 6e40934db3 Create task task-054 2025-12-15 18:40:33 -05:00
Jeff Emmett e960f5c061 Create task task-053 2025-12-15 18:40:33 -05:00
Jeff Emmett 173f80600c feat: re-enable Map tool and add GPS location sharing
- Re-enable Map tool in CustomToolbar and CustomContextMenu
- Add GPS location sharing state and UI to MapShapeUtil
- Show collaborator locations on map with colored markers
- Add toggle button to share/stop sharing your location
- Cleanup GPS watch and markers on component unmount

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 18:39:26 -05:00
Jeff Emmett e94ceb39c9 fix: resolve user identity caching issues on logout/login
- Preserve tldraw-user-id-* and crypto keys on logout (prevents duplicate cursors)
- Add session-logged-in event for immediate tool enabling after login
- Add session-cleared event for component state cleanup
- Clear only session-specific data (permissions, graph cache, room ID)
- CryptIDDropdown: reset connections state on logout
- useNetworkGraph: clear graph cache on logout

The key fix is preserving tldraw user IDs across login/logout cycles.
Previously, clearing these IDs caused each login to create a new presence
record while old ones persisted in Automerge, resulting in stacked cursors.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 18:34:41 -05:00
Jeff Emmett 65eee48665 feat: improve keyboard shortcuts UI with Command Palette
- Add openCommandPalette() export function for manual triggering
- Update ? button to open the colorful Command Palette modal instead of dropdown
- Add support for manual opening with Escape and click-outside to close
- Clean up unused shortcut dropdown code and state
- Maintain Ctrl+Shift hold behavior for quick access

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 16:31:35 -05:00
Jeff Emmett eb5698343a Update task task-052 2025-12-15 14:26:10 -05:00
Jeff Emmett 6c81f77ab3 fix: use verified jeffemmett.com domain for admin request emails
Changed from email from 'noreply@canvas.jeffemmett.com' (unverified) to
'Canvas <noreply@jeffemmett.com>' (verified in Resend).

Also added RESEND_API_KEY secret to Cloudflare Worker.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 14:25:44 -05:00
Jeff Emmett b680cc7637 Update task task-052 2025-12-15 13:32:12 -05:00
Jeff Emmett fedd62c87b feat: integrate board protection settings into existing settings dropdown
- Remove separate BoardSettingsDropdown button from UI panel
- Add board protection toggle and editor management to existing settings dropdown
- Show protection section only for admins (board owner or global admin)
- Add ability to toggle view-only mode for protected boards
- Add editor management UI with invite and remove functionality
- Fix TypeScript type annotations for API responses

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 13:05:45 -05:00
Jeff Emmett 6d96c2bbe2 feat: add BoardSettingsDropdown to top-right UI panel
Added the board settings dropdown between ShareBoardButton and StarBoardButton.
Provides access to:
- Board protection toggle (view-only mode)
- Editor management for protected boards
- Admin request functionality

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 12:54:12 -05:00
Jeff Emmett 73071eb6f7 Update task task-052 2025-12-15 12:45:46 -05:00