Skip to content

fix(chat): Stick message toolbar to the message content and display message time on hover - #21583

Merged
ramonlsouza merged 2 commits into
bigbluebutton:v3.0.x-releasefrom
JoVictorNunes:chat-changes-1031
Oct 31, 2024
Merged

ramonlsouza merged 2 commits into
bigbluebutton:v3.0.x-releasefrom
JoVictorNunes:chat-changes-1031

Conversation

@JoVictorNunes

Copy link
Copy Markdown
Contributor

What does this PR do?

Changes message toolbar positioning and display same sender message time on hover.

Screenshot from 2024-10-31 11-41-25

Screenshot from 2024-10-31 11-41-43

Closes Issue(s)

Closes n/a

@coderabbitai

coderabbitai Bot commented Oct 31, 2024 •

Copy link
Copy Markdown
Contributor

Walkthrough

The pull request introduces several modifications to the ChatMessage component and its associated styles in the BigBlueButton HTML5 client. Key changes include the repositioning of the ChatMessageToolbar to render after the ChatContent, thereby altering the visual layout of chat messages. Additionally, a new ChatTime component is added to the ChatContentFooter, which displays the timestamp for each message.

Styling updates in the styles.ts files enhance the appearance and behavior of chat components, including hover effects and conditional visibility of elements. The settings.yml configuration file has also been updated to include specific toolbar options for chat interactions, such as reply, edit, delete, and reactions, while also restructuring audio and video settings. These changes collectively improve user interaction within the chat interface without altering the underlying logic of the components.

Possibly related PRs

Suggested reviewers

  • ramonlsouza

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>, 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 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (3)
bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/styles.ts (2)

92-102: Consider removing !important flag from hover styles.

The use of !important in hover styles might indicate specificity issues. Consider restructuring the CSS selectors to achieve the same effect without forcing specificity.

-    &:hover {
-      background-color: ${colorBlueLightest} !important;
-    }
+    &:hover {
+      background-color: ${colorBlueLightest};
+    }

115-135: Consider using CSS variables for magic numbers in calculations.

The bottom: calc(${lgPadding} + 2px) uses a hard-coded 2px value. Consider extracting this to a CSS variable for better maintainability.

+const toolbarOffset = '2px';
 export const ChatContentFooter = styled.div`
   ...
-  bottom: calc(${lgPadding} + 2px);
+  bottom: calc(${lgPadding} + ${toolbarOffset});
   ...
 `;
bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/component.tsx (1)

488-509: Consider adding accessibility attributes

The ChatMessageToolbar implementation looks good and aligns with the PR objective. However, consider enhancing keyboard accessibility by adding appropriate ARIA attributes.

Add these attributes to improve accessibility:

 <ChatMessageToolbar
+  role="toolbar"
+  aria-label={`Message actions for ${username}`}
   keyboardFocused={keyboardFocused}
   hasToolbar={hasToolbar && messageContent.showToolbar}
   // ... other props
 />
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 61416ea and 3970e34.

📒 Files selected for processing (4)
  • bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/component.tsx (2 hunks)
  • bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-toolbar/styles.ts (2 hunks)
  • bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/styles.ts (6 hunks)
  • bigbluebutton-html5/private/config/settings.yml (1 hunks)
🔇 Additional comments (7)
bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-toolbar/styles.ts (2)

8-8: LGTM: Import addition is appropriate.

The addition of smPadding to the imports is necessary for the new padding implementation in the Root component.


18-23: LGTM: Style changes effectively implement the toolbar positioning requirement.

The changes work together to achieve the desired toolbar positioning:

  1. Standardized padding using smPadding
  2. Vertical centering with transform: translateY(50%)
  3. Updated selectors to target .chat-message-content for proper attachment

These modifications align well with the PR objective of sticking the message toolbar to the message content.

Also applies to: 34-35

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/styles.ts (2)

11-11: LGTM!

The new import is properly organized with other spacing imports and is used in the ChatContentFooter component.


264-267: LGTM!

The ChatTime component is well-implemented, extending the base component with appropriate styling and using the color palette correctly.

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/component.tsx (2)

25-25: LGTM: ChatTime component import

The addition of ChatTime styled component aligns with the PR objective of displaying message timestamps.


