How m0o0scar/looking-gloves works
Main Components
• Frontend UI Layer – This is the Next.js client-side part that handles the user interface.
• Pages (in the “pages” directory) serve as entry points (e.g., index, images, luma, quilt, rgbd, video) and API endpoints (e.g., pages/api/luma/getInfo.tsx).
• Components are organized into several subcategories:
▪ Blocks: Components for external API integrations or authentication (e.g., LoginToBlocksButton, PublishToBlocksButton, blocksAuthClient, useBlocksAPI).
▪ Common: General reusable UI components (e.g., Cropper, ExternalLink, IconButton, ProgressBar, etc.).
▪ Editor: Components that help the user create quilt images and manage steps and progress (e.g., QuiltImageCreator, QuiltImageCreatorSteps, useCurrentStep, useProgress).
▪ Processors: Components handling various processing tasks like extracting frames from videos, image sequence processing, light field cropping, and focus adjustment (e.g., ImageSequenceProcessor, QuiltFramesExtractor, VideoFramesExtractor, LightFieldCropEditor).
▪ Quilt: Components specifically for quilt image viewing, previewing, saving, and interfacing with the actual device (e.g., QuiltImage, QuiltImagePreview, QuiltImageSaveButton).
• Backend / API Layer – Built using Next.js API routes that expose server-side endpoints (see “pages/api”).
• Luma API endpoints provide info and potentially process data for handling “luma” operations.
• Public / Asset Layer – Static files and additional scripts.
• “public/assets” holds media files like “how-to-cross-eyes.mp4.”
• “public/pyscripts” contains Python scripts (e.g., quiltDetector.py) that might be invoked through a backend process or locally through a service.
• “public/sw-quilt.js” suggests support for a service worker or client-side processing.
• Utility/Helper Services – Various functions used across the application.
• The “utils” folder includes modules for handling canvas operations, clipboard, DOM interactions, downloads, image and video processing and service worker functions.
Relationships and Interactions
• The Next.js pages use the various UI components to build interactive workflows for creating holograms.
• Editor components interact with the processing components to transform user inputs (or image sequences) into quilt images suitable for holographic display.
• API routes act as bridges for more complex operations (such as “luma” processing), potentially invoking Python scripts or other processing logic.
• Utility functions support various modules at both UI and backend levels for common tasks (e.g., image transformation, fetching data).
Architectural Patterns and Design Principles
• Modular Component Architecture: The project distinguishes components by domain (blocks, common, editor, processors, quilt), indicating separation of concerns.
• MVC-like Structure: Pages (controllers) manage high-level flows and integrate with lower-level UI components (views) and processing modules (models/business logic).
• API Layer in Next.js: Clearly separated API routes suggest a backend service component, streamlining the front-to-back communication.
• Integration with External Scripts/Services: The presence of Python scripts and a service worker shows cross-technology integration, which must be noted in the system design.
Relevant Technologies and Frameworks
• Next.js (React) is the core framework for both pages and UI components.
• Tailwind CSS (configured via tailwind.config.js) for styling.
• ESLint, Prettier for code quality.
• TypeScript throughout (evident by .ts and .tsx files) for static typing and rigorous development.
• Possibly Python for specialized image processing (via public/pyscripts).
• Light Field libraries or custom logic in processing modules (e.g., LightFieldFocusViewer, LightFieldMaterial).
• Frontend Layer:
• Pages (e.g., Index, Images, Luma, Quilt, RGBD, Video)
• UI Components:
▪ Blocks (external service integration)
▪ Common (reusable UI controls)
▪ Editor (workflow management for quilt creation)
▪ Processors (handling transformation of image sequences and videos)
▪ Quilt (final display and device interfacing)
• API/Backend Layer:
• Next.js API routes (e.g., luma/getInfo)
• Integration with Python scripts (quiltDetector)
• Asset and Utility Layer:
• Public media and scripts (video assets, pyscripts, service workers)
• Utilities (canvas, image, video processing, and helper functions)