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

Programming Exercises: Align title and buttons for participation page #9983

Conversation

laxerhd
Copy link
Contributor

@laxerhd laxerhd commented Dec 9, 2024

Checklist

General

  • I tested all changes and their related features with all corresponding user types on a test server.
  • This is a small issue that I tested locally and was confirmed by another developer on a test server.
  • I chose a title conforming to the naming conventions for pull requests.

Client

  • Following the theming guidelines, I specified colors only in the theming variable files and checked that the changes look consistent in both the light and the dark theme.
  • I added multiple screenshots/screencasts of my UI changes.

Motivation and Context

Very optional changes, but it was a little offputting that the buttons weren't actually centered with anything.
(Another solution could be to center them with the original div structure to place them in the middle of the title and filters.)
Closes #9967.

Description

  • Adjusted div structure (swapped buttons and filters) and classes to achieve centering of buttons
  • Ensured filters remain in a separate row below the title and buttons
  • Refactored layout with no impact on functionality

Steps for Testing

Prerequisites:

  • 1 Instructor
  • 1 Exercise
  1. Go to an exercise as an instructor
  2. Click on Instructor actions -> Participations
  3. Take a look at the title and buttons centered

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

Test Coverage

Screenshots

Before:
image

After:
image

Summary by CodeRabbit

  • New Features

    • Enhanced layout and alignment of elements in the participation component.
    • Conditional rendering of buttons based on user roles and exercise types.
  • Bug Fixes

    • Improved organization of radio button filters for better usability.
  • Refactor

    • Streamlined code by consolidating redundant conditional checks.
    • Simplified overall structure for better readability and maintainability.

@laxerhd laxerhd requested a review from a team as a code owner December 9, 2024 19:57
@github-actions github-actions bot added the client Pull requests that update TypeScript code. (Added Automatically!) label Dec 9, 2024
Copy link

coderabbitai bot commented Dec 9, 2024

Walkthrough

The changes in this pull request focus on the participation.component.html file, where the structure and layout have been significantly updated. Key modifications include the introduction of new layout classes for better element alignment, conditional rendering of buttons based on user roles, and a reorganization of the radio button filter section. Redundant code has been removed to streamline the component, enhancing readability and maintainability without altering any exported or public entity declarations.

Changes

File Path Change Summary
src/main/webapp/app/exercises/shared/participation/participation.component.html Structural updates to the outer <div> for alignment, conditional rendering of buttons for instructors, reorganization of radio button filters, and removal of redundant code.

Assessment against linked issues

