Conversation
Reviewer's GuideAdds collaborative Supabase-powered lobbies and canvas drawing tools to the Wardogs map UI, switches coordinate system to game coordinates (0–160), enhances map rendering/grid and cursor feedback, and updates the GitHub Pages workflow to inject Supabase secrets and support a new branch. Sequence diagram for Supabase lobby creation and realtime drawing syncsequenceDiagram
actor User
participant AppLobby
participant SupabaseSDK as SupabaseClient
participant SupabaseDB
participant AppDraw
participant MapRenderer
User->>AppLobby: create(pointA, pointB, weapon)
AppLobby->>AppLobby: generateCode()
AppLobby->>AppLobby: getSupabase()
AppLobby->>SupabaseSDK: createClient(SUPABASE_URL, SUPABASE_KEY)
AppLobby->>SupabaseDB: from(lobbies).insert({code, host_id, point_a, point_b, weapon})
AppLobby->>SupabaseDB: from(players).insert({lobby_code, player_id, name, color, is_host})
AppLobby->>AppLobby: subscribeToLobby(code)
User->>AppDraw: startStroke(px, py)
User->>AppDraw: continueStroke(px, py)
User->>AppDraw: finishStroke()
AppDraw->>AppLobby: sendDrawing(tool, color, points, width, label)
AppLobby->>SupabaseDB: from(drawings).insert({lobby_code, player_id, tool, color, points, width, label})
SupabaseDB-->>AppLobby: postgres_changes INSERT(drawings)
AppLobby->>AppLobby: setOnDrawing(callback)
AppLobby->>MapRenderer: draw(ctx, canvas, opts)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues, and left some high level feedback:
- Several new lobby/drawing UI strings are hardcoded in Russian (e.g.
renderLobbyPlayerslabels, lobby prompts, toast messages) instead of going through the existing i18nSTR/LocaleManager, which breaks localization and should be wired into the translation system. - The Supabase client in
js/features/lobby.jsis always created with the__SUPABASE_URL__/__SUPABASE_KEY__placeholders, so in environments where the workflow hasn’t injected secrets (e.g. forks, local dev) attempting to create/join a lobby will throw at runtime; consider feature-guarding lobby functionality when credentials are missing or whenwindow.supabaseis unavailable.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Several new lobby/drawing UI strings are hardcoded in Russian (e.g. `renderLobbyPlayers` labels, lobby prompts, toast messages) instead of going through the existing i18n `STR`/LocaleManager, which breaks localization and should be wired into the translation system.
- The Supabase client in `js/features/lobby.js` is always created with the `__SUPABASE_URL__`/`__SUPABASE_KEY__` placeholders, so in environments where the workflow hasn’t injected secrets (e.g. forks, local dev) attempting to create/join a lobby will throw at runtime; consider feature-guarding lobby functionality when credentials are missing or when `window.supabase` is unavailable.
## Individual Comments
### Comment 1
<location path=".github/workflows/static.yml" line_range="27-34" />
<code_context>
- name: Checkout
uses: actions/checkout@v4
+
+ - name: Inject Supabase credentials
+ env:
+ SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
+ SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
+ run: |
+ if [ -n "$SUPABASE_URL" ] && [ -n "$SUPABASE_KEY" ]; then
+ sed -i "s|__SUPABASE_URL__|$SUPABASE_URL|g" js/features/lobby.js
+ sed -i "s|__SUPABASE_KEY__|$SUPABASE_KEY|g" js/features/lobby.js
+ echo "✅ Supabase credentials injected"
+ else
</code_context>
<issue_to_address>
**issue:** Credential injection via sed can break when secrets contain special characters like '&' or backslashes.
Because the substitution uses unescaped shell variables, `sed` will interpret characters like `&` and `\` in `SUPABASE_URL`/`SUPABASE_KEY`, which can corrupt `js/features/lobby.js` during deployment.
Consider either escaping `sed`-special characters in these env vars before substitution, or replacing this with a small template step (e.g. `node`, `envsubst`, or similar) that reads the env vars and writes the file without `sed` replacement semantics.
</issue_to_address>
### Comment 2
<location path="js/features/lobby.js" line_range="4-5" />
<code_context>
+// js/features/lobby.js — Supabase Realtime Lobby
+window.AppLobby = (function () {
+ // ─── Supabase конфиг ────────────────────────────────────
+ const SUPABASE_URL = '__SUPABASE_URL__';
+ const SUPABASE_KEY = '__SUPABASE_KEY__';
+
+ const MAX_DRAWINGS = 500;
</code_context>
<issue_to_address>
**issue:** Using literal placeholder values for Supabase config can cause runtime errors when secrets are not injected (e.g. forks/local).
In `getSupabase()`, `window.supabase.createClient(SUPABASE_URL, SUPABASE_KEY)` will still run even when `__SUPABASE_URL__` / `__SUPABASE_KEY__` haven’t been replaced (local dev, forks without secrets), creating a client with invalid config and causing hard‑to‑debug network errors later.
Since you already handle the "SDK not loaded" case, please also guard against placeholder config: e.g., detect values starting with `__` and either skip initialization (with `isConnected() === false` and a clear message) or throw a descriptive error directly in `getSupabase()`. That will make missing‑secret failures predictable and easier to diagnose.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by Sourcery
Add collaborative lobbies, shared map drawing, and game-coordinate support to the WARDOGS calculator.
New Features:
Enhancements:
CI:
Documentation:
Chores: