-
Notifications
You must be signed in to change notification settings - Fork 14
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
enhance(apps/frontend-pwa): improve layout of group messages #4274
Conversation
sjschlapbach
commented
Sep 23, 2024
Current Aviator status
This PR was merged manually (without Aviator). Merging manually can negatively impact the performance of the queue. Consider using Aviator next time.
See the real-time status of this PR on the
Aviator webapp.
Use the Aviator Chrome Extension
to see the status of your PR within GitHub.
|
WalkthroughWalkthroughThe changes in Changes
Possibly related PRs
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Outside diff range and nitpick comments (1)
apps/frontend-pwa/src/components/course/GroupView.tsx (1)
215-221
: Remove unnecessarykey
prop onImage
componentThe
key
prop on theImage
component is unnecessary unless theImage
is part of an array being iterated over. Thekey
prop is primarily used by React to identify which items have changed, are added, or are removed.You can remove the
key
prop from theImage
component:<Image - key={message.participant.avatar} src={ message.participant.avatar ? `${process.env.NEXT_PUBLIC_AVATAR_BASE_PATH}/${message.participant.avatar}.svg` : '/user-solid.svg' } alt="" height={25} width={25} className={twMerge( 'order-1', ownMessage && 'order-2' )} />
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- apps/frontend-pwa/src/components/course/GroupView.tsx (2 hunks)
Additional comments not posted (2)
apps/frontend-pwa/src/components/course/GroupView.tsx (2)
2-3
: Imports added for FontAwesomeIcon and faPaperPlaneThe imports for
FontAwesomeIcon
andfaPaperPlane
are correct and necessary for the send button icon.
250-250
: Ensuremessage.createdAt
is properly formattedWhile displaying the message timestamp, ensure that
message.createdAt
is in a valid date format compatible withdayjs
. IfcreatedAt
could be undefined or null, it might lead to formatting issues.Run the following script to verify the validity of
createdAt
fields:Verification successful
message.createdAt
is properly formatted and validatedAll
createdAt
fields are confirmed to be non-null and properly defined within theGroupMessage
interface. No formatting issues withdayjs
are detected.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that all group messages have a valid 'createdAt' field. # Test: Search for any 'createdAt' fields that are null or undefined. # Expect: No results, meaning all 'createdAt' fields are valid. ast-grep --lang typescript --pattern '$.createdAt == null' --json | jq '.' # Alternatively, check the type definitions for 'GroupMessage'. ast-grep --lang typescript --pattern 'interface GroupMessage { $$$ }' --json | jq '.'Length of output: 166
klicker-uzh Run #3037
Run Properties:
|
Project |
klicker-uzh
|
Branch Review |
group-messages-layout
|
Run status |
Passed #3037
|
Run duration | 09m 07s |
Commit |
f76a1abad5 ℹ️: Merge 280aab6cb6def3c8a167ff86dce7183067875ded into 47fd322a7ccfea4a1b104798da36...
|
Committer | Julius Schlapbach |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
0
|
Flaky |
0
|
Pending |
0
|
Skipped |
0
|
Passing |
44
|
View all changes introduced in this branch ↗︎ |
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Outside diff range and nitpick comments (2)
apps/frontend-pwa/src/components/course/GroupView.tsx (2)
187-256
: LGTM: Improved message display area with a suggestionThe restructured message display area significantly enhances the user experience:
- The scrollable container with reversed flex direction creates a more natural chat-like interface.
- Including participant avatars and usernames improves message attribution.
- Grouping messages from the same user reduces visual clutter.
- The layout adapts well for both sent and received messages.
These changes contribute to a more organized and readable group chat interface.
Consider adding an
aria-label
to the scrollable message container for improved accessibility. For example:<div className="mb-2 flex max-h-80 min-h-40 flex-col-reverse gap-1.5 overflow-scroll" data-cy="group-messages" + aria-label={t('pwa.groups.messageList')} >Don't forget to add the corresponding translation key.
259-307
: LGTM: Well-implemented message submission form with a suggestionThe new message submission form is well-implemented:
- Formik provides robust form handling and validation.
- The textarea allows for multi-line messages, improving flexibility.
- The paper plane icon in the submit button is intuitive and visually appealing.
- Disabling the submit button when invalid or submitting prevents errors.
These changes significantly improve the user experience when sending messages.
Consider adding a success notification after successfully sending a message. This could be implemented by adding a state variable and displaying a temporary notification. For example:
const [showSuccessNotification, setShowSuccessNotification] = useState(false); // In the onSubmit function: setShowSuccessNotification(true); setTimeout(() => setShowSuccessNotification(false), 3000); // In the JSX: {showSuccessNotification && ( <UserNotification type="success" message={t('pwa.groups.messageSentSuccess')} /> )}Don't forget to add the corresponding translation key.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- apps/frontend-pwa/src/components/course/GroupView.tsx (2 hunks)
Additional comments not posted (3)
apps/frontend-pwa/src/components/course/GroupView.tsx (3)
2-3
: LGTM: New imports for FontAwesome iconsThe new imports for FontAwesome icons are correctly added and necessary for the paper plane icon used in the send button of the message form.
183-185
: LGTM: Improved H3 stylingThe modification to the H3 component's className enhances the visual separation between the header and the content by adding a bottom border. This change contributes to a cleaner layout.
193-193
: LGTM: Typo in variable name fixedThe typo in the variable name has been correctly fixed from 'ownMesssage' to 'ownMessage'. This change improves code readability and prevents potential confusion or errors.
klicker-uzh Run #3038
Run Properties:
|
Project |
klicker-uzh
|
Branch Review |
v3
|
Run status |
Passed #3038
|
Run duration | 09m 08s |
Commit |
8744f99cf0: enhance(apps/frontend-pwa): improve layout of group messages (#4274)
|
Committer | Julius Schlapbach |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
0
|
Flaky |
1
|
Pending |
0
|
Skipped |
0
|
Passing |
44
|
View all changes introduced in this branch ↗︎ |