488-509: 🛠️ Refactor suggestion

Consider reordering toolbar placement

The toolbar is currently rendered before the message content within ChatContent. Consider moving it after the MessageItemWrapper to maintain a logical DOM order that matches the visual order.

Move the toolbar after the message content:

 <ChatContent>
-  <ChatMessageToolbar ... />
   {message.replyToMessage && !deleteTime && (
     <ChatMessageReplied ... />
   )}
   {!deleteTime && (
     <MessageItemWrapper>
       {messageContent.component}
       {messageReadFeedbackEnabled && (
         <MessageReadConfirmation ... />
       )}
     </MessageItemWrapper>
   )}
+  <ChatMessageToolbar ... />
   {sameSender && (
     <ChatContentFooter>
     ...
   )}
 </ChatContent>

Likely invalid or redundant comment.

bigbluebutton-html5/private/config/settings.yml (1)

776-776: LGTM! Configuration updated to enable chat message toolbar options.

The toolbar configuration now includes all available options ('reply', 'edit', 'delete', 'reactions') which aligns with the PR objective to enhance the message toolbar functionality.

Let's verify that these toolbar options are properly handled in the chat components:

✅ Verification successful

Configuration change is properly implemented in the codebase

The toolbar configuration is correctly supported by the implementation:

  • The message toolbar component (message-toolbar/component.tsx) handles all specified options:
    • Reply: Dispatches CHAT_REPLY_INTENTION event
    • Edit: Dispatches CHAT_EDIT_REQUEST event
    • Delete: Shows confirmation modal before deletion
    • Reactions: Opens emoji picker popover
  • Each feature has corresponding components:
    • message-replied/component.tsx for reply functionality
    • message-reactions/component.tsx for reactions support
  • The toolbar is conditionally rendered based on configuration flags: chatReplyEnabled, chatReactionsEnabled, chatEditEnabled, chatDeleteEnabled
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if all toolbar options are properly implemented in chat components

# Test: Search for toolbar option handlers in chat-related components
rg -A 5 "('reply'|'edit'|'delete'|'reactions')" --type ts --type tsx

Length of output: 122


Script:

#!/bin/bash
# Let's try a different approach to search for toolbar options in the codebase
# First, let's find relevant files
fd -e jsx -e js -e ts "chat|message" bigbluebutton-html5/imports/ui/components/

# Then search for toolbar-related code and handlers
rg -l "(reply|edit|delete|reactions)" bigbluebutton-html5/imports/ui/components/

# Also search specifically in the chat components directory if it exists
rg -l "(reply|edit|delete|reactions)" bigbluebutton-html5/imports/ui/components/chat/

# Look for any message toolbar component
fd "toolbar|message-actions" bigbluebutton-html5/imports/ui/components/

Length of output: 6882


Script:

#!/bin/bash
# Let's examine the message toolbar component implementation
cat bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-toolbar/component.tsx

# Also check the related components for each toolbar action
cat bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-replied/component.tsx
cat bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-reactions/component.tsx

Length of output: 14496

display: flex;
flex-direction: row;
padding: ${lgPadding} ${$3xlPadding};
padding: calc(${lgPadding} + 2px) ${$3xlPadding};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Coordinate spacing variables between related components.

The padding calculation calc(${lgPadding} + 2px) matches the footer positioning. These related values should share a common variable to maintain consistency when changes are needed.

+const messageSpacing = '2px';
 export const MessageItemWrapper = styled.div`
-  padding: calc(${lgPadding} + 2px) ${$3xlPadding};
+  padding: calc(${lgPadding} + ${messageSpacing}) ${$3xlPadding};
 `;

Committable suggestion was skipped due to low confidence.

@ramonlsouza
ramonlsouza self-requested a review October 31, 2024 16:48
@ramonlsouza ramonlsouza added this to the Release 3.0 milestone Oct 31, 2024
@sonarqubecloud

Copy link
Copy Markdown

@ramonlsouza
ramonlsouza merged commit 004f2b5 into bigbluebutton:v3.0.x-release Oct 31, 2024
@github-actions

Copy link
Copy Markdown

Automated tests Summary

✅ All the CI tests have passed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants