Commit Graph

48 Commits

Author SHA1 Message Date
Gustavo Henrique Santos Souza de Miranda ec053d8126 fix: stop state ping-pong by removing broadcastStateRefresh from auto-persist
The CRDT auto-persist was broadcasting state-refresh after each save, causing
other clients to fetch from DB and overwrite their local variables/characters
with stale values. Since CRDT already syncs nodes/edges via yjs-update
broadcasts, the state-refresh from auto-persist was redundant and destructive.
Manual save still broadcasts state-refresh as intended.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 18:46:59 -03:00
Gustavo Henrique Santos Souza de Miranda cd73b31739 fix: improve realtime connection resilience with auto-reconnect and activity-based lifecycle
Add connection timeout (15s) to handle stale initial subscribes, inactivity
pause (5min) to save resources when idle, and automatic resume on user activity
or tab focus. The heartbeat now detects unhealthy channel states and consecutive
failures to trigger reconnects. Unexpected CLOSED status also triggers reconnect
instead of staying disconnected silently.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 18:20:41 -03:00
Gustavo Henrique Santos Souza de Miranda eb86ccd291 feat: notify collaborators to refresh from DB after save
Instead of relying on Yjs broadcast serialization (which has delivery
issues), use a lightweight state-refresh broadcast event. When any
client persists (manual save or CRDT auto-persist), it broadcasts
state-refresh. Other clients fetch the latest flowchart_data from the
database and update their local state and CRDT.

