Skip to content
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

[Port] Log Actions In The Chat / Логирование Действий В Чат #57

Merged
merged 4 commits into from
Sep 15, 2024

Conversation

Spatison
Copy link
Member

@Spatison Spatison commented Sep 14, 2024

Описание PR

Порт логирование действий в чат.


Медиа

Видео

Изменения

🆑 Spatison

  • add: Added Logging Of Chat Action / Добавлено Логирование Действий В Чат

@Spatison Spatison self-assigned this Sep 14, 2024
@Spatison Spatison requested a review from Remuchi September 14, 2024 12:02
Copy link
Contributor

coderabbitai bot commented Sep 14, 2024

Walkthrough

The pull request introduces a new checkbox, LogInChatCheckBox, in the MiscTab.xaml file, allowing users to enable or disable chat logging. This functionality is integrated into the MiscTab.xaml.cs file, where the checkbox state influences the "Apply" button's status. Additionally, the PopupSystem.cs file is updated to log messages in the chat based on the checkbox's state. A new boolean configuration variable, LogInChat, is added to the WhiteCVars class to manage this feature. Localization entries for the new option are also included in both English and Russian.

Changes

Files Change Summary
Content.Client/Options/UI/Tabs/MiscTab.xaml, Content.Client/Options/UI/Tabs/MiscTab.xaml.cs Added LogInChatCheckBox for chat login options, integrated with the apply button logic.
Content.Client/Popups/PopupSystem.cs Introduced logging feature for popups, conditional on the LogInChat configuration variable.
Content.Shared/_White/CVars.cs Added new configuration variable LogInChat to control chat logging functionality.
Resources/Locale/en-US/_white/escape-menu/options-menu.ftl Added localization entry for chat logging option in the English locale.
Resources/Locale/ru-RU/_white/escape-menu/options-menu.ftl Added localization entry for chat logging option in the Russian locale.

Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a1dab8d and 199e486.

Files selected for processing (1)
  • Content.Client/Popups/PopupSystem.cs (4 hunks)
Additional comments not posted (3)
Content.Client/Popups/PopupSystem.cs (3)

46-56: LGTM!

The new _shouldLogInChat variable and FontSizeDict dictionary are well-defined and will be useful for the logging functionality.


75-79: LGTM!

Initializing the _shouldLogInChat variable based on the configuration and subscribing to configuration changes is a good approach for managing the logging feature.


109-128: LGTM!

The conditional logging based on _shouldLogInChat, the range check for the local player entity, and the formatting of the message using FontSizeDict are all well-implemented.

Creating a ChatMessage object and processing it through the ChatUIController is the appropriate way to display the message in the chat UI.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @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.

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 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: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4cfbc4e and a13bfc6.

Files selected for processing (6)
  • Content.Client/Options/UI/Tabs/MiscTab.xaml (1 hunks)
  • Content.Client/Options/UI/Tabs/MiscTab.xaml.cs (5 hunks)
  • Content.Client/Popups/PopupSystem.cs (4 hunks)
  • Content.Shared/_White/CVars.cs (2 hunks)
  • Resources/Locale/en-US/_white/escape-menu/options-menu.ftl (1 hunks)
  • Resources/Locale/ru-RU/_white/escape-menu/options-menu.ftl (1 hunks)
Additional comments not posted (11)
Resources/Locale/en-US/_white/escape-menu/options-menu.ftl (2)

1-1: LGTM!

The new localization entry for the chat logging option is clear and aligns with the PR objective. The text accurately describes the purpose of the option.


3-3: Existing entry is retained.

The existing entry for opening the emotions menu is retained, ensuring backward compatibility and preserving the existing functionality.

Resources/Locale/ru-RU/_white/escape-menu/options-menu.ftl (1)

1-1: LGTM!

The added localization string for logging actions in chat is correctly formatted and positioned. It aligns with the PR objective of implementing chat logging functionality.

Content.Shared/_White/CVars.cs (1)

34-40: LGTM!

The new configuration variable LogInChat is correctly defined in the WhiteCVars class. The variable is created with appropriate default value and flags. The new region OptionsMisc helps improve code organization.

Content.Client/Options/UI/Tabs/MiscTab.xaml (1)

56-56: LGTM!

The new checkbox for enabling/disabling chat logging is implemented correctly. The localized text is bound appropriately.

Content.Client/Options/UI/Tabs/MiscTab.xaml.cs (3)

3-3: LGTM!

The addition of the using statement for Content.Shared._White namespace is correct and necessary for using types from that namespace in this file.


84-84: LGTM!

The event subscription for LogInChatCheckBox.OnToggled is correctly added, ensuring that the OnCheckBoxToggled method is called when the checkbox state changes.


103-103: LGTM!

The initialization of LogInChatCheckBox.Pressed based on the WhiteCVars.LogInChat configuration value is correct, ensuring that the checkbox state matches the configuration when the UI is loaded.

Content.Client/Popups/PopupSystem.cs (3)

46-47: LGTM!

The _isLogging variable is correctly declared and initialized. The purpose of the variable is clear from the name and the comment.


66-69: LGTM!

The changes to the Initialize method are correctly implemented. The changes allow the logging state to be dynamically updated based on the configuration.


99-126: LGTM!

The changes to the PopupMessage method are correctly implemented. The changes enhance the user experience by providing visual feedback in the chat when popups are displayed, contingent on the logging setting. The changes integrate the popup system with the chat system, allowing for better communication of popup messages to players.

Content.Client/Options/UI/Tabs/MiscTab.xaml.cs Outdated Show resolved Hide resolved
@HellCatten
Copy link
Contributor

Нужны скрины из игры

Content.Client/Popups/PopupSystem.cs Outdated Show resolved Hide resolved
Content.Client/Popups/PopupSystem.cs Outdated Show resolved Hide resolved
@Spatison Spatison requested a review from Remuchi September 15, 2024 15:12
@Remuchi Remuchi merged commit 1705179 into master Sep 15, 2024
10 of 11 checks passed
@Remuchi Remuchi deleted the log-chat-actions branch September 15, 2024 16:06
riddleridou added a commit that referenced this pull request Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants