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

Communication: Reduce height of channel and chat item card #9480

Merged

Conversation

rabeatwork
Copy link
Contributor

@rabeatwork rabeatwork commented Oct 14, 2024

Checklist

General

Client

  • Important: I implemented the changes with a very good performance, prevented too many (unnecessary) REST calls and made sure the UI is responsive, even with large data (e.g. using paging).
  • I strictly followed the client coding and design guidelines.
  • I added multiple screenshots/screencasts of my UI changes.

Motivation and Context

The cards for the channels and chats had a lot of margin. As a result, only a few fit on one page, and there was a lot of scrolling. The height/padding has been reduced.

Description

The margin for the communication sidebar items has been reduced.

Steps for Testing

Prerequisites:

  • 1 Student
  • 1 Course with Communication enabled
  1. Log in to Artemis
  2. Navigate to Course Communication
  3. See Sidebar with Channels / Chats
  4. Verify that the Channel Chats are smaller
  5. Navigate to Exercises / Lectures
  6. Verify that everything looks like before

Testserver States

Note

These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Click on the badges to get to the test servers.







Review Progress

Performance Review

  • I (as a reviewer) confirm that the client changes (in particular related to REST calls and UI responsiveness) are implemented with a very good performance even for very large courses with more than 2000 students.
  • I (as a reviewer) confirm that the server changes (in particular related to database calls) are implemented with a very good performance even for very large courses with more than 2000 students.

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Exam Mode Test

  • Test 1
  • Test 2

Performance Tests

  • Test 1
  • Test 2

Screenshots

Before:
image

After:
image

Summary by CodeRabbit

  • Style

    • Improved button alignment and spacing in the sidebar components for a more consistent user interface.
    • Adjusted rendering logic for sidebar items based on their type to enhance layout consistency.
  • New Features

    • Introduced conditional rendering for sidebar items, improving user interaction based on the sidebar type.

@github-actions github-actions bot added the client Pull requests that update TypeScript code. (Added Automatically!) label Oct 14, 2024
@rabeatwork rabeatwork marked this pull request as ready for review October 14, 2024 16:17
@rabeatwork rabeatwork requested a review from a team as a code owner October 14, 2024 16:17
Copy link

coderabbitai bot commented Oct 14, 2024

Walkthrough

The pull request includes several modifications to the sidebar components within the web application. Key changes involve adjustments to CSS classes for buttons, refined rendering logic based on the sidebarType, and conditional rendering for specific scenarios. The updates aim to improve layout consistency and alignment without altering any functionality or event handling.

Changes

File Path Change Summary
src/main/webapp/app/shared/sidebar/conversation-options/conversation-options.component.html Adjusted CSS classes on buttons: replaced px-0 with p-0 on the favorite button, added py-0 to the dropdown toggle.
src/main/webapp/app/shared/sidebar/sidebar-card-item/sidebar-card-item.component.html Refined rendering logic based on sidebarType, removed mb-1 class, and adjusted alignment and spacing classes.
src/main/webapp/app/shared/sidebar/sidebar-card-medium/sidebar-card-medium.component.html Introduced conditional rendering based on sidebarType, adjusted class attributes, and updated click event handling.
src/main/webapp/app/shared/sidebar/sidebar-card-small/sidebar-card-small.component.html Added align-self-center class for improved alignment; comments indicate query parameters for messages module.

Possibly related PRs

Suggested labels

small, user interface, component:Communication

Suggested reviewers

  • edkaya
  • sarpsahinalp
  • pzdr7
  • JohannesStoehr

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 or @coderabbitai title anywhere in the PR title to generate the title automatically.

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

@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

🧹 Outside diff range comments (2)
src/main/webapp/app/shared/sidebar/sidebar-card-small/sidebar-card-small.component.html (1)

Line range hint 1-2: Approve the explanatory comment and suggest creating a tracking issue.

The comment provides valuable context for the current implementation and acknowledges the temporary nature of the workaround. This is good practice for maintaining code clarity.

To ensure this follow-up work isn't forgotten, would you like me to create a GitHub issue to track the adjustment of routing in the messages module?

src/main/webapp/app/shared/sidebar/sidebar-card-item/sidebar-card-item.component.html (1)

Line range hint 49-62: LGTM: Improved compact layout for non-exam sidebar items.

