Skip to content

Remove unused components and one code smell - #4777

Open
VariableVince wants to merge 6 commits into
openfrontio:mainfrom
VariableVince:remove-unused-components
Open

Remove unused components and one code smell#4777
VariableVince wants to merge 6 commits into
openfrontio:mainfrom
VariableVince:remove-unused-components

Conversation

@VariableVince

@VariableVince VariableVince commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Add approved & assigned issue number here:

Resolves #4776

Description:

Remove 3 unused components and their now-unused imports, fix 1 code smell

google-ad (GoogleAdElement.ts) — deleted

Direct Google AdSense integration that predated the Playwire RAMP migration. No code in the current codebase references adsbygoogle, <google-ad>, or GoogleAdElement — zero traces of AdSense remain. All ad serving goes through Playwire's window.ramp API (spaAddAds, addUnits).

matchmaking-button (Matchmaking.ts) — deleted

An unused Lit component sitting alongside the active matchmaking-modal in the same file. The actual ranked flow is:

  • "Ranked" button rendered in GameModeSelector.ts:228-232 (desktop) and :147-151 (mobile)
  • Click calls openRankedMenu() (:248) → window.showPage("page-ranked") → opens <ranked-modal>
  • Clicking 1v1/2v2 dispatches open-matchmaking → opens <matchmaking-modal> directly

MatchmakingButton was never imported or instantiated anywhere.

news-button (NewsModal.ts) — deleted

An unused Lit component alongside the active news-modal. The actual News button is in DesktopNavBar.ts:78-84 and MobileNavBar.ts:101, both with data-page="page-news" which routes to <news-modal> via the modal router. NewsButton was never imported, instantiated, or placed in the DOM.

main-radial-menu (MainRadialMenu.ts) — fixed code smell

Extended LitElement with @customElement("main-radial-menu") but had no render() method — all rendering was delegated to a separate RadialMenu Controller. Never used as a DOM custom element (no template usage, never dynamically appended). Only ever instantiated via new MainRadialMenu(...) in GameRenderer.ts:301 and used through the Controller interface. Removed the LitElement/@customElement baggage since they were misleading dead weight.

Removals from LangSelector.ts

Both "matchmaking-button" and "news-button" were listed in the components array used for i18n re-rendering (:287-293). Since these elements never exist in the DOM, querySelectorAll returned empty for them — harmless but misleading. Removed.

Removals and changes in en.json and Matchmaking.ts

Also remove the already unused translations for "matchmaking-button". Move the only one still used to category "matchmaking-modal" in en.json and in its caller Matchmaking.ts.

Please complete the following:

  • I have added screenshots for all UI updates
  • I process any text displayed to the user through translateText() and I've added it to the en.json file
  • I have added relevant tests to the test directory

Please put your Discord username so you can be contacted if a bug or regression is found:

tryout33

…e smell

### `google-ad` (`GoogleAdElement.ts`) — deleted
Direct Google AdSense integration that predated the Playwire RAMP migration. No code in the current codebase references `adsbygoogle`, `<google-ad>`, or `GoogleAdElement` — zero traces of AdSense remain. All ad serving goes through Playwire's `window.ramp` API (`spaAddAds`, `addUnits`).

### `matchmaking-button` (`Matchmaking.ts`) — deleted
An unused Lit component sitting alongside the active `matchmaking-modal` in the same file. The actual ranked flow is:

- "Ranked" button rendered in `GameModeSelector.ts:228-232` (desktop) and `:147-151` (mobile)
- Click calls `openRankedMenu()` (`:248`) → `window.showPage("page-ranked")` → opens `<ranked-modal>`
- Clicking 1v1/2v2 dispatches `open-matchmaking` → opens `<matchmaking-modal>` directly

`MatchmakingButton` was never imported or instantiated anywhere.

### `news-button` (`NewsModal.ts`) — deleted
An unused Lit component alongside the active `news-modal`. The actual News button is in `DesktopNavBar.ts:78-84` and `MobileNavBar.ts:101`, both with `data-page="page-news"` which routes to `<news-modal>` via the modal router. `NewsButton` was never imported, instantiated, or placed in the DOM.

### `main-radial-menu` (`MainRadialMenu.ts`) — fixed code smell
Extended `LitElement` with `@customElement("main-radial-menu")` but had no `render()` method — all rendering was delegated to a separate `RadialMenu` Controller. Never used as a DOM custom element (no template usage, never dynamically appended). Only ever instantiated via `new MainRadialMenu(...)` in `GameRenderer.ts:301` and used through the `Controller` interface. Removed the `LitElement`/`@customElement` baggage since they were misleading dead weight.

### Removals from `LangSelector.ts`
Both `"matchmaking-button"` and `"news-button"` were listed in the `components` array used for i18n re-rendering (`:287-293`). Since these elements never exist in the DOM, `querySelectorAll` returned empty for them — harmless but misleading. Removed.
…ration. No code in the current codebase references `adsbygoogle`, `<google-ad>`, or `GoogleAdElement` — zero traces of AdSense remain. All ad serving goes through Playwire's `window.ramp` API (`spaAddAds`, `addUnits`).

An unused Lit component sitting alongside the active `matchmaking-modal` in the same file. The actual ranked flow is:

- "Ranked" button rendered in `GameModeSelector.ts:228-232` (desktop) and `:147-151` (mobile)
- Click calls `openRankedMenu()` (`:248`) → `window.showPage("page-ranked")` → opens `<ranked-modal>`
- Clicking 1v1/2v2 dispatches `open-matchmaking` → opens `<matchmaking-modal>` directly

`MatchmakingButton` was never imported or instantiated anywhere.

An unused Lit component alongside the active `news-modal`. The actual News button is in `DesktopNavBar.ts:78-84` and `MobileNavBar.ts:101`, both with `data-page="page-news"` which routes to `<news-modal>` via the modal router. `NewsButton` was never imported, instantiated, or placed in the DOM.

Extended `LitElement` with `@customElement("main-radial-menu")` but had no `render()` method — all rendering was delegated to a separate `RadialMenu` Controller. Never used as a DOM custom element (no template usage, never dynamically appended). Only ever instantiated via `new MainRadialMenu(...)` in `GameRenderer.ts:301` and used through the `Controller` interface. Removed the `LitElement`/`@customElement` baggage since they were misleading dead weight.

Both `"matchmaking-button"` and `"news-button"` were listed in the `components` array used for i18n re-rendering (`:287-293`). Since these elements never exist in the DOM, `querySelectorAll` returned empty for them — harmless but misleading. Removed.
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 195fb932-09b1-44c8-894e-58f64d7f78c8

📥 Commits

Reviewing files that changed from the base of the PR and between ecb254e and f1e6192.

📒 Files selected for processing (1)
  • src/client/Matchmaking.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/client/Matchmaking.ts

Walkthrough

Unused Google ad, matchmaking button, and news button components are removed. MainRadialMenu becomes a plain controller, and translation refresh targets and matchmaking modal strings are updated.

Changes

Client component cleanup

Layer / File(s) Summary
Remove unused UI components
src/client/Matchmaking.ts, src/client/NewsModal.ts, src/client/Main.ts, resources/lang/en.json
Removes unused matchmaking and news button components, narrows imports, updates the matchmaking login key, and removes Google ad bootstrap wiring.
Simplify radial menu controller
src/client/hud/layers/MainRadialMenu.ts
Removes LitElement inheritance and custom-element registration from MainRadialMenu.
Update translation refresh targets
src/client/LangSelector.ts
Adds active component tags and removes deleted component tags from translation refreshes.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: scottanderson, duwibi

Poem

Old buttons drift away,
Ads no longer join the play,
Radial menus stand plain,
Fresh translations flow again—
Cleaner code today.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Title matches the main change: removing unused components and a misleading code smell.
Description check ✅ Passed The description is clearly related to the code changes and issue scope.
Linked Issues check ✅ Passed The changes cover #4776 by removing the unused components, updating LangSelector, and fixing the MainRadialMenu code smell.
Out of Scope Changes check ✅ Passed No clear out-of-scope changes are introduced beyond the requested cleanup and translation updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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.

@VariableVince VariableVince changed the title Remove unused components Remove unused components and one code smell Jul 29, 2026
@github-actions github-actions Bot added the auto-closed-needs-issue PR closed by gate — see comment for next steps label Jul 29, 2026
@github-actions

Copy link
Copy Markdown

Hi @VariableVince, thanks for the contribution.

This PR was automatically closed because it doesn't fit our contribution workflow:

  • You aren't currently assigned to an issue labelled approved, and
  • The change is larger than 50 lines (our cap for unsolicited contributions).

To contribute to OpenFront:

  1. For bugs or small quality-of-life improvements: open an issue. A maintainer will label it approved if it's something we'll work on.
  2. For feature ideas: discuss in the dev Discord first. We don't accept unsolicited feature PRs — even if they're good ideas, every merged feature is a permanent maintenance burden.
  3. Once an issue is labelled approved, comment asking to be assigned. After you're assigned, you can open a PR referencing that issue.

If you believe this was closed in error, please reach out on our Discord or comment below.

See CONTRIBUTING.md for the full contribution process.

Automated PR gate. Source.

@github-actions github-actions Bot closed this Jul 29, 2026
@github-project-automation github-project-automation Bot moved this from Triage to Complete in OpenFront Release Management Jul 29, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 29, 2026
@iiamlewis iiamlewis added approved Approved for a PR, if you assigned to the issue. and removed auto-closed-needs-issue PR closed by gate — see comment for next steps labels Jul 29, 2026
@iiamlewis iiamlewis reopened this Jul 29, 2026
@github-project-automation github-project-automation Bot moved this from Complete to Triage in OpenFront Release Management Jul 29, 2026
@iiamlewis

Copy link
Copy Markdown
Contributor

@VariableVince

@iiamlewis iiamlewis added this to the v33 milestone Jul 29, 2026
@github-actions

Copy link
Copy Markdown

Hi @VariableVince, thanks for the contribution.

This PR was automatically closed because it doesn't fit our contribution workflow:

  • You aren't currently assigned to an issue labelled approved, and
  • The change is larger than 50 lines (our cap for unsolicited contributions).

To contribute to OpenFront:

  1. For bugs or small quality-of-life improvements: open an issue. A maintainer will label it approved if it's something we'll work on.
  2. For feature ideas: discuss in the dev Discord first. We don't accept unsolicited feature PRs — even if they're good ideas, every merged feature is a permanent maintenance burden.
  3. Once an issue is labelled approved, comment asking to be assigned. After you're assigned, you can open a PR referencing that issue.

If you believe this was closed in error, please reach out on our Discord or comment below.

See CONTRIBUTING.md for the full contribution process.

Automated PR gate. Source.

@github-actions github-actions Bot added the auto-closed-needs-issue PR closed by gate — see comment for next steps label Jul 29, 2026
@github-actions github-actions Bot closed this Jul 29, 2026
@github-project-automation github-project-automation Bot moved this from Triage to Complete in OpenFront Release Management Jul 29, 2026
@iiamlewis iiamlewis reopened this Jul 29, 2026
@github-project-automation github-project-automation Bot moved this from Complete to Triage in OpenFront Release Management Jul 29, 2026
@iiamlewis iiamlewis removed the auto-closed-needs-issue PR closed by gate — see comment for next steps label Jul 29, 2026
@iiamlewis

Copy link
Copy Markdown
Contributor

STOP FIGHTING ME GITBOT

@VariableVince

VariableVince commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Will fix failing test asap (done)

…n en.json. Moved the still used must_login to the matchmaking_modal category, and also changed in caller Matchmaking.ts
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 29, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Approved for a PR, if you assigned to the issue.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

Remove unused components

2 participants