Skip to content

Latest commit

 

History

History
209 lines (186 loc) · 11.7 KB

File metadata and controls

209 lines (186 loc) · 11.7 KB

BlocklyCollab Build Steps

This document tracks the progress of the BlocklyCollab application from start to finish.

Initial Setup

  • Configured Next.js project with TypeScript
  • Added Blockly library integration
  • Set up basic project structure with pages, components, and styles directories
  • Created basic BlocklyWorkspace component

Collaboration Features

  • Integrated Yjs for real-time collaboration
  • Set up Firebase for persistent data storage
  • Implemented user awareness with cursor tracking
  • Created block serialization and synchronization system
  • Fixed XML data errors in block serialization
  • Improved cursor appearance to look like an actual pointer
  • Enhanced error handling for block synchronization

User Interface

  • Added landing page with modern design highlighting key features
  • Created authentication pages (login and signup)
  • Implemented responsive design for various devices
  • Added feature cards to explain the platform benefits
  • Styled components using CSS modules

Authentication

  • Added Clerk integration for user authentication
  • Implemented official Clerk middleware for route protection
  • Created login and signup pages with Clerk's SignIn and SignUp components
  • Set up protected workspace route with automatic redirects
  • Added UserButton component for account management
  • Configured proper authentication flow with login/signup/logout redirects

Deployment

  • Configured Vercel deployment
  • Set up environment variables for Firebase
  • Fixed production build issues
  • Deployed to custom domain

Current Progress: Enhanced Project Management and UI

  • Implemented a complete project/room management system
  • Created new dashboard page displaying all user's projects
  • Added room history tracking in Firebase for each user
  • Improved workspace UI with better room information display
  • Added user avatars showing participants in each room
  • Enhanced connection status with visual indicators
  • Implemented proper error handling for Firebase quota issues
  • Optimized Firebase usage to reduce quota exceeded errors
  • Added share functionality for easy room collaboration
  • Created improved room joining and creation interface
  • Enhanced real-time updates of room participants

Current Progress: Optimized Firebase and Improved UI

  • Implemented in-memory caching system for Firestore data
  • Reduced write operations with debouncing and throttling techniques
  • Consolidated room state into more efficient document structure
  • Added batched writes for related database operations
  • Improved error messages for quota exceeded scenarios
  • Enhanced user avatars with proper styling and overflow handling
  • Added API endpoint for reliable room cleanup on page exit
  • Used navigator.sendBeacon for better connection cleanup
  • Fixed COOP (Cross-Origin-Opener-Policy) errors in auth flow
  • Improved workspace layout with better visual hierarchy
  • Enhanced connection status indicators with clear visual feedback

Current Progress: Completely Redesigned Cursor Tracking

  • Changed cursor implementation from screen-positioned elements to SVG elements embedded in the Blockly workspace
  • Cursors now properly stay anchored to workspace coordinates rather than screen coordinates
  • Implemented directional indicators for out-of-view cursors that appear at the viewport edge
  • Added click-to-navigate functionality to jump to other users' cursors when they're out of view
  • Cursors now properly scale, rotate, and move with the workspace viewing transformations
  • Fixed cursor position discrepancies between different clients
  • Enhanced error handling and logging for cursor positioning
  • Added proper cleanup for cursor elements and event listeners
  • Cursors now behave like Blockly blocks - they stay in place during panning and zooming

Current Progress: Fixed Deployment Build Errors

  • Implemented missing setupBlocklySync function in collab.ts
  • Added setupCursorTracking function for inter-user awareness
  • Fixed TypeScript errors in function signatures
  • Updated function parameters to match component usage
  • Improved error handling in collaboration setup
  • Enhanced cursor tracking with user identity display
  • Added proper cleanup functions for all event listeners

Current Progress: Implemented File-Based Project Management

  • Created a comprehensive file management system in projects.ts
  • Implemented project creation, retrieval, updating, and deletion functions
  • Added projects.tsx page for users to view and manage their projects
  • Updated workspace.tsx to support loading projects by ID
  • Enhanced BlocklyWorkspace component to handle project XML loading
  • Added proper Firebase security rules for the new collections
  • Fixed serverTimestamp() issues in arrays for Firestore compatibility
  • Added links between dashboard and projects page
  • Improved type safety with proper Timestamp handling
  • Deployed the updated project to Vercel production environment

Current Progress: Enhanced User Signup Flow and Firebase Optimizations

  • Added updateUserProfile function to firebase.ts for updating user profile data
  • Implemented user caching mechanisms in Firebase utility to reduce read operations
  • Updated signup page to collect additional user information (name and school)
  • Removed landing page and redirected users directly to login screen
  • Optimized Firebase reads and writes in collab.ts with proper caching
  • Implemented batch writes for related Firebase operations to improve performance
  • Added throttling and debouncing using lodash to reduce Firebase write operations
  • Fixed TypeScript errors and improved type safety throughout the application
  • Enhanced error handling for Firestore operations with clearer feedback
  • Improved memory management with proper cache expiration policies
  • Created more efficient presence tracking to minimize Firestore operations