Objective Addressed Explanation
Align the title with the buttons on the exercise participations page (#9967)

Possibly related PRs

Suggested labels

ready to merge, small

Suggested reviewers

  • krusche
  • az108
  • rabeatwork
  • HawKhiem

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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: 0

🧹 Outside diff range and nitpick comments (2)
src/main/webapp/app/exercises/shared/participation/participation.component.html (2)

32-51: Consider enhancing accessibility for radio button group.

While the layout is good, consider wrapping the radio buttons in a fieldset with a legend for better semantic structure and accessibility.

-    <div class="d-flex align-items-center mt-2">
+    <fieldset class="d-flex align-items-center mt-2 border-0 p-0">
+        <legend class="visually-hidden">Filter participations</legend>
         <label class="radio-inline mb-0 d-flex align-items-center">
-            <input type="radio" [ngModel]="participationCriteria.filterProp" (click)="updateParticipationFilter(FilterProp.ALL)" [value]="FilterProp.ALL" />
+            <input type="radio" [ngModel]="participationCriteria.filterProp" (click)="updateParticipationFilter(FilterProp.ALL)" [value]="FilterProp.ALL" aria-label="Show all participations" />
             <span class="ms-1" jhiTranslate="artemisApp.exercise.showAll"></span>
         </label>
         <!-- Similar changes for other radio inputs -->
-    </div>
+    </fieldset>

Line range hint 52-400: Improve consistency in button spacing and conditional checks.

While the table structure is solid, there are a few areas that could be enhanced:

  1. Add consistent spacing classes to all button groups
  2. Simplify nested conditional checks for exercise group routing

For button groups, ensure consistent spacing:

-                        <div class="btn-group">
+                        <div class="btn-group me-2">

For exercise group routing, consider simplifying:

-                            @if (exercise.isAtLeastInstructor) {
-                                <div>
-                                    @if (!!exercise.exerciseGroup) {
-                                        <a routerLink="{{ value.id }}">
-                                            {{ value.submissionCount }}
-                                        </a>
-                                    }
-                                    @if (!exercise.exerciseGroup) {
-                                        <a routerLink="{{ value.id }}/submissions">
-                                            {{ value.submissionCount }}
-                                        </a>
-                                    }
-                                </div>
+                            @if (exercise.isAtLeastInstructor) {
+                                <a [routerLink]="[value.id, exercise.exerciseGroup ? '' : 'submissions']">
+                                    {{ value.submissionCount }}
+                                </a>
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 4ebb290 and 45f2fe7.

📒 Files selected for processing (1)
  • src/main/webapp/app/exercises/shared/participation/participation.component.html (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/main/webapp/app/exercises/shared/participation/participation.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 (1)
src/main/webapp/app/exercises/shared/participation/participation.component.html (1)

1-31: LGTM! Header layout improvements look good.

The new flex layout structure with d-flex flex-wrap align-items-center justify-content-between classes effectively centers the title and buttons. The use of @if directives follows the new Angular syntax guidelines.

Copy link

There hasn't been any activity on this pull request recently. Therefore, this pull request has been automatically marked as stale and will be closed if no further activity occurs within seven days. Thank you for your contributions.

@github-actions github-actions bot added the stale label Dec 17, 2024
@laxerhd laxerhd force-pushed the bugfix/programming-exercises/misalignment-participationpage-buttons branch from 45f2fe7 to 9442db2 Compare December 20, 2024 00:49
@laxerhd laxerhd requested a review from a team as a code owner December 20, 2024 00:49
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: 0

🧹 Nitpick comments (2)
src/main/webapp/app/exercises/shared/participation/participation.component.html (2)

32-51: Consider adding ARIA labels for better accessibility.

While the layout is well-structured, the radio button group could benefit from improved accessibility.

Consider adding ARIA attributes:

-    <div class="d-flex align-items-center mt-2">
+    <div class="d-flex align-items-center mt-2" role="radiogroup" aria-label="Filter participations">

Line range hint 52-65: Consider adding trackBy function for better performance.

The data table could benefit from a trackBy function to optimize rendering performance when the data changes.

Add a trackBy function to the component:

trackByParticipationId(index: number, participation: any): number {
  return participation.id;
}

Then update the table:

     <jhi-data-table
         [isLoading]="isLoading"
         entityType="participation"
         [allEntities]="participations"
+        [trackBy]="trackByParticipationId"
         entitiesPerPageTranslation="artemisApp.exercise.resultsPerPage"
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 45f2fe7 and 9442db2.

📒 Files selected for processing (1)
  • src/main/webapp/app/exercises/shared/participation/participation.component.html (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/main/webapp/app/exercises/shared/participation/participation.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 (2)
src/main/webapp/app/exercises/shared/participation/participation.component.html (2)

1-31: LGTM! Header section layout improvements.

The changes effectively achieve the PR's objective of improving layout alignment. The use of flex classes (d-flex, align-items-center, justify-content-between) provides proper centering and spacing. The code correctly uses the new @if syntax as per guidelines.


Line range hint 52-400: LGTM! Consistent use of new Angular syntax.

The data table section correctly implements the new @if syntax throughout all conditional renderings, adhering to the coding guidelines.

@github-actions github-actions bot removed the stale label Dec 20, 2024
Copy link

There hasn't been any activity on this pull request recently. Therefore, this pull request has been automatically marked as stale and will be closed if no further activity occurs within seven days. Thank you for your contributions.

@github-actions github-actions bot added the stale label Dec 27, 2024
@laxerhd
Copy link
Contributor Author

laxerhd commented Jan 9, 2025

I am closing this PR because it originates from a branch in a forked repository, and our test server cannot be deployed on branches from forked repositories. I have already transferred the changes to a new branch in the main repository and will open a new PR from there.

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!) stale
Projects
Status: Work In Progress
Development

Successfully merging this pull request may close these issues.

Exercises: Title of the exercise participations page is offset from the buttons on the right
1 participant