Skip to content

Conversation

VariableVince
Copy link
Contributor

@VariableVince VariableVince commented May 18, 2025

Description:

Fixes the Player Info Panel top part being out of view, at least on some screen resolutions. Workaround was changing browser zoom from 100% to 80%, or to scroll to change the vertical position of the panel. This is now not needed anymore.

Also disables vertical scrolling of the position of the panel itself. And prevents zooming the background game map.

Position is still not perfect on all resolutions but the top or bottom won't be out of view anymore. Tested using DevTools. I don't have the option to deploy a branch (yet?), this may be needed so others can test on their screens just to be sure.

Normally the current "top-1/2 -translate-y-1/2" should have done the trick and put the vertical position at 50% of the screen. The root cause of this not working on all screens may be a parent element or something else, but touching that could create new UI issues. So fixing it from within PlayerPanel.ts itself seemed the best choice here.

!! The only actual changes are in lines 228-237. The rest are shifts in positions or from prettier.

Before:
Before

scrollbug

After (don't mind the empty player name box, the fix for that bug isn't in main yet #795):
After 1920x1200

Please complete the following:

  • I have added screenshots for all UI updates
  • I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced
  • I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors

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

tryout33

Copy link
Contributor

coderabbitai bot commented May 18, 2025

Walkthrough

The player panel UI in the client graphics layer was refactored for improved layout and interaction. The container structure and styling were updated, new action buttons were added, label text was corrected, embargo button presentation was revised, and event handling was adjusted. All changes are internal to the render method.

Changes

File(s) Change Summary
src/client/graphics/layers/PlayerPanel.ts Refactored player panel container and layout, updated styling, added new action buttons (donate gold, emoji), corrected label text, revised embargo button presentation, and adjusted event handling in the render method.

Poem

In the warren of code, a panel anew,
With buttons for gold and emojis too!
Scroll if you wish, the layout’s just right,
Embargo or trade, all clear in your sight.
The rabbit devs cheer, their whiskers a-twitch—
For UI refactors that go off without a hitch!
🐇✨

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm warn config production Use --omit=dev instead.
npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error https://github.com/npm/cli/issues
npm error A complete log of this run can be found in: /.npm/_logs/2025-05-18T15_36_44_714Z-debug-0.log

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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)
src/client/graphics/layers/PlayerPanel.ts (1)

408-411: Consider consistent width styling for embargo buttons

The embargo buttons use w-100 while other action buttons use w-10. If w-100 is intended to make these buttons wider (which makes sense for text labels), consider using a more standard Tailwind class like w-full or a specific pixel width like w-[100px].

-    class="w-100 h-10 flex items-center justify-center
+    class="w-full h-10 flex items-center justify-center
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 332629d and 00bf655.

📒 Files selected for processing (1)
  • src/client/graphics/layers/PlayerPanel.ts (1 hunks)
🔇 Additional comments (6)
src/client/graphics/layers/PlayerPanel.ts (6)

227-231: Great improvements to panel positioning

The change from absolute positioning to a fixed, full-screen flex container ensures the panel is always centered in the viewport, addressing the PR's main objective of fixing vertical positioning issues.

The addition of pointer-events-none on the container with the wheel event handler is an excellent approach to prevent interaction with the game map behind the panel while still capturing scroll events.


232-234: Well-implemented responsive constraints

Limiting the panel height to 90% of viewport (max-h-[90vh]) with overflow-y-auto ensures the panel is fully visible regardless of screen resolution while still allowing access to all content if it exceeds the viewport.

The pointer-events-auto effectively restores interaction only for the panel elements.


235-246: Improved modal structure with better close button positioning

The dedicated container for background styling and the absolute positioning of the close button slightly outside the panel (-top-2 -right-2) improves accessibility and follows standard design patterns for modal interfaces.


248-320: Well-organized content sections with consistent styling

The reorganized content with clear section comments and consistent flex layouts improves code readability and creates a more uniform design. The grid layout for resources is particularly effective.


383-403: Enhanced functionality with additional action buttons

The addition of donate gold and emoji buttons expands the panel's functionality while maintaining consistent styling with the existing buttons.


405-425:

✅ Verification successful

Verify the embargo button labels

The label texts for embargo actions may be counterintuitive. The button for initiating an embargo (lines 406-413) shows "stop_trade", while the button for stopping an embargo (lines 415-424) shows "start_trade". Consider verifying if these labels match the intended user actions.


🏁 Script executed:

#!/bin/bash
# Check the translation keys for player panel embargo actions
rg -A 2 "player_panel.stop_trade|player_panel.start_trade" --type json

Length of output: 72


Embargo button labels are correctly aligned with their actions

The canEmbargo flag represents whether trading is currently allowed.

  • When canEmbargo is true, you’re allowed to initiate an embargo (stop trading), so showing "player_panel.stop_trade" (“Stop Trade”) is correct.
  • When canEmbargo is false, an embargo is in place and trading is blocked, so showing "player_panel.start_trade" (“Start Trade”) to lift the embargo is also correct.

No changes needed.

@VariableVince
Copy link
Contributor Author

VariableVince commented May 18, 2025

Coderabbit is wrong here "new action buttons were added, label text was corrected, embargo button presentation was revised, and event handling was adjusted.". The only actual changes are on lines 228-237, the rest is shifts and from prettier.

I'm not for following the nitpick comment to change Embargo button class. Don't fix what isn't broken as it doesn't have to do with the scope of this PR. But if you want me to, i can change it.

@JustSamuel
Copy link

Coderabbit is wrong here "new action buttons were added, label text was corrected, embargo button presentation was revised, and event handling was adjusted.". The only actual changes are on lines 228-237, the rest is shifts and from prettier.

Would it not be possible to disable the Coderabbitai @evanpelle? Or at least make it a bit less verbose and agressive? The copilot AI strikes a fine-enough balance between giving feedback and being annoying.

Copy link
Collaborator

@evanpelle evanpelle left a comment

Choose a reason for hiding this comment

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

Thanks!

@github-project-automation github-project-automation bot moved this from Triage to Final Review in OpenFront Release Management May 18, 2025
@evanpelle evanpelle merged commit 88d9707 into openfrontio:main May 18, 2025
6 checks passed
@github-project-automation github-project-automation bot moved this from Final Review to Complete in OpenFront Release Management May 18, 2025
@VariableVince VariableVince deleted the playerpanel-position branch May 18, 2025 21:45
scottanderson pushed a commit that referenced this pull request May 18, 2025
## Description:
Fixes the Player Info Panel top part being out of view, at least on some
screen resolutions. Workaround was changing browser zoom from 100% to
80%, or to scroll to change the vertical position of the panel. This is
now not needed anymore.

Also disables vertical scrolling of the position of the panel itself.
And prevents zooming the background game map.

Position is still not perfect on all resolutions but the top or bottom
won't be out of view anymore. Tested using DevTools. I don't have the
option to deploy a branch (yet?), this may be needed so others can test
on their screens just to be sure.

Normally the current "top-1/2 -translate-y-1/2" should have done the
trick and put the vertical position at 50% of the screen. The root cause
of this not working on all screens may be a parent element or something
else, but touching that could create new UI issues. So fixing it from
within PlayerPanel.ts itself seemed the best choice here.

!! The only actual changes are in lines 228-237. The rest are shifts in
positions or from prettier.

Before:

![Before](https://github.com/user-attachments/assets/776bf8d8-a539-4228-8eec-4fae004e004e)


![scrollbug](https://github.com/user-attachments/assets/b8375818-220d-41a3-aaa7-a65b2cb0729c)


After (don't mind the empty player name box, the fix for that bug isn't
in main yet #795):
![After
1920x1200](https://github.com/user-attachments/assets/5a46e38b-bac6-4535-8186-60ae6bbd7c24)


## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

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

tryout33
@scottanderson scottanderson added this to the v23 milestone May 21, 2025
@coderabbitai coderabbitai bot mentioned this pull request Jun 21, 2025
5 tasks
@coderabbitai coderabbitai bot mentioned this pull request Jul 8, 2025
5 tasks
@coderabbitai coderabbitai bot mentioned this pull request Aug 25, 2025
This was referenced Sep 12, 2025
@coderabbitai coderabbitai bot mentioned this pull request Sep 23, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

4 participants