Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@petrvecera
Copy link
Member

@petrvecera petrvecera commented Nov 28, 2025

Summary by CodeRabbit

  • New Features
    • Battlegroups now display their proper names in the interface
    • Unit upgrade cards show enhanced information including brief descriptions and associated icons

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 28, 2025

Walkthrough

The changes add a new name field to battlegroup data structures throughout the processing pipeline—from mapping and resolving to component rendering—enabling the display of battlegroup names via the UnitUpgradeCard component.

Changes

Cohort / File(s) Change Summary
Battlegroup data structure enrichment
src/unitStats/battlegroup.ts, src/unitStats/mappingBattlegroups.ts
Added name: string field to BattlegroupResolvedType and BattlegroupsType. Field is populated from rawBattlegroup.name in resolution pipeline and resolved via resolveLocstring in mapping layer, with fallback to empty string.
Battlegroup card rendering update
components/unit-cards/battlegroup-card.tsx
Destructured name field from resolved battlegroup items. Updated UnitUpgradeCard invocation to pass name as screen_name and added new descriptor fields: brief_text, icon_name, and brief_text_formatter sourced from uiParent properties.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Field additions follow a consistent pattern across all three files with no complex logic
  • Changes are homogeneous (same field propagation applied uniformly)
  • Verify type consistency for BattlegroupResolvedType and BattlegroupsType in all usages
  • Confirm resolveLocstring handles null/undefined cases for techTreeBag.name appropriately

Poem

A name for each battlegroup, now shining bright,
Through mapping and resolving, threaded just right,
The cards will display them with newfound grace,
Data flows smoothly through the entire space,
🐰 hops — Another field stitched with care!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Change the naming of the battlegroups' directly relates to the main changeset, which adds a name field to battlegroup types and updates UI rendering to use this new name property.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-bg-names

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
components/unit-cards/battlegroup-card.tsx (1)

94-94: Consider fallback to uiParent.screenName for empty names.

The screen_name now uses the new name field directly. If the battlegroup name is empty (due to missing or failed localization in mappingBattlegroups.ts line 63), this could result in a blank display.

Consider adding a fallback:

-  screen_name: name,
+  screen_name: name || uiParent.screenName,

This ensures that if the new name field is empty, the UI falls back to the existing uiParent.screenName value, maintaining backward compatibility.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a3d622b and 6ba776f.

📒 Files selected for processing (3)
  • components/unit-cards/battlegroup-card.tsx (1 hunks)
  • src/unitStats/battlegroup.ts (2 hunks)
  • src/unitStats/mappingBattlegroups.ts (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/unitStats/mappingBattlegroups.ts (1)
src/unitStats/locstring.ts (1)
  • resolveLocstring (94-94)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build and run prettier
  • GitHub Check: Deploy Web Preview
🔇 Additional comments (7)
src/unitStats/battlegroup.ts (2)

57-57: LGTM: Clean type extension.

The name field is properly typed and documented, following the existing code style.


135-135: LGTM: Field properly populated.

The name is correctly passed through from the raw battlegroup data.

src/unitStats/mappingBattlegroups.ts (3)

13-13: LGTM: Type field added correctly.

The name field follows the existing type structure and is properly documented.


39-39: LGTM: Initialization follows existing pattern.

The empty string default is consistent with other field initializations in the same object.


63-63: I'll help you verify the concerns raised in this review comment. Let me start by examining the relevant code to understand the context and potential issues.
<function_calls>

#!/bin/bash

First, let's understand the structure and find the files mentioned

echo "=== Finding relevant files ==="
find . -type f -name "mappingBattlegroups.ts" 2>/dev/null | head -20
find . -type f -name "battlegroup-card.tsx" 2>/dev/null | head -20


</function_calls>
<function_calls>

#!/bin/bash

Read the mappingBattlegroups.ts file to see context around line 63

echo "=== Examining mappingBattlegroups.ts ==="
cat -n src/unitStats/mappingBattlegroups.ts | sed -n '1,80p'


</function_calls>
<function_calls>

#!/bin/bash

Find and read the battlegroup-card.tsx file, especially around line 94

echo "=== Finding battlegroup-card.tsx ==="
find . -type f -name "battlegroup-card.tsx" 2>/dev/null

echo "=== Examining battlegroup-card.tsx ==="
if [ -f "src/components/battlegroup-card.tsx" ]; then
cat -n src/components/battlegroup-card.tsx | sed -n '80,110p'
fi


</function_calls>
<function_calls>

#!/bin/bash

Let's search for where resolveLocstring is defined and what it does

echo "=== Finding resolveLocstring definition ==="
rg -n "resolveLocstring" --type=ts --type=tsx -B2 -A5 | head -50


</function_calls>
<function_calls>

#!/bin/bash

Search for uiParent usage and screenName to understand previous behavior

echo "=== Searching for uiParent and screenName usage ==="
rg -n "uiParent" --type=ts --type=tsx -C3 | head -80

echo ""
echo "=== Searching for screenName usage ==="
rg -n "screenName" --type=ts --type=tsx -C2 | head -80


</function_calls>

components/unit-cards/battlegroup-card.tsx (2)

86-86: LGTM: Clean destructuring.

The name field is properly extracted from the resolved battlegroup data.


98-100: All new desc fields are correctly typed and match UnitUpgradeCard expectations.

The three new fields (brief_text, icon_name, brief_text_formatter) are all part of the UnitUpgradeDescription type (defined in unit-upgrade-card.tsx lines 24-39):

  • brief_text: string | null — correctly assigned uiParent.briefText
  • icon_name: string — correctly assigned uiParent.iconName
  • brief_text_formatter: string — correctly set to empty string ""

The desc object includes all required fields and matches the pattern used in UnitUpgradeCard (lines 168-176) and ConstructableCard (lines 190-197) in the same file. No type mismatches or missing fields.

@github-actions
Copy link
Contributor

🌐 Branch deployed as preview to:
https://coh3-stats-g7hw7al5f-cohstats.vercel.app

@petrvecera petrvecera merged commit 569b2bf into master Nov 28, 2025
6 checks passed
@petrvecera petrvecera deleted the fix-bg-names branch November 29, 2025 15:49
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.

2 participants