Skip to content

Add discord logo next to login button #1637

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

icslucas
Copy link
Contributor

@icslucas icslucas commented Jul 30, 2025

Description:

Add discord logo next to login button
Describe the PR.
Add discord logo next to login button
image

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
  • I have read and accepted the CLA agreement (only required once).

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

Lucas

Copy link
Contributor

coderabbitai bot commented Jul 30, 2025

Walkthrough

This change adds support for displaying an icon in button components. It introduces a new icon property to the button, updates its rendering to show the icon if set, and sets the Discord icon for the login button when the user is not logged in. No other logic or exported APIs are modified.

Changes

Cohort / File(s) Change Summary
Button Icon Support
src/client/components/baseComponents/Button.ts
Adds icon property to OButton component; updates rendering to optionally display an icon image before button text inside a flex container.
Login Button Icon Assignment
src/client/Main.ts
Sets icon property of loginDiscordButton to "discord.svg" when user is not logged in.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Main
    participant OButton

    User->>Main: Loads app
    Main->>OButton: Sets loginDiscordButton properties (disable, hidden, translationKey, icon)
    OButton->>OButton: Renders button with icon (if set) and text
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • Logout Button Fix  #1234: Both PRs modify the loginDiscordButton properties in src/client/Main.ts related to user login state handling, but the main PR adds an icon assignment while the retrieved PR fixes button visibility on logout, indicating related changes to the same UI element's state management.

Suggested reviewers

  • tnhnblgl
  • evanpelle

Poem

Buttons now shine with icons bright,
Discord's face joins the login light.
A flexy span, an image new,
Makes the interface fresh for you.
With every click, a friendly face—
Clean TypeScript code, a tidy place!
🎨✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 05bdca3 and 55bd680.

📒 Files selected for processing (1)
  • src/client/Main.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/client/Main.ts
⏰ 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)
  • GitHub Check: Analyze (javascript-typescript)

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
🪧 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.
  • 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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.

@icslucas icslucas marked this pull request as ready for review July 30, 2025 18:38
@icslucas icslucas requested a review from a team as a code owner July 30, 2025 18:38
coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 30, 2025
@icslucas icslucas self-assigned this Jul 30, 2025
@icslucas icslucas added the UI/UX UI/UX changes including assets, menus, QoL, etc. label Jul 30, 2025
@icslucas icslucas added this to the v25 milestone Jul 30, 2025
Copy link
Contributor

@scottanderson scottanderson left a comment

Choose a reason for hiding this comment

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

You checked the box saying you attached screenshots, but there's no screenshots attached.

@github-project-automation github-project-automation bot moved this from Triage to Development in OpenFront Release Management Jul 30, 2025
Copy link
Contributor

@drillskibo drillskibo left a comment

Choose a reason for hiding this comment

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

Checking "I added screenshots" without adding screenshots? Please edit PR accordingly.

@icslucas icslucas requested a review from scottanderson July 31, 2025 18:29
drillskibo
drillskibo previously approved these changes Jul 31, 2025
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: 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 5918aa4 and 69c3568.

📒 Files selected for processing (1)
  • src/client/components/baseComponents/Button.ts (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: VariableVince
PR: openfrontio/OpenFrontIO#1655
File: resources/maps/giantworldmap/manifest.json:165-174
Timestamp: 2025-07-31T12:03:08.052Z
Learning: In OpenFrontIO draft PRs, flag names in map manifest files may be placeholders that will be updated to match the actual SVG flag file names when the assets are received. The final naming depends on the actual flag SVG files provided, not code naming conventions.
Learnt from: andrewNiziolek
PR: openfrontio/OpenFrontIO#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.
Learnt from: its-sii
PR: openfrontio/OpenFrontIO#1089
File: src/client/graphics/layers/ControlPanel.ts:160-183
Timestamp: 2025-06-07T20:01:52.720Z
Learning: The user its-sii prefers simpler, more readable code over complex type-safe approaches when the benefits don't justify the added complexity. They value maintainability and clarity in code implementation.
🪛 Biome (2.1.2)
src/client/components/baseComponents/Button.ts

[error] 10-10: expected a semicolon to end the class property, but found none

(parse)


[error] 10-10: Expected an identifier, a string literal, a number literal, a private field name, or a computed name but instead found '{'.

Expected an identifier, a string literal, a number literal, a private field name, or a computed name here.

(parse)


[error] 10-10: expected a semicolon to end the class property, but found none

(parse)


[error] 10-10: Expected an identifier, a string literal, a number literal, a private field name, or a computed name but instead found ','.

Expected an identifier, a string literal, a number literal, a private field name, or a computed name here.

(parse)


[error] 10-10: Expected a semicolon or an implicit semicolon after a statement, but found none

An explicit or implicit semicolon is expected here...

...Which is required to end this statement

(parse)


[error] 11-11: Shouldn't redeclare 'customElement'. Consider to delete it or rename it.

'customElement' is defined here:

(lint/suspicious/noRedeclare)


[error] 11-11: Shouldn't redeclare 'property'. Consider to delete it or rename it.

'property' is defined here:

(lint/suspicious/noRedeclare)


[error] 12-12: Shouldn't redeclare 'classMap'. Consider to delete it or rename it.

'classMap' is defined here:

(lint/suspicious/noRedeclare)


[error] 13-13: Shouldn't redeclare 'translateText'. Consider to delete it or rename it.

'translateText' is defined here:

(lint/suspicious/noRedeclare)


[error] 16-16: Shouldn't redeclare 'OButton'. Consider to delete it or rename it.

'OButton' is defined here:

(lint/suspicious/noRedeclare)

🪛 GitHub Check: 🔍 ESLint
src/client/components/baseComponents/Button.ts

[failure] 10-10:
Parsing error: Unexpected token. A constructor, method, accessor, or property was expected.

⏰ 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: Analyze (javascript-typescript)
  • GitHub Check: Deploy to openfront.dev
🔇 Additional comments (1)
src/client/components/baseComponents/Button.ts (1)

76-83: Clean icon implementation - looks good!

Once the duplication is fixed, the icon functionality is well implemented. The flex layout properly centers the icon and text, and the conditional rendering keeps the template clean.

@@ -299,6 +299,7 @@ class Client {
loginDiscordButton.disable = false;
loginDiscordButton.hidden = false;
loginDiscordButton.translationKey = "main.login_discord";
loginDiscordButton.icon = "discord.svg";
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should also be cleared on the other events where we set translationKey

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ icslucas
❌ drillskibo
You have signed the CLA already but the status is still pending? Let us recheck it.

@drillskibo drillskibo added the Feature - Frontend An entirely new feature, or changes to existing feature. User facing. label Aug 5, 2025
@scottanderson
Copy link
Contributor

@icslucas are you still planning to update this PR?

@scottanderson scottanderson modified the milestones: v25, v26 Aug 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature - Frontend An entirely new feature, or changes to existing feature. User facing. UI/UX UI/UX changes including assets, menus, QoL, etc.
Projects
Status: Development
Development

Successfully merging this pull request may close these issues.

4 participants