Skip to content

Unify discovery badge state across LAN/IP/paired/public channels#252

Closed
erikraft wants to merge 1 commit intomasterfrom
codex/implement-unified-discovery-badge-system
Closed

Unify discovery badge state across LAN/IP/paired/public channels#252
erikraft wants to merge 1 commit intomasterfrom
codex/implement-unified-discovery-badge-system

Conversation

@erikraft
Copy link
Copy Markdown
Owner

Motivation

  • Badge visibility/state for discovery modes was scattered across multiple UI files and often updated a single DOM node, causing main/chat footer desync and preventing multiple discovery modes from showing simultaneously.
  • Centralize discovery badge logic so LAN, IP, paired and public-room modes can coexist and be reflected everywhere in the UI.

Description

  • Added a unified state builder and renderer: getDiscoveryState(...) and updateDiscoveryBadges(...) which update all matching badge nodes via document.querySelectorAll(...) and log state with console.log('[Discovery State]', state) in public/scripts/ui-main.js.
  • Implemented DiscoveryBadgeState (in public/scripts/ui-main.js) which centralizes discovery state and listens to events: peers, peer-joined, room-secrets, room-secrets-deleted, join-public-room, public-room-created, public-room-left, ws-disconnected and initialization from PersistentStorage/sessionStorage, and triggers updateDiscoveryBadges(...) + Events.fire('evaluate-footer-badges').
  • Hooked startup and dialog logic into the unified flow: startup now fires Events.fire('room-secrets', roomSecrets) after loading stored secrets and instantiates DiscoveryBadgeState during UI init in public/scripts/main.js.
  • Removed duplicated per-view DOM toggles and switched UI producers to emit shared events instead (updated PairDeviceDialog and PublicRoomDialog to emit room-secrets, room-secrets-deleted, and discovery-public-room-id), and replaced single-node querySelector usages with querySelectorAll for badge click bindings in public/scripts/ui.js.

Testing

  • Syntax checks: node --check public/scripts/ui-main.js, node --check public/scripts/ui.js, node --check public/scripts/main.js all completed successfully.
  • No additional automated unit tests exist for runtime UI; runtime verification should confirm that the LAN, IP, paired and public badges can appear simultaneously in both the main footer and chat footer after these changes.

Codex Task

@erikraft erikraft added the codex ChatGPT Codex helps developers code easily with AI from OpenAI. label Apr 21, 2026 — with ChatGPT Codex Connector
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 21, 2026

Deploy Preview for discordactivitydrop canceled.

Name Link
🔨 Latest commit d8cd35d
🔍 Latest deploy log https://app.netlify.com/projects/discordactivitydrop/deploys/69e77f7225d7320008f11b94

@erikraft erikraft temporarily deployed to codex/implement-unified-discovery-badge-system - ErikrafT Drop - Backend PR #252 April 21, 2026 13:45 — with Render Destroyed
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 21, 2026

Warning

Rate limit exceeded

@erikraft has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 59 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 4 minutes and 59 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 30b1e5d6-619b-45da-943d-c7d2c6705230

📥 Commits

Reviewing files that changed from the base of the PR and between 31176bd and d8cd35d.

📒 Files selected for processing (3)
  • public/scripts/main.js
  • public/scripts/ui-main.js
  • public/scripts/ui.js
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/implement-unified-discovery-badge-system

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@erikraft erikraft closed this Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex ChatGPT Codex helps developers code easily with AI from OpenAI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant