Repository navigation
bug fix?: Hide UnitDisplay frame when all unit types are disabled - #1392
Conversation
WalkthroughThe Changes
Possibly related PRs
Suggested reviewers
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
npm error Exit handler never called! 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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). (1)
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
| const allDisabled = | ||
| config.isUnitDisabled(UnitType.City) && | ||
| config.isUnitDisabled(UnitType.Factory) && | ||
| config.isUnitDisabled(UnitType.Port) && | ||
| config.isUnitDisabled(UnitType.DefensePost) && | ||
| config.isUnitDisabled(UnitType.MissileSilo) && | ||
| config.isUnitDisabled(UnitType.SAMLauncher); |
There was a problem hiding this comment.
Cache this boolean since it cannot change during the game
|
Can @openfrontio/core-contributor do a final pass and resolve pending changes so that it can be merged? |
drillskibo
left a comment
There was a problem hiding this comment.
lgtm with cache functionality.
Description:
This PR updates the UnitDisplay component so that when all unit types (City, Factory, Port, Defense Post, Missile Silo, SAM Launcher) are disabled in the game config, the UI frame itself will also be hidden.
This is a box that shows how many and what types of units the player currently owns.
There’s a feature where, if unit types are disabled in the settings, the corresponding parts of the UI will disappear.
However, if all unit types are disabled, for some reason the outer container still remains visible.
While this might not be a critical issue, I feel it’s unnecessary and redundant, so I’d like to remove it.
Alternatively, we could consider keeping the box as a kind of placeholder to indicate that some kind of menu might appear there.
But since it serves no purpose during gameplay in that state, I think it would just be meaningless UI.
before


after

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