Current Progress: Fixed Critical Blockly Collaboration Issues

  • Enhanced setupBlocklySync function with safer Blockly.Xml access patterns
  • Implemented robust fallbacks for accessing Blockly API in production environment
  • Added retry mechanisms for Blockly.Xml method access
  • Fixed WebSocket connection issue with proper URL construction
  • Ensured the room ID is properly formatted for WebSocket connections
  • Improved WebSocket connection logging to aid in debugging

Current Progress: Enhanced Real-time Cursor Tracking

  • Completely rebuilt cursor tracking implementation for better reliability
  • Added explicit cursor visibility through enhanced awareness protocol
  • Implemented throttling for cursor updates to reduce network traffic
  • Improved awareness state initialization to include immediate cursor position
  • Enhanced error handling throughout the cursor tracking functionality
  • Added explicit cleanup of cursor elements when users disconnect
  • Fixed cursor positioning to accurately reflect user's pointer location
  • Added better debugging information to track collaboration status

Current Progress: Improved Cache Invalidation System

  • Fixed issue where newly created rooms wouldn't appear in user's room list until cache expired
  • Implemented cross-module cache invalidation between projects and rooms
  • Added Firestore-based cache invalidation markers to ensure consistent UI state
  • Enhanced getUserRooms function to check for invalidation markers before using cached data
  • Fixed communication between room and project systems to maintain consistent state
  • Improved WebSocket connection handling with simplified room ID format
  • Added proper cleanup of cached state when creating new resources
  • Reduced unnecessary Firestore reads while ensuring data freshness
  • Implemented a timestamp-based cache invalidation strategy for better consistency

Current Progress: Recent Changes and Fixes

  • Added comprehensive error handling to protect users from unexpected crashes
  • Implemented proper file management system in the dashboard
  • Created landing page with information about app features
  • Fixed build errors related to function signatures in collab.ts
  • Updated user presence tracking to use a more efficient userIds array and subcollections pattern
  • Added connection status indicators for better collaboration experience
  • Implemented user metrics tracking with comprehensive permission model
  • Fixed circular dependency issues between modules
  • Added Firestore rules for proper security enforcement
  • Created detailed documentation for development and deployment

Current Progress: WebSocket Server URL Fix

  • Fixed WebSocket connection issues by correcting domain name in client code
  • Updated WebSocket server to properly extract room IDs from URL paths
  • Added CORS support and improved error handling in WebSocket server

Current Progress: Enhanced Cursor Tracking and User Presence

  • Enhanced cursor tracking and user awareness features to improve real-time collaboration
  • Implemented more efficient cursor tracking algorithm to reduce latency
  • Added user presence indicators to show who's currently editing
  • Improved error handling for cursor tracking and user presence

Current Progress: Room Clearing and Closing Functionality

  • Added room management functionality with the ability to close individual rooms
  • Implemented an admin function to clear all rooms in Firebase for maintenance purposes
  • Added UI components (Close Room button and Admin Controls section) on the dashboard
  • Created deleteRoom and clearAllRooms functions in collab.ts to handle room deletion
  • Added proper error handling and confirmation modals for room deletion operations
  • Updated styling to support new admin controls and room management UI

Build Steps

  1. Set up a new Next.js project with TypeScript
  2. Install and configure Blockly
  3. Create a BlocklyWorkspace component
  4. Set up basic styles
  5. Configure Next.js for Blockly compatibility
  6. Create basic page layout
  7. Add Firebase configuration for authentication and data storage
  8. Implement user authentication
  9. Create room creation and joining functionality
  10. Implement basic Blockly workspace synchronization using Yjs
  11. Set up WebSocket provider for real-time collaboration
  12. Add cursor tracking for collaborative editing
  13. Implement user awareness features to show who's editing
  14. Configure Vercel deployment
  15. Fix WebSocket connection issues for improved reliability
  16. Enhance cursor tracking and user awareness
  17. Switch from XML-based synchronization to per-block synchronization for better real-time collaboration
  18. Fixed cursor visibility issues and added a dedicated room status indicator to show who is currently in the workspace

March 19, 2025

  • Fixed the navigation flow so the back button from projects and rooms takes users to the dashboard with the appropriate tab selected
  • Enhanced the dashboard to support tab selection via URL parameters (dashboard?tab=projects or dashboard?tab=rooms)
  • Improved workspace navigation with consistent "Back to Dashboard" buttons that return to the correct tab
  • Removed references to the standalone projects page to ensure consistent navigation through the dashboard

March 21, 2025

  • Fixed block glitching issues by increasing position update thresholds from 1px to 5px to prevent unnecessary micro-adjustments
  • Increased synchronization timeouts from 50ms to 200ms to reduce update frequency and smooth block rendering
  • Improved overall stability of the collaborative editing experience
  • Disabled viewport synchronization to prevent workspace view jumping when users pan or zoom
  • Enhanced workspace navigation so each user can now control their own view independently
  • Fixed ghost blocks issue by adding delays to the sync process (300ms for create/move, 200ms for changes)
  • Prevented temporary blocks from being synchronized during drag operations
  • Added better error handling to protect against sync failures
  • Optimized block synchronization with improved timing to ensure only final positions are shared
  • Disabled viewport synchronization to allow independent user control of workspace view