Added isSuppressed flag to CRDTManager to prevent broadcast/persist
loops during initialization and refresh operations.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 16:36:43 -03:00
Gustavo Henrique Santos Souza de Miranda cdaae6b965 feat: broadcast full CRDT state to other clients after manual save
When a user saves, the full Yjs document state is broadcast so all
connected clients converge, even if they missed incremental updates.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 16:12:58 -03:00
Gustavo Henrique Santos Souza de Miranda 34815d70ee fix: resolve CRDT collaboration sync by registering broadcast listener before channel subscribe
The yjs-update broadcast listener was added after the Supabase channel
was already subscribed, which meant it never received messages. Moved
the listener registration to the builder chain before .subscribe()
(matching how cursor/node-lock listeners work), and removed the broken
isRemoteUpdateRef guard that caused ReferenceErrors preventing local
changes from reaching the CRDT.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 16:08:32 -03:00
Gustavo Henrique Santos Souza de Miranda 315e34e25e feat: [US-053] - Revert changes from audit trail
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 02:57:36 -03:00
Gustavo Henrique Santos Souza de Miranda f06a30b2bf feat: [US-052] - Activity history sidebar
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 02:53:31 -03:00
Gustavo Henrique Santos Souza de Miranda 6ef5cfc7fa feat: [US-051] - Audit trail recording
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 02:46:52 -03:00
Gustavo Henrique Santos Souza de Miranda 4a85d7a64b feat: [US-049] - Node editing lock indicators
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 02:43:06 -03:00
Gustavo Henrique Santos Souza de Miranda ccb05e3a3e feat: [US-050] - Join/leave notifications
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 21:08:05 -03:00
Gustavo Henrique Santos Souza de Miranda 7fe10544a1 feat: [US-047] - Live cursor positions on canvas
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 21:03:17 -03:00
Gustavo Henrique Santos Souza de Miranda fa336f05d9 fix: restore missing utilities, context menu, and props from failed merge
The merge at bcbad57 lost utility functions, type definitions, and
handlers from the developing branch. This restores: imports (useRef,
useEffect, ConditionalEdge, ContextMenu), constants (AUTOSAVE_DEBOUNCE_MS),
types (ContextMenuState, ConditionEditorState), utility functions
(fromReactFlowNodes, fromReactFlowEdges, saveDraft, loadDraft, clearDraft,
flowchartDataEquals, isValidFlowchartData, convertToRenpyFormat), context
menu handlers, proper FlowchartEditorProps (userId, userDisplayName,
isOwner), ReactFlow container height (h-screen), and fixes stale closure
dependency arrays for characters/variables.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 20:54:29 -03:00
Gustavo Henrique Santos Souza de Miranda bcbad57aa9 Merge branch 'developing' into ralph/collaboration-and-character-variables 2026-01-23 15:59:17 -03:00
Gustavo Henrique Santos Souza de Miranda 6b7b27236f feat: [US-048] - Integrate Yjs CRDT for conflict-free node/edge synchronization
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 15:46:39 -03:00
Gustavo Henrique Santos Souza de Miranda f92fc1ad01 feat: [US-046] - Presence indicators for active collaborators
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 15:42:07 -03:00
Gustavo Henrique Santos Souza de Miranda 37031c3889 feat: [US-044] - Project sharing and collaborator management
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 15:36:58 -03:00
Gustavo Henrique Santos Souza de Miranda 2e313a0264 feat: [US-045] - Supabase Realtime channel and connection management
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 15:28:23 -03:00
Gustavo Henrique Santos Souza de Miranda 0d72471f8f feat: [US-064] - Export validation for undefined references
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 15:21:09 -03:00
Gustavo Henrique Santos Souza de Miranda 190e25228b fix: accepted git conflicts 2026-01-23 12:42:51 -03:00
Gustavo Henrique Santos Souza de Miranda a3e1d1cea2 feat: [US-063] - Import characters/variables from another project
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 10:47:38 -03:00
Gustavo Henrique Santos Souza de Miranda b570dca1b8 feat: [US-062] - Auto-migration of existing free-text values
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 10:42:40 -03:00
Gustavo Henrique Santos Souza de Miranda 92d892fb73 feat: [US-061] - Choice option condition variable dropdown
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 10:36:16 -03:00
Gustavo Henrique Santos Souza de Miranda b4b9f8cec9 feat: [US-060] - Edge condition variable dropdown
Replace the variableName text input in edge conditions with a
Combobox-based variable selector. Adds ConditionEditor modal
that opens on edge click, with type-aware operators (comparison
for numeric, == and != for string/boolean) and type-adaptive
value inputs (number, text, or boolean toggle).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 10:30:42 -03:00
Gustavo Henrique Santos Souza de Miranda 5493adf44a feat: [US-059] - Variable node variable dropdown
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 10:25:57 -03:00
Gustavo Henrique Santos Souza de Miranda 2ef605c0ca feat: [US-056] - Character management UI in project settings
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 04:31:42 -03:00
Gustavo Henrique Santos Souza de Miranda ff52df2c28 feat: [US-040] - Conditionals on choice options
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 23:47:39 -03:00
Gustavo Henrique Santos Souza de Miranda b9d778b379 feat: [US-039] - Loading and error states
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 23:06:43 -03:00
Gustavo Henrique Santos Souza de Miranda b3f7a57623 feat: [US-038] - Unsaved changes warning
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 23:03:34 -03:00
Gustavo Henrique Santos Souza de Miranda f8f8048e53 feat: [US-037] - Export to Ren'Py JSON format
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 18:26:25 -03:00
Gustavo Henrique Santos Souza de Miranda ee0a6f9424 feat: [US-036] - Import project from .vnflow file
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 18:23:02 -03:00
Gustavo Henrique Santos Souza de Miranda 78479f3234 feat: [US-035] - Export project as .vnflow file
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 18:20:18 -03:00
Gustavo Henrique Santos Souza de Miranda 01f5428dd9 feat: [US-034] - Save project to database
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 18:17:33 -03:00
Gustavo Henrique Santos Souza de Miranda f6ab24c5b3 feat: [US-033] - Auto-save to LocalStorage
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 18:14:49 -03:00
Gustavo Henrique Santos Souza de Miranda c431b212ac feat: [US-032] - Display conditions on edges
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 18:11:28 -03:00
Gustavo Henrique Santos Souza de Miranda fda0903872 feat: [US-031] - Condition editor modal
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 18:08:37 -03:00
Gustavo Henrique Santos Souza de Miranda 5b404cbe92 feat: [US-030] - Right-click context menu
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 18:04:54 -03:00
Gustavo Henrique Santos Souza de Miranda 4c7a289714 feat: [US-029] - Select and delete edges
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 17:21:27 -03:00
Gustavo Henrique Santos Souza de Miranda 82d437eb0c feat: [US-028] - Select and delete nodes
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 17:18:27 -03:00
Gustavo Henrique Santos Souza de Miranda 7270d72fa4 feat: [US-027] - Connect nodes with edges
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 14:46:02 -03:00
Gustavo Henrique Santos Souza de Miranda e9916d9897 feat: [US-026] - Add variable node from toolbar
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 14:44:11 -03:00
Gustavo Henrique Santos Souza de Miranda 1ad3c183a7 feat: [US-025] - Create custom variable node component
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 12:58:20 -03:00
Gustavo Henrique Santos Souza de Miranda 4355601bdb feat: [US-023] - Add choice node from toolbar
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 12:54:18 -03:00
Gustavo Henrique Santos Souza de Miranda 91b627907b feat: [US-022] - Create custom choice node component
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 12:52:47 -03:00
Gustavo Henrique Santos Souza de Miranda 99e2d5aa15 feat: [US-021] - Add dialogue node from toolbar
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 12:50:20 -03:00
Gustavo Henrique Santos Souza de Miranda e31a0b7bae feat: [US-020] - Create custom dialogue node component
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 12:47:35 -03:00
Gustavo Henrique Santos Souza de Miranda 9aa2aa48f0 feat: [US-019] - Editor toolbar
Add toolbar component with buttons for adding nodes (Dialogue, Choice,
Variable) and managing projects (Save, Export, Import). Buttons are
styled with TailwindCSS and wired to placeholder handlers.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 12:45:11 -03:00
Gustavo Henrique Santos Souza de Miranda 25627ddb0f feat: [US-018] - Canvas pan and zoom controls
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 12:43:20 -03:00
Gustavo Henrique Santos Souza de Miranda db742e7fe8 feat: [US-017] - Editor page with React Flow canvas
Implement the flowchart editor page with React Flow integration:
- Install reactflow package for canvas rendering
- Create editor page that fetches project data from Supabase
- Add loading state with spinner while fetching
- Handle unauthorized access and not found with appropriate responses
- Render React Flow canvas with grid background
- Add header with project name and back link to dashboard
- Initialize React Flow with nodes and edges from flowchart_data
- Add type converters for FlowchartNode/Edge to React Flow types

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 12:41:08 -03:00