The changes effectively reduce the height of channel and chat item cards by using the small class and adjusting font weights. The conditional muted class for conversations is a nice touch for visual feedback.

One minor suggestion:

Consider using a more semantic class name instead of muted for better clarity. For example:

- [class.muted]="sidebarItem.conversation?.isMuted"
+ [class.conversation-muted]="sidebarItem.conversation?.isMuted"

This change would make the purpose of the class more explicit and improve code readability.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

📥 Commits

Files that changed from the base of the PR and between a5167be and 325daa1.

📒 Files selected for processing (4)
  • src/main/webapp/app/shared/sidebar/conversation-options/conversation-options.component.html (1 hunks)
  • src/main/webapp/app/shared/sidebar/sidebar-card-item/sidebar-card-item.component.html (3 hunks)
  • src/main/webapp/app/shared/sidebar/sidebar-card-medium/sidebar-card-medium.component.html (1 hunks)
  • src/main/webapp/app/shared/sidebar/sidebar-card-small/sidebar-card-small.component.html (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
src/main/webapp/app/shared/sidebar/conversation-options/conversation-options.component.html (1)

Pattern src/main/webapp/**/*.html: @if and @for are new and valid Angular syntax replacing *ngIf and *ngFor. They should always be used over the old style.

src/main/webapp/app/shared/sidebar/sidebar-card-item/sidebar-card-item.component.html (1)

Pattern src/main/webapp/**/*.html: @if and @for are new and valid Angular syntax replacing *ngIf and *ngFor. They should always be used over the old style.

src/main/webapp/app/shared/sidebar/sidebar-card-medium/sidebar-card-medium.component.html (1)

Pattern src/main/webapp/**/*.html: @if and @for are new and valid Angular syntax replacing *ngIf and *ngFor. They should always be used over the old style.

src/main/webapp/app/shared/sidebar/sidebar-card-small/sidebar-card-small.component.html (1)

Pattern src/main/webapp/**/*.html: @if and @for are new and valid Angular syntax replacing *ngIf and *ngFor. They should always be used over the old style.

🔇 Additional comments (13)
src/main/webapp/app/shared/sidebar/sidebar-card-small/sidebar-card-small.component.html (3)

Line range hint 3-11: Approve the main <div> element implementation.

The main <div> element is well-structured with appropriate use of Angular directives and event bindings. The conditional styling and routing enhance the component's flexibility and reusability.


12-12: Approve the addition of align-self-center class.

The addition of the align-self-center class to the inner <div> improves the vertical alignment of the content. This change contributes to the PR's objective of refining the layout and reducing the height of the card.


Line range hint 13-19: Approve the usage of nested elements and adherence to coding guidelines.

The template effectively uses custom components (jhi-sidebar-card-item and jhi-conversation-options) to promote modularity. The conditional rendering using the @if directive follows the new Angular syntax as specified in the coding guidelines. This implementation ensures that conversation options are only displayed when a conversation exists.

src/main/webapp/app/shared/sidebar/sidebar-card-medium/sidebar-card-medium.component.html (4)

Line range hint 1-12: LGTM! Correct use of @if directive.

The changes introduce a new condition for 'inExam' sidebarType, which is correctly implemented using the @if directive as per the coding guidelines. The structure and event handling for this new case appear appropriate.


13-13: Padding adjustment aligns with PR objectives.

The change from pb-1 to py-2 modifies the vertical padding of the element. This adjustment contributes to the PR's goal of reducing the height of channel and chat item cards, potentially allowing more items to fit on the screen simultaneously.


Line range hint 1-24: Summary: Changes align well with PR objectives

The modifications in this file successfully address the PR's main objective of reducing the height of channel and chat item cards. Key improvements include:

  1. Proper use of the @if directive for conditional rendering.
  2. Adjustment of padding to reduce card height.
  3. Enhanced interactivity and navigation through updated event handling and routing.

These changes should contribute to improved visibility and reduced scrolling in the communication sidebar, as intended. The implementation adheres to Angular best practices and the provided coding guidelines.


Line range hint 14-24: Enhanced interactivity and navigation.

The changes improve the sidebar's functionality by:

  1. Updating the click event handler to emitStoreAndRefresh(sidebarItem.id).
  2. Adding routerLink for navigation.
  3. Using routerLinkActive for proper active item styling.

These modifications enhance the overall user experience and align with the PR objectives.

To ensure these changes work as intended, please verify the following:

src/main/webapp/app/shared/sidebar/conversation-options/conversation-options.component.html (4)

2-2: Approved: Padding adjustment contributes to height reduction

The change from px-0 to p-0 on the favorite button removes any vertical padding, which aligns with the PR's objective of reducing the height of channel and chat item cards. This minor adjustment contributes to allowing more items to fit on the screen simultaneously.


6-6: Approved: Consistent padding adjustment on dropdown toggle

Adding the py-0 class to the dropdown toggle button removes its vertical padding, which is consistent with the change made to the favorite button. This modification further contributes to reducing the overall height of the components, aligning well with the PR's objective of allowing more items to fit on the screen.


2-6: Summary: Changes effectively contribute to PR objectives

The modifications to reduce vertical padding on both the favorite button and the dropdown toggle are consistent and well-aligned with the PR's goal of reducing the height of channel and chat item cards. These minimal, focused changes effectively contribute to allowing more items to fit on the screen simultaneously without altering functionality or introducing new features. The implementation appears to be sound and carries minimal risk of unintended side effects.


Line range hint 10-10: Approved: Correct usage of new Angular syntax

The use of @if directives on lines 10 and 15 aligns with the provided coding guidelines, which state that "@if and @for are new and valid Angular syntax replacing *ngIf and *ngFor". This demonstrates adherence to the latest Angular best practices and coding standards.

Also applies to: 15-15

src/main/webapp/app/shared/sidebar/sidebar-card-item/sidebar-card-item.component.html (2)

3-3: LGTM: Improved layout with consistent margins.

The addition of the mx-1 class provides a consistent horizontal margin, which aligns with the PR objective of refining the sidebar item layout.


Line range hint 1-80: Overall assessment: Changes effectively address PR objectives.

The modifications to this template successfully reduce the height of channel and chat item cards, improving the sidebar's compact layout. The changes align well with the PR objectives and generally follow good Angular practices.

Key points:

  1. Consistent margins have been added to improve layout.
  2. The non-exam sidebar items now have a more compact design.
  3. Conditional styling has been implemented for muted conversations.

Minor suggestions have been made to improve code clarity and adhere to the latest Angular syntax. Once these are addressed, the changes will be ready for merging.

Copy link

@sachmii sachmii left a comment

Choose a reason for hiding this comment

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

I tested on TS2 but could not reproduce the small change. I compared the card margin size on TS2 with my personal account in production but could not notice any difference. (issue fixed - forgot to deploy, sorry :D)

Copy link

⚠️ Unable to deploy to test servers ⚠️

The docker build needs to run through before deploying.

@github-actions github-actions bot added the deployment-error Added by deployment workflows if an error occured label Oct 14, 2024
@az108 az108 added deploy:artemis-test6 and removed deployment-error Added by deployment workflows if an error occured labels Oct 14, 2024
@az108 az108 temporarily deployed to artemis-test6.artemis.cit.tum.de October 14, 2024 17:42 — with GitHub Actions Inactive
@sachmii sachmii temporarily deployed to artemis-test2.artemis.cit.tum.de October 14, 2024 17:57 — with GitHub Actions Inactive
Copy link

@sachmii sachmii left a comment

Choose a reason for hiding this comment

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

Tested on TS6 and TS2, card margins in the communication tab are smaller as described.

Copy link
Contributor

@az108 az108 left a comment

Choose a reason for hiding this comment

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

Code LGTM 👍

Copy link
Contributor

@florian-glombik florian-glombik left a comment

Choose a reason for hiding this comment

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

The code looks good to me 👍

Copy link
Contributor

@cremertim cremertim left a comment

Choose a reason for hiding this comment

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

tested on ts2, works as expected

Copy link
Contributor

@edkaya edkaya left a comment

Choose a reason for hiding this comment

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

Tested on ts2, works as expected

Copy link

@HawKhiem HawKhiem left a comment

Choose a reason for hiding this comment

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

I tested on test server 1. Bars are indeed smaller as expected.

Screenshot 2024-10-16 161151

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Pull requests that update TypeScript code. (Added Automatically!) maintainer-approved The feature maintainer has approved the PR ready to merge
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

8 participants