8000 better level chat by smallst · Pull Request #7943 · codecombat/codecombat · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

better level chat #7943

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

Merged
merged 1 commit into from
Mar 19, 2025
Merged

better level chat #7943

merged 1 commit into from
Mar 19, 2025

Conversation

smallst
Copy link
Contributor
@smallst smallst commented Mar 18, 2025

fix ENG-1710
image
the credit message popover can't closed if the user forget to click the question mark again and the problemAlert view auto hide. so I add a 3s auto close function. the double click still be able to close the popover, and if not, popover would auto closed in 3s.

other updates are mainly about i18n.

Summary by CodeRabbit

  • New Features
    • Enhanced localization for credit duration messages with new time keys (hour, day, week, month) for greater clarity.
    • Updated language support to provide more detailed and user-friendly credit notifications.
    • Improved chat formatting for code snippets, offering a clearer and more distinctive presentation.
    • Refined hint interactions with popovers that now auto-hide after a short delay, and smoother solution display transitions.

Copy link
Contributor
coderabbitai bot commented Mar 18, 2025

Walkthrough

This pull request refines the localization and UI behavior for chat credit messages and related components. The levelChatCreditsString function now derives a new internationalized key for improved messaging. Translation files are updated with additional keys for hourly, daily, weekly, and monthly durations. In the UI, adjustments include a change in the formatting of code snippets, auto-hiding popovers on chatbot hints after 3000 milliseconds, and ensuring the solution display becomes fully opaque when toggled.

Changes

File(s) Change Summary
app/lib/user-utils.js Updated levelChatCreditsString to derive an i18nKey from durationKey and use it in return statements for localized messages.
app/locale/en.js, app/locale/zh-HANS.js Added new translation keys: level_chat_duration_hour, level_chat_duration_day, level_chat_duration_week, level_chat_duration_month; enhanced messages for remaining AI chat credits.
app/views/play/level/LevelChatView.coffee, app/views/play/level/tome/ProblemAlertView.coffee, app/views/play/level/tome/SpellView.coffee Modified comment formatting in code snippets, updated popover initialization to auto-hide after a click on elements with .chatbot-hint, and set the solution element’s opacity to 1 upon toggling.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ChatbotHint as Chatbot Hint Element
    participant PAV as ProblemAlertView
    participant Timer as Timeout
    User->>ChatbotHint: Click on chatbot hint
    ChatbotHint->>PAV: Trigger popover initialization
    PAV->>Timer: Set timeout (3000ms) for popover hide
    Timer-->>PAV: Timer expires
    PAV->>ChatbotHint: Hide popover
Loading
sequenceDiagram
    participant User
    participant SV as SpellView
    participant Solution as Solution Element
    User->>SV: Toggle solution display
    alt Solution is hidden
        SV->>Solution: Add 'display' class
        SV->>Solution: Set opacity = 1
        SV->>SV: Publish message to hide problem alert
    else Solution is visible
        SV->>Solution: Remove 'display' class
    end
Loading

Assessment against linked issues

Objective Addressed Explanation
Level chat number tips auto-close after a set duration [ENG-1710]

Possibly related PRs

  • clean code #7522: Involved modifications to the levelChatCreditsString function for user credits messaging.
  • Yuqiang/new modals #7827: Addressed updates to localization strings similar to the translation keys added here.
  • update solution views #7543: Modified the solution display behavior in the SpellView class, aligning with the opacity change.

Suggested reviewers

  • mrfinch

Poem

I'm a merry rabbit hopping through code,
With keys and messages in a light new mode.
Popovers vanish in a blink of 3 seconds' flight,
And solutions shine at full, gleaming light.
Carrots and code, together in a celebratory cheer,
Here's to clean changes we hold so dear!
🐰✨

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.
✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • 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 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 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 generate docstrings to generate docstrings for 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 (4)
app/locale/zh-HANS.js (1)

5469-5477: Minor spacing nit: Consider unifying around parentheses.
The spacing in “没有 AI 问答次数了( 这一__duration_key__)” and “( 这 duration_amount duration_key)” might look a bit inconsistent. Consider removing extra spaces for a cleaner look, e.g. "没有 AI 问答次数了 (这一__duration_key__)".

app/views/play/level/tome/SpellView.coffee (1)

1849-1849: Consider adding a fade-in transition for a smoother user experience.

Currently, setting solution.style.opacity = 1 works correctly for immediate visibility, but a small fade-in animation could enhance the transition.

app/views/play/level/tome/ProblemAlertView.coffee (1)

70-71: Consider clearing old timeouts on repeated clicks.

Hiding the popover after 3 seconds is fine. If the user clicks multiple times quickly, multiple setTimeouts may stack. A simple check or clearing the previous timeout could resolve potential overlaps.

app/views/play/level/LevelChatView.coffee (1)

94-94: Remove or clarify commented-out code.

This line is inactive. If no longer needed, consider removing it or adding a comment explaining its future use.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1f4014a and 07594d0.

📒 Files selected for processing (6)
  • app/lib/user-utils.js (1 hunks)
  • app/locale/en.js (1 hunks)
  • app/locale/zh-HANS.js (2 hunks)
  • app/views/play/level/LevelChatView.coffee (1 hunks)
  • app/views/play/level/tome/ProblemAlertView.coffee (1 hunks)
  • app/views/play/level/tome/SpellView.coffee (1 hunks)
👮 Files not reviewed due to content moderation or server errors (1)
  • app/locale/en.js
🔇 Additional comments (2)
app/locale/zh-HANS.js (1)

1050-1050: Translation addition looks good.
No issues found with “隐藏” for “chat_fix_hide.”

app/lib/user-utils.js (1)

96-96: Localization key usage looks good.

Using i18nKey for duration-based messages is consistent and improves localization. No issues found.

Also applies to: 99-99, 101-101, 105-105, 107-107

@smallst smallst merged commit fa231d5 into master Mar 19, 2025
3 checks passed
@smallst smallst deleted the yuqiang/level-chat-updates branch March 19, 2025 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@coderabbitai coderabbitai[bot] coderabbitai[bot] left review comments

@mrfinch mrfinch mrfinch approved these changes

Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0