Skip to content

Sea - #4

Closed
djzet wants to merge 6 commits into
mainfrom
sea
Closed

Sea#4
djzet wants to merge 6 commits into
mainfrom
sea

Conversation

@djzet

@djzet djzet commented Aug 20, 2026

Copy link
Copy Markdown
Owner

Summary by Sourcery

Enable shared lobbies and collaborative map annotation while updating coordinate handling and deployment support.

New Features:

  • Add collaborative Supabase-powered lobbies with shared points, weapons, drawings, player visibility, and cursor presence.
  • Add map drawing tools for freehand strokes, rulers, markers, erasing, and configurable line widths.
  • Display in-game cursor coordinates and expand map navigation and grid scaling capabilities.

Enhancements:

  • Switch coordinate entry and display from percentages to 0–160 game coordinates.
  • Standardize interface icons through a reusable SVG sprite and improve mobile and safe-area layout behavior.
  • Improve script loading and support Supabase credential injection during GitHub Pages builds.

CI:

  • Build deployments for both the main and sea branches while restricting production deployment to main.

Documentation:

  • Update localized interface text and usage guidance for game-coordinate input, drawing tools, and lobbies.

@sourcery-ai

sourcery-ai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds collaborative drawing and lobby features powered by Supabase, switches coordinate system/UI to game coordinates, and refactors map interactions and rendering to support drawing tools, cursor HUD, and improved grid while updating the GitHub Pages workflow and various UI/locale details.

Sequence diagram for collaborative drawing flow with Supabase lobby

sequenceDiagram
    actor User
    participant Canvas
    participant MapInteractions
    participant AppDraw
    participant AppLobby
    participant Supabase
    participant MapRenderer

    User->>Canvas: pointerdown
    Canvas->>MapInteractions: handlePointerDown(view, mapSize, renderMap, ...)
    MapInteractions->>AppDraw: startStroke(px, py)
    MapInteractions->>Canvas: set cursor crosshair

    User->>Canvas: pointermove
    Canvas->>MapInteractions: handlePointerMove(view, mapSize, renderMap, ...)
    MapInteractions->>AppDraw: continueStroke(px, py)
    MapInteractions->>MapRenderer: draw(ctx, canvas, opts)

    User->>Canvas: pointerup
    Canvas->>MapInteractions: handlePointerUp(view, renderMap, ...)
    MapInteractions->>AppDraw: finishStroke()

    alt lobby connected
        AppDraw->>AppLobby: sendDrawing(tool, color, points, width, label)
        AppLobby->>Supabase: insert into drawings
        Supabase-->>AppLobby: realtime INSERT event
        AppLobby->>MapRenderer: draw(ctx, canvas, opts)
    else local only
        AppDraw->>AppDraw: store in localDrawings
        AppDraw->>MapRenderer: draw(ctx, canvas, opts)
    end
Loading

Sequence diagram for lobby creation and join using Supabase

sequenceDiagram
    actor User
    participant UIPanels
    participant AppLobby
    participant Supabase
    participant AppPoints
    participant AppWeapons
    participant UIInputs
    participant UIResults
    participant MapRenderer

    User->>UIPanels: click createLobbyBtn
    UIPanels->>AppLobby: create(AppPoints.getA(), AppPoints.getB(), AppWeapons.get())
    AppLobby->>Supabase: insert into lobbies
    AppLobby->>Supabase: insert into players (host)
    AppLobby->>AppLobby: subscribeToLobby(code)
    AppLobby-->>UIPanels: return code
    UIPanels->>UIPanels: renderLobbyPlayers()
    UIPanels->>MapRenderer: draw(ctx, canvas, opts)

    User->>UIPanels: click joinLobbyBtn
    UIPanels->>UIPanels: prompt enterLobbyCode
    UIPanels->>AppLobby: join(code)
    AppLobby->>Supabase: select lobbies by code
    AppLobby->>Supabase: select players by lobby_code
    AppLobby->>Supabase: select drawings by lobby_code
    AppLobby->>AppLobby: subscribeToLobby(code)
    AppLobby-->>UIPanels: { ok, pointA, pointB, weapon }
    UIPanels->>AppPoints: assign(pointA, pointB)
    UIPanels->>AppWeapons: set(weapon)
    UIPanels->>UIInputs: sync()
    UIPanels->>UIResults: update()
    UIPanels->>MapRenderer: draw(ctx, canvas, opts)
Loading

File-Level Changes

Change Details Files
Introduce Supabase-powered realtime lobby system with player management, shared drawings, and map state sync.
  • Create AppLobby module that lazily initializes Supabase client with injected URL/key and manages lobbies, players, drawings, and cursors.
  • Implement lobby creation/join/leave flows, including host cleanup, error handling, and reconnection-safe state management.
  • Wire lobby callbacks into main app to sync points, weapon selection, drawings, cursors, and render lobby player list with visibility toggles.
js/features/lobby.js
js/index.js
js/ui/panels.js
index.html
.github/workflows/static.yml
Add local and collaborative drawing tools (pen, line, marker, eraser) integrated with map interactions and rendering.
  • Implement AppDraw module to manage current tool/width, local drawings list, stroke lifecycle, and eraser behavior for own strokes.
  • Extend MapInteractions to start/continue/finish drawing strokes, support middle-click pan override, and eraser hit detection in world space with scale-aware radius.
  • Extend MapRenderer to render pen strokes, ruler lines with distance labels, markers with text labels, and draw overlay for current and remote strokes respecting player visibility.
js/features/draw.js
js/map/interactions.js
js/map/renderer.js
js/index.js
js/ui/panels.js
styles/panel.css
styles/map.css
Switch coordinate inputs and UX from 0–100 percent map to 0–160 game coordinates with cursor HUD and utility support.
  • Add AppUtils.gameCoord helper and use it to format/convert meters to game coordinates in inputs and cursor readout.
  • Change AppPoints.readPoint and UIInputs to treat ax/ay/bx/by as game coordinates (meters/100), including min/max/step attributes and help text updates.
  • Show live cursor coordinates in a HUD near the pointer and update locale/help strings across languages to reflect the new coordinate system.
js/core/utils.js
js/features/points.js
js/ui/inputs.js
js/map/interactions.js
index.html
js/locales/index.js
js/locales/*.json
styles/map.css
Enhance UI with SVG icon sprite, new controls, mobile tweaks, and lobby/drawing panels while deferring script loading.
  • Add inline SVG sprite with reusable icons and replace emoji/text icons across buttons (menu, clear, share, help, mail, theme, reset, context menu).
  • Introduce drawing tools panel, line width selector, lobby section with players list and leave button, and new map controls for lobbies and reset view.
  • Switch most script tags to defer, add Supabase SDK loading, adjust base/mobile styles for safe areas, controls layout, and SVG sizing.
  • Update contact label and hint/help/localization text to remove emojis and align with new features (drawing, lobby, coordinates).
index.html
styles/base.css
styles/panel.css
styles/mobile.css
.gitignore
js/locales/index.js
js/locales/*.json
Refine map grid behavior, zoom limits, and tower rendering while simplifying MapInteractions API.
  • Replace generic grid step calculation with discrete zoom-based major/minor steps, and compute visible view box to draw grid only within map bounds.
  • Split minor and major grid drawing with labels and adjust grid colors, axes, dimming, and tower tooltip/marker styling.
  • Unify MapInteractions public API (remove debug helpers), add MIN/MAX scale constants, clamp zoom accordingly for pinch and wheel, and ensure strokes/cursor HUD cancel on blur.
  • Expose getGridSteps and getTowerIconSize from MapRenderer and use renderMap/mapSize propagation in interactions to keep drawing consistent with view changes.
js/map/renderer.js
js/map/interactions.js
js/index.js
styles/map.css
Update GitHub Pages workflow to support sea branch and Supabase credential injection into lobby feature.
  • Rename workflow to a more generic name, add sea branch to push trigger, and keep manual workflow_dispatch support.
  • Add Node-based step to safely inject Supabase URL/key into js/features/lobby.js placeholders using environment secrets, with logging and fallback behavior for forks.
  • Adjust upload artifact path quoting and downgrade deploy-pages action version from v5 to v4 for compatibility.
.github/workflows/static.yml
js/features/lobby.js

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The Supabase SDK script tag in index.html is the only one without defer, which will block parsing; consider adding defer for consistency and to avoid impacting initial render performance.
  • The new drawing and lobby features rely heavily on global objects (AppDraw, AppLobby, LocaleManager) inside map interactions and renderer; consider passing these dependencies via function options to reduce coupling and make the modules easier to reuse or test.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The Supabase SDK script tag in index.html is the only one without `defer`, which will block parsing; consider adding `defer` for consistency and to avoid impacting initial render performance.
- The new drawing and lobby features rely heavily on global objects (AppDraw, AppLobby, LocaleManager) inside map interactions and renderer; consider passing these dependencies via function options to reduce coupling and make the modules easier to reuse or test.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@djzet djzet closed this Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant