Skip to content

QoL: team ui improvement - #2420

Closed
RjManhas wants to merge 19 commits into
openfrontio:mainfrom
RjManhas:better-donate-ui
Closed

RjManhas wants to merge 19 commits into
openfrontio:mainfrom
RjManhas:better-donate-ui

Conversation

@RjManhas

@RjManhas RjManhas commented Nov 9, 2025 •

Copy link
Copy Markdown
Contributor

If this PR fixes an issue, link it below. If not, delete these two lines.
Resolves #(issue number)

Description:

adds quick buttons to donate gold and troops to help encourge it in team gamemodes

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
  • I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced
image

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

DISCORD_USERNAME

notifxy (1379678982676676639)

@RjManhas
RjManhas requested a review from a team as a code owner November 9, 2025 06:10
@coderabbitai

coderabbitai Bot commented Nov 9, 2025 •

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@ryanbarlow97 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 2 minutes and 38 seconds before requesting another review.

⌛ 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 3316618 and 1f7989d.

📒 Files selected for processing (5)
  • resources/lang/en.json (1 hunks)
  • src/client/graphics/layers/RadialMenuElements.ts (8 hunks)
  • src/core/configuration/Config.ts (1 hunks)
  • src/core/configuration/DefaultConfig.ts (1 hunks)
  • src/core/game/PlayerImpl.ts (2 hunks)

Walkthrough

Adds dynamic center-button icon and color resolution, split-button support, config- and setting-gated Donate Gold/Troops menu items, relaxes donation friendliness check to require only both players alive, converts donate flags to properties/getters, adds UI toggle and tests.

Changes

Cohort / File(s) Summary
Radial menu runtime & rendering
src/client/graphics/layers/RadialMenu.ts
Resolve dynamic center icon and color via centerButton.icon(params) / centerButton.color(params), apply on render and when params change; refresh center state while visible at level 0.
Menu element types & assembly
src/client/graphics/layers/RadialMenuElements.ts
Export SplitButtonAction; add splitButton to MenuElement; add icon and color callbacks to CenterButtonElement; add shouldShowDonateTroops helper; adjust ally donate element color and root menu assembly to conditionally include donate items.
PlayerPanel UI gating
src/client/graphics/layers/PlayerPanel.ts
Gate donate-gold and donate-troops action buttons by config flags (donateGold / donateTroops) in addition to existing permission checks.
Donation permission logic
src/core/game/PlayerImpl.ts
canDonateGold / canDonateTroops no longer require friendliness — only both players must be alive; uses config properties (not methods).
Configuration API
src/core/configuration/Config.ts, src/core/configuration/DefaultConfig.ts
Convert donateGold() / donateTroops() from methods to readonly boolean properties/getters; update call sites to property access.
User settings & UI
src/core/game/UserSettings.ts, src/client/UserSettingModal.ts, resources/lang/en.json
Add quickDonateButtonsInFFA() and toggleQuickDonateButtonsInFFA(); add a UI toggle wired to that setting; add two English localization keys.
Tests
tests/client/graphics/RadialMenuElements.test.ts
Add tests covering visibility permutations for ally donation buttons across config flags, permission states, selection/backend capability, and FFA vs team scenarios.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI as RadialMenu (SVG)
    participant RM as RadialMenu.Controller
    participant Game as Game Logic

    User->>UI: open radial menu / hover
    UI->>RM: request menu items (params)
    RM->>RM: build items via RadialMenuElements\n(determine donate visibility)
    RM->>UI: render menu (items + center button)

    alt center button has dynamic icon/color
        RM->>RM: call centerButton.icon(params)\ncall centerButton.color(params)
        RM->>UI: update center icon & fill
    end

    User->>UI: click center
    UI->>RM: handle click
    RM->>Game: execute center action (may be donate)
    Game-->>RM: result
    RM->>UI: update menu / close
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Extra attention:
    • Dynamic icon/color resolution and lifecycle in RadialMenu.ts.
    • New types (SplitButtonAction, CenterButtonElement callbacks) and how callers construct elements.
    • Behavioral change in PlayerImpl removing friendliness requirement.
    • Config API change (methods → properties) and all updated call sites.

Possibly related PRs

Suggested labels

Feature - Frontend, UI/UX, Feature - Simulation

Suggested reviewers

  • evanpelle
  • scottanderson

Poem

A circle with a center that learns to glow,
icons that shift with the game’s ebb and flow.
Buttons that donate when rules let them through,
a toggle for FFA — small changes, big view. 🎨✨

Pre-merge checks

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'QoL: team ui improvement' is vague and generic, using non-descriptive terms that do not clearly convey the main changes (adding quick donate buttons to the radial menu). Use a more specific title like 'Add quick donate buttons to radial menu for team games' to clearly summarize the primary change.
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The description is related to the changeset, mentioning quick donate buttons for gold and troops in team gamemodes, and confirms UI updates, translations, and tests were completed.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6a78494 and 2eae42f.

📒 Files selected for processing (2)
  • src/client/graphics/layers/RadialMenu.ts (5 hunks)
  • src/client/graphics/layers/RadialMenuElements.ts (4 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-06-16T03:03:59.778Z
Learnt from: VariableVince
Repo: openfrontio/OpenFrontIO PR: 1192
File: src/client/graphics/layers/RadialMenuElements.ts:312-314
Timestamp: 2025-06-16T03:03:59.778Z
Learning: In RadialMenuElements.ts, when fixing undefined params errors in subMenu functions, use explicit checks like `if (params === undefined || params.selected === null)` rather than optional chaining, as it makes the intent clearer and matches the specific error scenarios where params can be undefined during spawn phase operations.

Applied to files:

  • src/client/graphics/layers/RadialMenuElements.ts
  • src/client/graphics/layers/RadialMenu.ts
📚 Learning: 2025-08-12T00:31:50.144Z
Learnt from: scottanderson
Repo: openfrontio/OpenFrontIO PR: 1752
File: src/core/game/Game.ts:750-752
Timestamp: 2025-08-12T00:31:50.144Z
Learning: In the OpenFrontIO codebase, changes to the PlayerInteraction interface (like adding canDonateGold and canDonateTroops flags) do not require corresponding updates to src/core/Schemas.ts or server serialization code.

Applied to files:

  • src/client/graphics/layers/RadialMenuElements.ts
🧬 Code graph analysis (2)
src/client/graphics/layers/RadialMenuElements.ts (3)
src/client/graphics/layers/RadialMenu.ts (1)
  • TooltipItem (18-21)
src/core/game/PlayerImpl.ts (1)
  • isFriendly (792-797)
src/core/game/GameView.ts (1)
  • isFriendly (384-386)
src/client/graphics/layers/RadialMenu.ts (2)
src/client/graphics/layers/RadialMenuElements.ts (1)
  • MenuElement (51-70)
src/client/Utils.ts (1)
  • getSvgAspectRatio (249-300)
🪛 GitHub Actions: 🧪 CI
src/client/graphics/layers/RadialMenuElements.ts

[error] 596-596: TypeError: params.myPlayer.isFriendly is not a function. Expected 'isFriendly' to be a function, but it was not.


[error] 596-596: In function 'subMenu', the call 'params.myPlayer.isFriendly' failed because 'isFriendly' is not a function on 'myPlayer'.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Nov 9, 2025
coderabbitai[bot]
coderabbitai Bot previously approved these changes Nov 10, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7082e55 and 8eb4685.

📒 Files selected for processing (4)
  • src/client/graphics/layers/PlayerPanel.ts (3 hunks)
  • src/client/graphics/layers/RadialMenuElements.ts (4 hunks)
  • src/core/game/PlayerImpl.ts (2 hunks)
  • tests/client/graphics/RadialMenuElements.test.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (7)
📚 Learning: 2025-08-12T00:31:50.144Z
Learnt from: scottanderson
Repo: openfrontio/OpenFrontIO PR: 1752
File: src/core/game/Game.ts:750-752
Timestamp: 2025-08-12T00:31:50.144Z
Learning: In the OpenFrontIO codebase, changes to the PlayerInteraction interface (like adding canDonateGold and canDonateTroops flags) do not require corresponding updates to src/core/Schemas.ts or server serialization code.

Applied to files:

  • src/client/graphics/layers/PlayerPanel.ts
  • src/client/graphics/layers/RadialMenuElements.ts
  • tests/client/graphics/RadialMenuElements.test.ts
  • src/core/game/PlayerImpl.ts
📚 Learning: 2025-10-08T17:14:49.369Z
Learnt from: Foorack
Repo: openfrontio/OpenFrontIO PR: 2141
File: src/client/ClientGameRunner.ts:228-234
Timestamp: 2025-10-08T17:14:49.369Z
Learning: For the window close confirmation feature in `ClientGameRunner.ts`, the troop count requirement (>10,000 troops) from issue #2137 was intentionally removed because it was arbitrary and troop count can be reported as low despite having significant land. The confirmation now triggers for any alive player regardless of troop count.

Applied to files:

  • src/client/graphics/layers/PlayerPanel.ts
  • src/core/game/PlayerImpl.ts
📚 Learning: 2025-05-31T18:15:03.445Z
Learnt from: 1brucben
Repo: openfrontio/OpenFrontIO PR: 977
File: src/core/execution/AttackExecution.ts:123-125
Timestamp: 2025-05-31T18:15:03.445Z
Learning: The removeTroops function in PlayerImpl.ts already prevents negative troop counts by using minInt(this._troops, toInt(troops)) to ensure it never removes more troops than available.

Applied to files:

  • src/client/graphics/layers/PlayerPanel.ts
  • src/core/game/PlayerImpl.ts
📚 Learning: 2025-10-20T20:15:28.858Z
Learnt from: sambokai
Repo: openfrontio/OpenFrontIO PR: 2225
File: src/core/execution/FakeHumanExecution.ts:51-51
Timestamp: 2025-10-20T20:15:28.858Z
Learning: In src/core/execution/FakeHumanExecution.ts, game balance constants like MIRV_COOLDOWN_TICKS, MIRV_HESITATION_ODDS, VICTORY_DENIAL_TEAM_THRESHOLD, VICTORY_DENIAL_INDIVIDUAL_THRESHOLD, and STEAMROLL_CITY_GAP_MULTIPLIER are experimental tuning parameters subject to frequent change during balance testing. Do not flag changes to these values as issues or compare them against previous values.

Applied to files:

  • src/client/graphics/layers/PlayerPanel.ts
📚 Learning: 2025-06-16T03:03:59.778Z
Learnt from: VariableVince
Repo: openfrontio/OpenFrontIO PR: 1192
File: src/client/graphics/layers/RadialMenuElements.ts:312-314
Timestamp: 2025-06-16T03:03:59.778Z
Learning: In RadialMenuElements.ts, when fixing undefined params errors in subMenu functions, use explicit checks like `if (params === undefined || params.selected === null)` rather than optional chaining, as it makes the intent clearer and matches the specific error scenarios where params can be undefined during spawn phase operations.

Applied to files:

  • src/client/graphics/layers/RadialMenuElements.ts
  • tests/client/graphics/RadialMenuElements.test.ts
📚 Learning: 2025-10-08T17:14:49.369Z
Learnt from: Foorack
Repo: openfrontio/OpenFrontIO PR: 2141
File: src/client/ClientGameRunner.ts:228-234
Timestamp: 2025-10-08T17:14:49.369Z
Learning: In `ClientGameRunner.ts`, the `myPlayer` field is always set when `shouldPreventWindowClose()` is called, so the null check in that method is sufficient without needing to fetch it again from `gameView.playerByClientID()`.

Applied to files:

  • src/client/graphics/layers/RadialMenuElements.ts
📚 Learning: 2025-11-01T00:24:33.860Z
Learnt from: FloPinguin
Repo: openfrontio/OpenFrontIO PR: 2161
File: src/core/execution/FakeHumanExecution.ts:670-678
Timestamp: 2025-11-01T00:24:33.860Z
Learning: In OpenFrontIO, PlayerType.Bot entities cannot be in teams and do not have friendliness relationships. Only PlayerType.Human and PlayerType.FakeHuman can participate in teams and alliances. Therefore, when targeting bot-owned tiles, friendliness checks like `owner.isFriendly(this.player)` are unnecessary and meaningless for bots.

Applied to files:

  • src/core/game/PlayerImpl.ts
🧬 Code graph analysis (3)
src/client/graphics/layers/PlayerPanel.ts (1)
src/core/game/PlayerImpl.ts (2)
  • canDonateTroops (615-636)
  • canDonateGold (592-613)
src/client/graphics/layers/RadialMenuElements.ts (1)
src/client/graphics/layers/RadialMenu.ts (1)
  • TooltipItem (18-21)
tests/client/graphics/RadialMenuElements.test.ts (2)
src/client/graphics/layers/RadialMenuElements.ts (1)
  • rootMenuElement (577-618)
src/core/game/GameView.ts (1)
  • PlayerView (181-446)
🪛 GitHub Actions: 🧪 CI
src/client/graphics/layers/RadialMenuElements.ts

[error] 595-595: params.game.config(...).donateGold is not a function


[error] 595-595: params.game.config(...).donateGold is not a function


[error] 595-595: params.game.config(...).donateGold is not a function

🔇 Additional comments (10)
src/core/game/PlayerImpl.ts (2)

592-613: LGTM - Donation eligibility relaxed as intended.

The friendliness requirement has been removed, allowing donations between any two alive players. This aligns with the PR objective to encourage donations in team game modes.


615-636: LGTM - Consistent with gold donation changes.

The troop donation logic correctly mirrors the gold donation changes, requiring only that both players are alive.

src/client/graphics/layers/PlayerPanel.ts (3)

656-666: LGTM - Proper dual-gating for troops donation.

The button correctly requires both backend permission (canDonateTroops) and config flag (donateTroopsEnabled) to render.


667-677: LGTM - Consistent dual-gating for gold donation.

The gold donation button correctly mirrors the troops donation pattern with dual-gating.


622-624: No issues found. Code correctly uses the established config pattern.

The code in PlayerPanel.ts (lines 622-624) correctly calls this.g.config().donateGold() and this.g.config().donateTroops(). GameView.config() (line 647 of GameView.ts) returns a Config object that exposes both methods. This is the same pattern used successfully throughout the codebase—including in PlayerImpl.ts, RadialMenuElements.ts, and all existing tests.

tests/client/graphics/RadialMenuElements.test.ts (1)

477-686: Excellent test coverage for donation functionality.

The test suite comprehensively covers all combinations of config flags, permissions, and player relationships. The tests clearly verify that donation buttons appear only when both config and backend permissions allow it.

src/client/graphics/layers/RadialMenuElements.ts (4)

43-49: LGTM - Clean interface for split-button actions.

The SplitButtonAction interface is well-typed and follows the existing patterns in the codebase.


66-69: LGTM - Clean extension of MenuElement interface.

The optional splitButton property maintains backward compatibility while adding new functionality.


229-229: Good UX improvement - gold color for gold donation.

Changing from green (COLORS.ally) to gold (COLORS.tooltip.cost) makes the gold donation button more intuitive and visually distinct.


604-613: Conditional inclusion logic is sound, pending config fix.

The triple-gating (selection exists, config enabled, backend permission) is correctly implemented. However, this depends on fixing the config method calls at lines 595-596.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Nov 10, 2025
@evanpelle

Copy link
Copy Markdown
Collaborator

I would like to avoid adding more options to the radial to keep it less busy. Maybe instead the center button (sword) could be used to donate? since you can't attack an ally anyways.

@evanpelle

Copy link
Copy Markdown
Collaborator

I would like to avoid adding more options to the radial to keep it less busy. Maybe instead the center button (sword) could be used to donate? since you can't attack an ally anyways.

I'm thinking the center button can donate troops, since I believe that is more common.

@RjManhas

Copy link
Copy Markdown
Contributor Author

@evanpelle like so instead of the grayed out sword icon being their, its the donate buttons (maybe half and half for gold / troops), thoses buttons are disabled / hide btw when the lobby does not allow donation for gold or troops

@RjManhas

Copy link
Copy Markdown
Contributor Author

@evanpelle or maybe i could make the center grey sword be a donate icon (generic) and then it opens a sub radial menu just like how the build icon does, if i dont hear back soon, ill go with this option as its more clean

@RjManhas

Copy link
Copy Markdown
Contributor Author

but also, every single person who seen this feature be wip has loved the idea, and even people i didnt tell, has mentioned me and said they like it since it helps in team games encourge donations

@VariableVince

Copy link
Copy Markdown
Contributor

@RjManhas Could be as discussed here indeed https://discord.com/channels/1359946986937258015/1434955373546176654/1434967081044152493

With the half/half donate troops/gold. And directly donate the % based on the attack %. So it is actually quick instead of having to go through another popup. If people want advanced options, they can still use the existing popup from the player info panel.

Hotkeys for donating troops and gold could have the same simple use of the attack ratio %.

Btw attack ratio % was used in the past for donating as you might know, so using it again would not be far of from what players were used to.

@RjManhas

Copy link
Copy Markdown
Contributor Author

@VariableVince like the button, does both gold and troops?

@RjManhas

Copy link
Copy Markdown
Contributor Author

based off the attack ratio

@VariableVince

Copy link
Copy Markdown
Contributor

@RjManhas no two buttons, so the attack button would be split in half like i think you meant with "maybe half and half for gold / troops".

OTOH such small buttons could degrade mobile UX so not sure, maybe only have a donate troops button there like Evan suggested.

Or use the center button to donate troops, and the place of the Ally button to donate gold? That way the radial menu doesn't get busier, no extra button spots (with the delete button now moved to the boat button spot, the menu is back to 4 buttons in the circle instead of 5 and i think Evan prefers keep it at 4).

@RjManhas

RjManhas commented Nov 11, 2025 •

Copy link
Copy Markdown
Contributor Author

@VariableVince issue with replacing the ally button is in duo games or FFA games or when donating to a non teamate and a ally, thats where the break alliance button is, so unless we make this update only affect teamates in team games and forget about all the other situlations where you can donate, then we can not replace that button.

@RjManhas

Copy link
Copy Markdown
Contributor Author

@VariableVince so i should replace the sword button with gold (due to it being smaller and less used) and then where the build button would go for your own land, replace it with donate troops

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
src/client/graphics/layers/RadialMenu.ts (1)

390-464: Consider extracting split-button detection logic.

The angle calculation logic for determining left vs right split-button halves is duplicated between onHover (lines 397-448) and onClick (lines 510-570). Extracting this into a helper method would reduce duplication and make the code easier to maintain.

Example helper:

private getSplitButtonSide(
  d: d3.PieArcDatum<MenuElement>,
  event: MouseEvent,
  pathElement: SVGPathElement,
  level: number
): 'left' | 'right' {
  const svg = pathElement.ownerSVGElement;
  if (!svg) return 'left';
  
  const pt = svg.createSVGPoint();
  pt.x = event.clientX;
  pt.y = event.clientY;
  const svgPoint = pt.matrixTransform(svg.getScreenCTM()?.inverse());

  const innerRadius = this.getInnerRadiusForLevel(level);
  const outerRadius = this.getOuterRadiusForLevel(level);
  const arc = d3.arc<d3.PieArcDatum<MenuElement>>()
    .innerRadius(innerRadius)
    .outerRadius(outerRadius);
  const centroid = arc.centroid(d);

  const clickAngle = Math.atan2(
    svgPoint.y - centroid[1],
    svgPoint.x - centroid[0]
  );
  const arcMidAngle = (d.startAngle + d.endAngle) / 2;

  const normalizeAngle = (angle: number) => {
    while (angle < 0) angle += 2 * Math.PI;
    while (angle >= 2 * Math.PI) angle -= 2 * Math.PI;
    return angle;
  };

  const normalizedClickAngle = normalizeAngle(clickAngle);
  const normalizedMidAngle = normalizeAngle(arcMidAngle);

  let angleDiff = normalizedClickAngle - normalizedMidAngle;
  if (angleDiff > Math.PI) angleDiff -= 2 * Math.PI;
  if (angleDiff < -Math.PI) angleDiff += 2 * Math.PI;

  return angleDiff < 0 ? 'left' : 'right';
}
src/client/graphics/layers/RadialMenuElements.ts (1)

692-748: Consider extracting donation visibility helper.

The donation visibility logic in rootMenuElement.subMenu is quite complex with nested conditions. Consider extracting a shouldShowDonateGold() helper similar to shouldShowDonateTroops() to improve readability.

Example:

function shouldShowDonateGold(params: MenuElementParams, isOwnTerritory: boolean): boolean {
  if (!isOwnTerritory || !params.selected) return false;
  
  const donateGoldEnabled = Boolean(params.game.config().donateGold ?? false);
  if (!donateGoldEnabled) return false;
  
  if (!params.playerActions?.interaction?.canDonateGold) return false;
  
  const isTeammateOrAlly = 
    params.myPlayer.isOnSameTeam(params.selected) ||
    params.myPlayer.isAlliedWith(params.selected);
  if (!isTeammateOrAlly) return false;
  
  const gameMode = params.game.config().gameConfig.gameMode;
  if (gameMode === GameMode.FFA) {
    return params.game.config().userSettings().quickDonateButtonsInFFA();
  }
  
  return true;
}

This would simplify the main submenu logic and make the conditions more explicit.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5121e52 and 38e5d59.

📒 Files selected for processing (5)
  • resources/lang/en.json (1 hunks)
  • src/client/UserSettingModal.ts (2 hunks)
  • src/client/graphics/layers/RadialMenu.ts (8 hunks)
  • src/client/graphics/layers/RadialMenuElements.ts (7 hunks)
  • src/core/game/UserSettings.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (12)
📚 Learning: 2025-08-12T00:31:50.144Z
Learnt from: scottanderson
Repo: openfrontio/OpenFrontIO PR: 1752
File: src/core/game/Game.ts:750-752
Timestamp: 2025-08-12T00:31:50.144Z
Learning: In the OpenFrontIO codebase, changes to the PlayerInteraction interface (like adding canDonateGold and canDonateTroops flags) do not require corresponding updates to src/core/Schemas.ts or server serialization code.

Applied to files:

  • src/client/UserSettingModal.ts
  • resources/lang/en.json
  • src/core/game/UserSettings.ts
  • src/client/graphics/layers/RadialMenuElements.ts
📚 Learning: 2025-06-02T14:27:37.609Z
Learnt from: andrewNiziolek
Repo: openfrontio/OpenFrontIO PR: 1007
File: resources/lang/de.json:115-115
Timestamp: 2025-06-02T14:27:37.609Z
Learning: For OpenFrontIO project: When localization keys are renamed in language JSON files, the maintainers separate technical changes from translation content updates. They wait for community translators to update the actual translation values rather than attempting to translate in the same PR. This allows technical changes to proceed while ensuring accurate translations from native speakers.

Applied to files:

  • resources/lang/en.json
📚 Learning: 2025-08-16T10:52:08.292Z
Learnt from: TheGiraffe3
Repo: openfrontio/OpenFrontIO PR: 884
File: resources/lang/en.json:456-461
Timestamp: 2025-08-16T10:52:08.292Z
Learning: In OpenFrontIO, translation files in resources/lang/*.json (except en.json) should not be updated in regular PRs. Only dedicated translation PRs titled "mls" and made by Aotumori should update non-English locale files. Regular PRs should only update en.json when adding or modifying translation keys.

Applied to files:

  • resources/lang/en.json
📚 Learning: 2025-07-12T08:41:35.101Z
Learnt from: Aotumuri
Repo: openfrontio/OpenFrontIO PR: 1357
File: resources/lang/de.json:523-540
Timestamp: 2025-07-12T08:41:35.101Z
Learning: In OpenFrontIO project localization files, always check the en.json source file before flagging potential spelling errors in other language files, as some keys may intentionally use non-standard spellings that need to be consistent across all translations.

Applied to files:

  • resources/lang/en.json
📚 Learning: 2025-05-30T03:53:52.231Z
Learnt from: scottanderson
Repo: openfrontio/OpenFrontIO PR: 949
File: resources/lang/en.json:8-10
Timestamp: 2025-05-30T03:53:52.231Z
Learning: For the OpenFrontIO project, do not suggest updating translation files in resources/lang/*.json except for en.json. The project has a dedicated translation team that handles all other locale files.

Applied to files:

  • resources/lang/en.json
📚 Learning: 2025-08-21T21:42:45.277Z
Learnt from: plazmaezio
Repo: openfrontio/OpenFrontIO PR: 1883
File: src/client/HostLobbyModal.ts:227-245
Timestamp: 2025-08-21T21:42:45.277Z
Learning: In openfrontio/OpenFrontIO, the en.json file contains difficulty translation keys using the descriptive names ("Relaxed", "Balanced", "Intense", "Impossible") rather than the enum values ("Easy", "Medium", "Hard", "Impossible"). The DifficultyDescription mapping in src/client/components/Difficulties.ts correctly maps enum values to these descriptive translation keys.

Applied to files:

  • resources/lang/en.json
📚 Learning: 2025-06-16T03:03:59.778Z
Learnt from: VariableVince
Repo: openfrontio/OpenFrontIO PR: 1192
File: src/client/graphics/layers/RadialMenuElements.ts:312-314
Timestamp: 2025-06-16T03:03:59.778Z
Learning: In RadialMenuElements.ts, when fixing undefined params errors in subMenu functions, use explicit checks like `if (params === undefined || params.selected === null)` rather than optional chaining, as it makes the intent clearer and matches the specific error scenarios where params can be undefined during spawn phase operations.

Applied to files:

  • src/client/graphics/layers/RadialMenu.ts
  • src/client/graphics/layers/RadialMenuElements.ts
📚 Learning: 2025-10-20T20:15:28.858Z
Learnt from: sambokai
Repo: openfrontio/OpenFrontIO PR: 2225
File: src/core/execution/FakeHumanExecution.ts:51-51
Timestamp: 2025-10-20T20:15:28.858Z
Learning: In src/core/execution/FakeHumanExecution.ts, game balance constants like MIRV_COOLDOWN_TICKS, MIRV_HESITATION_ODDS, VICTORY_DENIAL_TEAM_THRESHOLD, VICTORY_DENIAL_INDIVIDUAL_THRESHOLD, and STEAMROLL_CITY_GAP_MULTIPLIER are experimental tuning parameters subject to frequent change during balance testing. Do not flag changes to these values as issues or compare them against previous values.

Applied to files:

  • src/core/game/UserSettings.ts
  • src/client/graphics/layers/RadialMenuElements.ts
📚 Learning: 2025-06-09T02:20:43.637Z
Learnt from: VariableVince
Repo: openfrontio/OpenFrontIO PR: 1110
File: src/client/Main.ts:293-295
Timestamp: 2025-06-09T02:20:43.637Z
Learning: In src/client/Main.ts, during game start in the handleJoinLobby callback, UI elements are hidden using direct DOM manipulation with classList.add("hidden") for consistency. This includes modals, buttons, and error divs. The codebase follows this pattern rather than using component APIs for hiding elements during game transitions.

Applied to files:

  • src/client/graphics/layers/RadialMenuElements.ts
📚 Learning: 2025-10-08T17:14:49.369Z
Learnt from: Foorack
Repo: openfrontio/OpenFrontIO PR: 2141
File: src/client/ClientGameRunner.ts:228-234
Timestamp: 2025-10-08T17:14:49.369Z
Learning: In `ClientGameRunner.ts`, the `myPlayer` field is always set when `shouldPreventWindowClose()` is called, so the null check in that method is sufficient without needing to fetch it again from `gameView.playerByClientID()`.

Applied to files:

  • src/client/graphics/layers/RadialMenuElements.ts
📚 Learning: 2025-10-08T17:14:49.369Z
Learnt from: Foorack
Repo: openfrontio/OpenFrontIO PR: 2141
File: src/client/ClientGameRunner.ts:228-234
Timestamp: 2025-10-08T17:14:49.369Z
Learning: For the window close confirmation feature in `ClientGameRunner.ts`, the troop count requirement (>10,000 troops) from issue #2137 was intentionally removed because it was arbitrary and troop count can be reported as low despite having significant land. The confirmation now triggers for any alive player regardless of troop count.

Applied to files:

  • src/client/graphics/layers/RadialMenuElements.ts
📚 Learning: 2025-05-31T18:15:03.445Z
Learnt from: 1brucben
Repo: openfrontio/OpenFrontIO PR: 977
File: src/core/execution/AttackExecution.ts:123-125
Timestamp: 2025-05-31T18:15:03.445Z
Learning: The removeTroops function in PlayerImpl.ts already prevents negative troop counts by using minInt(this._troops, toInt(troops)) to ensure it never removes more troops than available.

Applied to files:

  • src/client/graphics/layers/RadialMenuElements.ts
🧬 Code graph analysis (3)
src/client/UserSettingModal.ts (1)
src/client/LangSelector.ts (1)
  • translateText (254-274)
src/client/graphics/layers/RadialMenu.ts (2)
src/client/graphics/layers/RadialMenuElements.ts (1)
  • MenuElement (56-75)
src/client/Utils.ts (1)
  • getSvgAspectRatio (249-300)
src/client/graphics/layers/RadialMenuElements.ts (2)
src/client/graphics/layers/RadialMenu.ts (1)
  • TooltipItem (18-21)
src/core/game/UserSettings.ts (1)
  • quickDonateButtonsInFFA (202-204)
🪛 GitHub Actions: 🧪 CI
src/client/graphics/layers/RadialMenuElements.ts

[error] 697-697: TypeError: params.game.config(...).gameConfig is not a function


[error] 697-697: TypeError: params.game.config(...).gameConfig is not a function


[error] 697-697: TypeError: params.game.config(...).gameConfig is not a function


[error] 697-697: TypeError: params.game.config(...).gameConfig is not a function


[error] 697-697: TypeError: params.game.config(...).gameConfig is not a function

🔇 Additional comments (9)
src/core/game/UserSettings.ts (1)

202-211: LGTM!

The implementation follows the established pattern for user settings. The default value of false is appropriate for an opt-in feature.

src/client/UserSettingModal.ts (2)

209-214: LGTM!

The toggle handler follows the established pattern with proper payload validation.


374-385: LGTM!

The UI toggle is properly wired to the user setting and follows the consistent pattern used throughout the settings modal.

resources/lang/en.json (1)

339-340: LGTM!

The translation keys are clear and descriptive, following the project's naming conventions.

src/client/graphics/layers/RadialMenu.ts (2)

656-725: LGTM!

The split-button rendering logic correctly handles icon positioning, aspect ratios, and disabled states for each side independently.


1083-1134: LGTM!

The dynamic center button icon and color support is well-implemented with proper fallback to defaults when no override is provided.

src/client/graphics/layers/RadialMenuElements.ts (3)

48-88: LGTM!

The new interface definitions are clean and well-typed. The optional fields are appropriately marked, and the structure supports the split-button functionality effectively.


236-236: LGTM!

Changing the Donate Gold button color to gold/yellow (COLORS.tooltip.cost) instead of green (COLORS.ally) improves visual clarity and matches the action's purpose.


557-637: LGTM after fixing gameConfig access!

The center button logic cleanly switches between Attack and Donate Troops based on context. The dynamic icon and color support is well-implemented. This will work correctly once the gameConfig() method calls are changed to property access.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Nov 12, 2025
@RjManhas

Copy link
Copy Markdown
Contributor Author

@evanpelle

@evanpelle

Copy link
Copy Markdown
Collaborator

@evanpelle like so instead of the grayed out sword icon being their, its the donate buttons (maybe half and half for gold / troops), thoses buttons are disabled / hide btw when the lobby does not allow donation for gold or troops

yeah that sounds good

@evanpelle

Copy link
Copy Markdown
Collaborator

@evanpelle like so instead of the grayed out sword icon being their, its the donate buttons (maybe half and half for gold / troops), thoses buttons are disabled / hide btw when the lobby does not allow donation for gold or troops

yeah that sounds good

and if we can't donate but are still friendly then it should be a grayed out donate button.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Nov 20, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/client/graphics/layers/RadialMenuElements.ts (2)

48-74: Unused interface - consider removing or implementing.

The SplitButtonAction interface and splitButton field are defined but never used in this file. The PR discussion mentioned split buttons as an option, but the implementation uses dynamic center button replacement instead.

If split buttons aren't needed in this PR, consider removing these definitions to reduce unused code. If they're planned for future use, consider adding a comment explaining the intent.


662-719: Consider extracting donation eligibility checks.

The logic correctly implements the FFA user setting and team game behavior per the PR objectives. However, the donation eligibility check (params.myPlayer.isOnSameTeam(params.selected) || params.myPlayer.isAlliedWith(params.selected)) is repeated at lines 692-693 and 712-713.

Consider extracting this check into the helper:

+    const canDonateToSelected = () => {
+      if (!params.selected) return false;
+      return (
+        params.myPlayer.isOnSameTeam(params.selected) ||
+        params.myPlayer.isAlliedWith(params.selected)
+      );
+    };
+
     const shouldShowDonateGold =
       isOwnTerritory &&
-      params.selected &&
       shouldShowQuickDonateButtons() &&
       params.playerActions?.interaction?.canDonateGold &&
-      (params.myPlayer.isOnSameTeam(params.selected) ||
-        params.myPlayer.isAlliedWith(params.selected));
+      canDonateToSelected();

Then reuse canDonateToSelected() at line 712 as well.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5946c25 and b8c2a55.

📒 Files selected for processing (2)
  • src/client/graphics/layers/RadialMenu.ts (3 hunks)
  • src/client/graphics/layers/RadialMenuElements.ts (7 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/client/graphics/layers/RadialMenu.ts
🧰 Additional context used
🧠 Learnings (8)
📓 Common learnings
Learnt from: scottanderson
Repo: openfrontio/OpenFrontIO PR: 1752
File: src/core/game/Game.ts:750-752
Timestamp: 2025-08-12T00:31:50.144Z
Learning: In the OpenFrontIO codebase, changes to the PlayerInteraction interface (like adding canDonateGold and canDonateTroops flags) do not require corresponding updates to src/core/Schemas.ts or server serialization code.
📚 Learning: 2025-06-16T03:03:59.778Z
Learnt from: VariableVince
Repo: openfrontio/OpenFrontIO PR: 1192
File: src/client/graphics/layers/RadialMenuElements.ts:312-314
Timestamp: 2025-06-16T03:03:59.778Z
Learning: In RadialMenuElements.ts, when fixing undefined params errors in subMenu functions, use explicit checks like `if (params === undefined || params.selected === null)` rather than optional chaining, as it makes the intent clearer and matches the specific error scenarios where params can be undefined during spawn phase operations.

Applied to files:

  • src/client/graphics/layers/RadialMenuElements.ts
📚 Learning: 2025-08-12T00:31:50.144Z
Learnt from: scottanderson
Repo: openfrontio/OpenFrontIO PR: 1752
File: src/core/game/Game.ts:750-752
Timestamp: 2025-08-12T00:31:50.144Z
Learning: In the OpenFrontIO codebase, changes to the PlayerInteraction interface (like adding canDonateGold and canDonateTroops flags) do not require corresponding updates to src/core/Schemas.ts or server serialization code.

Applied to files:

  • src/client/graphics/layers/RadialMenuElements.ts
📚 Learning: 2025-06-09T02:20:43.637Z
Learnt from: VariableVince
Repo: openfrontio/OpenFrontIO PR: 1110
File: src/client/Main.ts:293-295
Timestamp: 2025-06-09T02:20:43.637Z
Learning: In src/client/Main.ts, during game start in the handleJoinLobby callback, UI elements are hidden using direct DOM manipulation with classList.add("hidden") for consistency. This includes modals, buttons, and error divs. The codebase follows this pattern rather than using component APIs for hiding elements during game transitions.

Applied to files:

  • src/client/graphics/layers/RadialMenuElements.ts
📚 Learning: 2025-10-08T17:14:49.369Z
Learnt from: Foorack
Repo: openfrontio/OpenFrontIO PR: 2141
File: src/client/ClientGameRunner.ts:228-234
Timestamp: 2025-10-08T17:14:49.369Z
Learning: In `ClientGameRunner.ts`, the `myPlayer` field is always set when `shouldPreventWindowClose()` is called, so the null check in that method is sufficient without needing to fetch it again from `gameView.playerByClientID()`.

Applied to files:

  • src/client/graphics/layers/RadialMenuElements.ts
📚 Learning: 2025-10-08T17:14:49.369Z
Learnt from: Foorack
Repo: openfrontio/OpenFrontIO PR: 2141
File: src/client/ClientGameRunner.ts:228-234
Timestamp: 2025-10-08T17:14:49.369Z
Learning: For the window close confirmation feature in `ClientGameRunner.ts`, the troop count requirement (>10,000 troops) from issue #2137 was intentionally removed because it was arbitrary and troop count can be reported as low despite having significant land. The confirmation now triggers for any alive player regardless of troop count.

Applied to files:

  • src/client/graphics/layers/RadialMenuElements.ts
📚 Learning: 2025-10-20T20:15:28.858Z
Learnt from: sambokai
Repo: openfrontio/OpenFrontIO PR: 2225
File: src/core/execution/FakeHumanExecution.ts:51-51
Timestamp: 2025-10-20T20:15:28.858Z
Learning: In src/core/execution/FakeHumanExecution.ts, game balance constants like MIRV_COOLDOWN_TICKS, MIRV_HESITATION_ODDS, VICTORY_DENIAL_TEAM_THRESHOLD, VICTORY_DENIAL_INDIVIDUAL_THRESHOLD, and STEAMROLL_CITY_GAP_MULTIPLIER are experimental tuning parameters subject to frequent change during balance testing. Do not flag changes to these values as issues or compare them against previous values.

Applied to files:

  • src/client/graphics/layers/RadialMenuElements.ts
📚 Learning: 2025-05-31T18:15:03.445Z
Learnt from: 1brucben
Repo: openfrontio/OpenFrontIO PR: 977
File: src/core/execution/AttackExecution.ts:123-125
Timestamp: 2025-05-31T18:15:03.445Z
Learning: The removeTroops function in PlayerImpl.ts already prevents negative troop counts by using minInt(this._troops, toInt(troops)) to ensure it never removes more troops than available.

Applied to files:

  • src/client/graphics/layers/RadialMenuElements.ts
🧬 Code graph analysis (1)
src/client/graphics/layers/RadialMenuElements.ts (2)
src/client/graphics/layers/RadialMenu.ts (1)
  • TooltipItem (18-21)
src/core/game/UserSettings.ts (1)
  • quickDonateButtonsInFFA (202-204)
🪛 GitHub Actions: 🧪 CI
src/client/graphics/layers/RadialMenuElements.ts

[error] 663-663: TypeError: params.game.config is not a function


[error] 667-667: TypeError: params.game.config(...).gameConfig is not a function


[error] 663-663: TypeError: params.game.config(...).gameConfig is not a function


[error] 663-663: TypeError: params.game.config(...).gameConfig is not a function

🔇 Additional comments (2)
src/client/graphics/layers/RadialMenuElements.ts (2)

558-643: Clean implementation of dynamic center button.

The center button logic correctly switches between Attack and Donate Troops based on canDonateTroops. The implementation is consistent across disabled, action, icon, and color functions, with proper fallback to defaults.


236-236: Good color choice for gold donation.

Changing the Donate Gold button to use gold/yellow color (COLORS.tooltip.cost) instead of green makes it visually distinct from the Donate Troops button and thematically appropriate.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Nov 24, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/client/graphics/layers/RadialMenuElements.ts (1)

336-360: Call params.game.config() instead of passing params.game.config at line 376.

In the codebase, config is accessed as a method (e.g., this.mg.config(), this.game.config()). At line 376, the function call passes the method reference instead of invoking it. Change:

params.game.config,

to:

params.game.config(),
♻️ Duplicate comments (1)
src/client/graphics/layers/RadialMenuElements.ts (1)

667-667: Fix gameConfig property access - pipeline failure.

Line 667 calls params.game.config.gameConfig() but gameConfig is a property, not a method.

Apply this fix:

-    const gameMode = params.game.config.gameConfig().gameMode;
+    const gameMode = params.game.config.gameConfig.gameMode;
🧹 Nitpick comments (2)
src/client/graphics/layers/RadialMenuElements.ts (2)

640-643: Consider renaming for clarity.

The helper name shouldShowDonateTroops implies a UI visibility decision, but it only checks the canDonateTroops permission. Consider renaming to canDonateTroops or isDonateTroopsEnabled for clarity.

However, the logic correctly follows past feedback to rely solely on the canDonateTroops flag.


686-714: Consider extracting helper for donate gold visibility.

The logic at lines 686-692 and 707-714 has overlapping conditions (checking quick donate, permissions, and team/ally status). Extract a shared helper to reduce duplication and clarify the difference: shouldShowDonateGold requires own territory to replace Build, while the second check allows appending Donate Gold from any location.

Example:

const canShowDonateGoldToTarget = () => {
  return (
    params.selected &&
    shouldShowQuickDonateButtons() &&
    params.playerActions?.interaction?.canDonateGold &&
    (params.myPlayer.isOnSameTeam(params.selected) ||
      params.myPlayer.isAlliedWith(params.selected))
  );
};

const shouldShowDonateGold = isOwnTerritory && canShowDonateGoldToTarget();
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b8c2a55 and 3316618.

📒 Files selected for processing (1)
  • src/client/graphics/layers/RadialMenuElements.ts (8 hunks)
🧰 Additional context used
🧠 Learnings (7)
📓 Common learnings
Learnt from: scottanderson
Repo: openfrontio/OpenFrontIO PR: 1752
File: src/core/game/Game.ts:750-752
Timestamp: 2025-08-12T00:31:50.144Z
Learning: In the OpenFrontIO codebase, changes to the PlayerInteraction interface (like adding canDonateGold and canDonateTroops flags) do not require corresponding updates to src/core/Schemas.ts or server serialization code.
📚 Learning: 2025-06-16T03:03:59.778Z
Learnt from: VariableVince
Repo: openfrontio/OpenFrontIO PR: 1192
File: src/client/graphics/layers/RadialMenuElements.ts:312-314
Timestamp: 2025-06-16T03:03:59.778Z
Learning: In RadialMenuElements.ts, when fixing undefined params errors in subMenu functions, use explicit checks like `if (params === undefined || params.selected === null)` rather than optional chaining, as it makes the intent clearer and matches the specific error scenarios where params can be undefined during spawn phase operations.

Applied to files:

  • src/client/graphics/layers/RadialMenuElements.ts
📚 Learning: 2025-08-12T00:31:50.144Z
Learnt from: scottanderson
Repo: openfrontio/OpenFrontIO PR: 1752
File: src/core/game/Game.ts:750-752
Timestamp: 2025-08-12T00:31:50.144Z
Learning: In the OpenFrontIO codebase, changes to the PlayerInteraction interface (like adding canDonateGold and canDonateTroops flags) do not require corresponding updates to src/core/Schemas.ts or server serialization code.

Applied to files:

  • src/client/graphics/layers/RadialMenuElements.ts
📚 Learning: 2025-10-08T17:14:49.369Z
Learnt from: Foorack
Repo: openfrontio/OpenFrontIO PR: 2141
File: src/client/ClientGameRunner.ts:228-234
Timestamp: 2025-10-08T17:14:49.369Z
Learning: In `ClientGameRunner.ts`, the `myPlayer` field is always set when `shouldPreventWindowClose()` is called, so the null check in that method is sufficient without needing to fetch it again from `gameView.playerByClientID()`.

Applied to files:

  • src/client/graphics/layers/RadialMenuElements.ts
📚 Learning: 2025-10-20T20:15:28.858Z
Learnt from: sambokai
Repo: openfrontio/OpenFrontIO PR: 2225
File: src/core/execution/FakeHumanExecution.ts:51-51
Timestamp: 2025-10-20T20:15:28.858Z
Learning: In src/core/execution/FakeHumanExecution.ts, game balance constants like MIRV_COOLDOWN_TICKS, MIRV_HESITATION_ODDS, VICTORY_DENIAL_TEAM_THRESHOLD, VICTORY_DENIAL_INDIVIDUAL_THRESHOLD, and STEAMROLL_CITY_GAP_MULTIPLIER are experimental tuning parameters subject to frequent change during balance testing. Do not flag changes to these values as issues or compare them against previous values.

Applied to files:

  • src/client/graphics/layers/RadialMenuElements.ts
📚 Learning: 2025-10-08T17:14:49.369Z
Learnt from: Foorack
Repo: openfrontio/OpenFrontIO PR: 2141
File: src/client/ClientGameRunner.ts:228-234
Timestamp: 2025-10-08T17:14:49.369Z
Learning: For the window close confirmation feature in `ClientGameRunner.ts`, the troop count requirement (>10,000 troops) from issue #2137 was intentionally removed because it was arbitrary and troop count can be reported as low despite having significant land. The confirmation now triggers for any alive player regardless of troop count.

Applied to files:

  • src/client/graphics/layers/RadialMenuElements.ts
📚 Learning: 2025-05-31T18:15:03.445Z
Learnt from: 1brucben
Repo: openfrontio/OpenFrontIO PR: 977
File: src/core/execution/AttackExecution.ts:123-125
Timestamp: 2025-05-31T18:15:03.445Z
Learning: The removeTroops function in PlayerImpl.ts already prevents negative troop counts by using minInt(this._troops, toInt(troops)) to ensure it never removes more troops than available.

Applied to files:

  • src/client/graphics/layers/RadialMenuElements.ts
🧬 Code graph analysis (1)
src/client/graphics/layers/RadialMenuElements.ts (2)
src/client/graphics/layers/RadialMenu.ts (1)
  • TooltipItem (18-21)
src/core/game/UserSettings.ts (1)
  • quickDonateButtonsInFFA (202-204)
🪛 GitHub Actions: 🧪 CI
src/client/graphics/layers/RadialMenuElements.ts

[error] 340-340: TypeError: config.isUnitDisabled is not a function


[error] 340-340: TypeError: config.isUnitDisabled is not a function


[error] 340-340: TypeError: config.isUnitDisabled is not a function


[error] 340-340: TypeError: config.isUnitDisabled is not a function


[error] 340-340: TypeError: config.isUnitDisabled is not a function


[error] 340-340: TypeError: config.isUnitDisabled is not a function


[error] 340-340: TypeError: config.isUnitDisabled is not a function


[error] 340-340: TypeError: config.isUnitDisabled is not a function


[error] 340-340: TypeError: config.isUnitDisabled is not a function


[error] 340-340: TypeError: config.isUnitDisabled is not a function


[error] 340-340: TypeError: config.isUnitDisabled is not a function


[error] 340-340: TypeError: config.isUnitDisabled is not a function


[error] 340-340: TypeError: config.isUnitDisabled is not a function


[error] 340-340: TypeError: config.isUnitDisabled is not a function


[error] 340-340: TypeError: config.isUnitDisabled is not a function


[error] 340-340: TypeError: config.isUnitDisabled is not a function


[error] 667-667: TypeError: params.game.config.gameConfig is not a function


[error] 667-667: TypeError: params.game.config.gameConfig is not a function


[error] 667-667: TypeError: params.game.config.gameConfig is not a function


[error] 667-667: TypeError: params.game.config.gameConfig is not a function


[error] 667-667: TypeError: params.game.config.gameConfig is not a function


[error] 667-667: TypeError: params.game.config.gameConfig is not a function


[error] 667-667: TypeError: params.game.config.gameConfig is not a function


[error] 667-667: TypeError: params.game.config.gameConfig is not a function


[error] 667-667: TypeError: params.game.config.gameConfig is not a function


[error] 667-667: TypeError: params.game.config.gameConfig is not a function


[error] 667-667: TypeError: params.game.config.gameConfig is not a function

🔇 Additional comments (3)
src/client/graphics/layers/RadialMenuElements.ts (3)

48-87: LGTM - interface additions support dynamic donate UI.

The new SplitButtonAction interface and extensions to MenuElement and CenterButtonElement are well-typed and align with the PR objectives to add flexible donate button options.


558-637: LGTM - center button logic correctly implements donate troops.

The center button now dynamically switches between spawn/attack/donate-troops based on context. The logic flow is clean with early returns, and the icon/color functions properly reflect the action state.


676-678: userSettings() API is correct.

Verification confirms userSettings() is a method on Config that returns UserSettings. The call at line 677 is correct and consistent with usage throughout the codebase.

@evanpelle

Copy link
Copy Markdown
Collaborator

looks like the build is failing

@ryanbarlow97
ryanbarlow97 marked this pull request as draft December 2, 2025 19:48
@iiamlewis

Copy link
Copy Markdown
Contributor

Closed during PR review

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.

5 participants