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

Tutorial groups: Redesign overview page #9445

Merged
merged 8 commits into from
Oct 12, 2024

Conversation

PaRangger
Copy link
Contributor

@PaRangger PaRangger commented Oct 9, 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.
  • 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.
  • I translated all newly inserted strings into English and German.

Motivation and Context

Currently there tutor group overview page shows a lot of whitespace as well as unneccesary information. The user has to scroll down quite far to reach a lot of the relevant information like location or session times.

Description

I redesigned the tutorial page to show the same information as before but in a more horizontal way using categorized cards. I removed the course title and group name because it was redundant. The rest of the information should still be displayed.

Steps for Testing

Prerequisites:

  • 1 Course with a tutorial group
  • 1 Instructor
  • 1 Student in a tutorial group

(Tutorial groups can be created in the edit course menu)

  1. Log in to Artemis as the student
  2. Navigate to the course
  3. In the navigation sidebar select "Tutorial Groups"
  4. Select a tutorial group in the content sidebar
  5. Check if all relevant information is displayed
  6. Log into Artemis s the instructor
  7. Go to manage course
  8. Select Tutorial Groups
  9. Select a tutorial group
  10. Check if also here the information is displayed correctly

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:
tutorialgrp-before

After:
Bildschirmfoto 2024-10-09 um 12 07 51

Within the manage course menu it should look similar:
Bildschirmfoto 2024-10-09 um 12 06 37

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced layout for tutorial group details using Bootstrap, featuring dedicated cards for teaching assistant info, utilization metrics, and additional details.
    • Introduced a new IconCardComponent for improved icon and title representation.
  • Bug Fixes

    • Improved localization support with new keys and translations for both German and English.
  • Tests

    • Added a test suite for IconCardComponent and updated tests for TutorialGroupDetailComponent to include new mock components and directives.

@github-actions github-actions bot added tests client Pull requests that update TypeScript code. (Added Automatically!) labels Oct 9, 2024
Copy link

github-actions bot commented Oct 9, 2024

⚠️ 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 9, 2024
@PaRangger PaRangger removed the deployment-error Added by deployment workflows if an error occured label Oct 9, 2024
@MaximilianAnzinger MaximilianAnzinger changed the title Tutorial Groups: Redesign overview page Tutorial groups: Redesign overview page Oct 9, 2024
@PaRangger PaRangger marked this pull request as ready for review October 9, 2024 20:07
@PaRangger PaRangger requested a review from a team as a code owner October 9, 2024 20:07
Copy link

coderabbitai bot commented Oct 9, 2024

Walkthrough

The changes in this pull request involve a comprehensive redesign of the tutorial-group-detail component in an Angular application. The HTML structure has been updated to utilize Bootstrap grid classes for improved layout, featuring three jhi-icon-card components that display information about teaching assistants, utilization metrics, and additional tutorial group details. New properties have been added to the component's TypeScript file, and the SCSS file has been enhanced with new styles. Additionally, a new IconCardComponent has been introduced to encapsulate icon and title display logic, along with updates to localization files for enhanced support in multiple languages.

Changes

File Change Summary
src/main/webapp/app/course/tutorial-groups/shared/tutorial-group-detail/tutorial-group-detail.component.html Structural changes to utilize Bootstrap grid classes, replacing the previous conditional rendering of a detail overview list with three jhi-icon-card components for displaying tutorial group details.
src/main/webapp/app/course/tutorial-groups/shared/tutorial-group-detail/tutorial-group-detail.component.scss Introduction of new SCSS variables and styles, including $tutor-image-size and new classes for styling images and markdown previews.
src/main/webapp/app/course/tutorial-groups/shared/tutorial-group-detail/tutorial-group-detail.component.ts Modifications to the TutorialGroupDetailComponent, including the addition of new properties (tutorInitials, tutorDefaultProfilePictureHue, isMessagingEnabled, utilization) and the renaming of the getTutorialDetailSections method to getTutorialDetail. The logic has shifted to directly compute values from tutorialGroup data.
src/main/webapp/app/course/tutorial-groups/shared/tutorial-groups-shared.module.ts Addition of the IconCardComponent to the imports array in the ArtemisTutorialGroupsSharedModule.
src/main/webapp/app/shared/icon-card/icon-card.component.html Introduction of a new HTML structure for the IconCardComponent, defining a card layout with a Font Awesome icon and a headline.
src/main/webapp/app/shared/icon-card/icon-card.component.ts Creation of a new IconCardComponent with input properties for headerIcon and headline, encapsulating icon and title display logic.
src/main/webapp/i18n/de/tutorialGroups.json Updates to the German localization strings, adding new keys for name, information, and isNotOnline, along with a minor formatting adjustment to profilePictureAlt.
src/main/webapp/i18n/en/tutorialGroups.json Enhancements to the English localization strings, adding new keys for name, information, and isNotOnline, with a minor adjustment to profilePictureAlt.
src/test/javascript/spec/component/shared/icon-card/icon-card.component.spec.ts Introduction of a test suite for the IconCardComponent, verifying component creation using Angular's testing utilities.
src/test/javascript/spec/component/tutorial-groups/shared/tutorial-group-detail.component.spec.ts Modifications to the test file for TutorialGroupDetailComponent, including new imports and updates to the test setup to incorporate IconCardComponent and TranslateDirective, enhancing the testing environment.

Possibly related PRs

Suggested labels

enhancement, user interface, small

Suggested reviewers

  • JohannesStoehr
  • krusche
  • pzdr7
  • EneaGore
  • sarpsahinalp
  • coolchock

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: 16

🧹 Outside diff range comments (1)
src/test/javascript/spec/component/tutorial-groups/shared/tutorial-group-detail.component.spec.ts (1)

Line range hint 1-180: Overall assessment: Test file updates are comprehensive and well-structured.

The changes to this test file are consistent with the PR objectives of redesigning the tutorial group overview page. The additions of MockComponent for IconCardComponent and MockDirective for TranslateDirective in both test setups (MockWrapperComponent and TutorialGroupDetailComponent) demonstrate a thorough approach to updating the test environment.

These modifications ensure that the tests accurately reflect the changes in the component structure and dependencies. The consistent use of mocks across different test scenarios is a good practice that maintains test isolation and reliability.

One suggestion for further improvement:

Consider adding specific test cases for the new IconCardComponent integration if it plays a significant role in the redesigned UI. This would help ensure that the new layout is functioning as expected within the TutorialGroupDetailComponent.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

📥 Commits

Files that changed from the base of the PR and between b6b47e7 and a5c3824.

📒 Files selected for processing (10)
  • src/main/webapp/app/course/tutorial-groups/shared/tutorial-group-detail/tutorial-group-detail.component.html (1 hunks)
  • src/main/webapp/app/course/tutorial-groups/shared/tutorial-group-detail/tutorial-group-detail.component.scss (2 hunks)
  • src/main/webapp/app/course/tutorial-groups/shared/tutorial-group-detail/tutorial-group-detail.component.ts (5 hunks)
  • src/main/webapp/app/course/tutorial-groups/shared/tutorial-groups-shared.module.ts (1 hunks)
  • src/main/webapp/app/shared/icon-card/icon-card.component.html (1 hunks)
  • src/main/webapp/app/shared/icon-card/icon-card.component.ts (1 hunks)
  • src/main/webapp/i18n/de/tutorialGroups.json (1 hunks)
  • src/main/webapp/i18n/en/tutorialGroups.json (1 hunks)
  • src/test/javascript/spec/component/shared/icon-card/icon-card.component.spec.ts (1 hunks)
  • src/test/javascript/spec/component/tutorial-groups/shared/tutorial-group-detail.component.spec.ts (4 hunks)
🧰 Additional context used
📓 Path-based instructions (8)
src/main/webapp/app/course/tutorial-groups/shared/tutorial-group-detail/tutorial-group-detail.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/course/tutorial-groups/shared/tutorial-group-detail/tutorial-group-detail.component.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

src/main/webapp/app/course/tutorial-groups/shared/tutorial-groups-shared.module.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

src/main/webapp/app/shared/icon-card/icon-card.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/icon-card/icon-card.component.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

src/main/webapp/i18n/de/tutorialGroups.json (1)

Pattern src/main/webapp/i18n/de/**/*.json: German language translations should be informal (dutzen) and should never be formal (sietzen). So the user should always be addressed with "du/dein" and never with "sie/ihr".

src/test/javascript/spec/component/shared/icon-card/icon-card.component.spec.ts (1)

Pattern src/test/javascript/spec/**/*.ts: jest: true; mock: NgMocks; bad_practices: avoid_full_module_import; perf_improvements: mock_irrelevant_deps; service_testing: mock_http_for_logic; no_schema: avoid_NO_ERRORS_SCHEMA; expectation_specificity: true; solutions: {boolean: toBeTrue/False, reference: toBe, existence: toBeNull/NotNull, undefined: toBeUndefined, class_obj: toContainEntries/toEqual, spy_calls: {not_called: not.toHaveBeenCalled, once: toHaveBeenCalledOnce, with_value: toHaveBeenCalledWith|toHaveBeenCalledExactlyOnceWith}}

src/test/javascript/spec/component/tutorial-groups/shared/tutorial-group-detail.component.spec.ts (1)

Pattern src/test/javascript/spec/**/*.ts: jest: true; mock: NgMocks; bad_practices: avoid_full_module_import; perf_improvements: mock_irrelevant_deps; service_testing: mock_http_for_logic; no_schema: avoid_NO_ERRORS_SCHEMA; expectation_specificity: true; solutions: {boolean: toBeTrue/False, reference: toBe, existence: toBeNull/NotNull, undefined: toBeUndefined, class_obj: toContainEntries/toEqual, spy_calls: {not_called: not.toHaveBeenCalled, once: toHaveBeenCalledOnce, with_value: toHaveBeenCalledWith|toHaveBeenCalledExactlyOnceWith}}

🪛 Biome
src/main/webapp/app/shared/icon-card/icon-card.component.ts

[error] 19-19: This constructor is unnecessary.

Unsafe fix: Remove the unnecessary constructor.

(lint/complexity/noUselessConstructor)

🔇 Additional comments (32)
src/main/webapp/app/shared/icon-card/icon-card.component.html (2)

1-2: LGTM: Appropriate use of Bootstrap classes for card layout.

The card structure using Bootstrap classes card and h-100 is well-implemented, ensuring a responsive and full-height card layout.


8-11: LGTM: Appropriate use of content projection.

The use of <hr /> for visual separation and <ng-content> for content projection is well-implemented. This structure allows for flexible and reusable card content.

src/main/webapp/app/course/tutorial-groups/shared/tutorial-group-detail/tutorial-group-detail.component.scss (3)

1-1: LGTM: Good use of SCSS variable for tutor image size

The introduction of the $tutor-image-size variable is a good practice. It promotes consistency across the component and makes future adjustments easier. The value of 4.5rem seems appropriate for a profile image size in the context of a redesigned, more compact layout.


14-16: Please clarify the purpose of the negative margin

The addition of a negative bottom margin (-1rem) to the .markdown-preview class could help reduce whitespace, which aligns with the PR objectives. However, the specific purpose of this adjustment isn't entirely clear from the context provided.

Could you please explain the intended effect of this negative margin? Are there any potential layout issues that need to be considered with this approach?


Line range hint 1-33: Overall: Well-structured SCSS changes that align with PR objectives

The changes to this SCSS file effectively support the redesign of the tutorial group overview page. The introduction of the $tutor-image-size variable, along with the new classes for tutor images and default images, contributes to a more consistent and organized layout. The use of CSS custom properties for colors is a good practice for maintaining a cohesive design system.

The styles appear to reduce unnecessary whitespace and improve the presentation of information, aligning well with the PR objectives. The code is clean, well-structured, and follows SCSS best practices.

Minor suggestions have been made for further enhancements, but overall, these changes seem to effectively improve the UI as intended.

src/main/webapp/app/shared/icon-card/icon-card.component.ts (4)

1-5: LGTM: Imports are correct and follow best practices.

The imports are well-organized and include all necessary dependencies for the component's functionality. The use of FontAwesome icons and shared modules promotes consistency and code reuse across the application.


7-13: LGTM: Component decorator is well-configured.

The component is correctly set up as a standalone component, which aligns with modern Angular practices. The imports, selector, and file references are all properly configured. The 'jhi-' prefix in the selector suggests adherence to project-specific naming conventions.


15-17: LGTM: Input properties are well-defined.

The use of the new Angular 16+ input() syntax for defining properties is modern and concise. The property names follow the camelCase convention as per the coding guidelines. Providing default values for the inputs enhances the component's usability.


1-20: Overall, the IconCardComponent is well-implemented.

The component follows Angular best practices and project-specific guidelines. It uses modern features like standalone components and the new input() syntax. The code is clean, well-organized, and promotes reusability.

Minor suggestions for improvement:

  1. Remove the empty constructor.
  2. Consider localizing the default 'Title' string.

These changes will further enhance the code quality and maintainability of the component.

🧰 Tools
🪛 Biome

[error] 19-19: This constructor is unnecessary.

Unsafe fix: Remove the unnecessary constructor.

(lint/complexity/noUselessConstructor)

src/test/javascript/spec/component/shared/icon-card/icon-card.component.spec.ts (2)

1-4: LGTM: Imports are appropriate and follow best practices.

The imports include necessary testing utilities and correctly use MockDirective for isolating the component under test.


6-9: LGTM: Test suite setup follows Angular testing best practices.

The describe block and variable declarations for component and fixture are correctly implemented.

src/main/webapp/app/course/tutorial-groups/shared/tutorial-groups-shared.module.ts (3)

16-16: LGTM: Import statement for IconCardComponent.

The import statement follows Angular style guidelines and uses the correct naming convention (PascalCase) for the component. The import path suggests proper organization of shared components.


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

The modifications to this module file, specifically the addition of IconCardComponent, align well with the PR objectives of redesigning the tutorial group overview page. The introduction of this new component suggests the implementation of new UI elements, which is consistent with the goal of organizing information into a more horizontal layout using categorized cards.

However, ensure that all new UI components, including IconCardComponent, adhere to the responsive layout requirements mentioned in the PR objectives. This will help in reducing scrolling and improving accessibility as intended.


19-19: Verify if IconCardComponent is a standalone component.

The addition of IconCardComponent to the imports array suggests that it might be a standalone component. Typically, components are added to the declarations array unless they are standalone components (a feature introduced in Angular 14+).

Please verify that IconCardComponent is indeed a standalone component. If it's not, consider moving it to the declarations array instead.

Let's verify if IconCardComponent is a standalone component:

✅ Verification successful

IconCardComponent is correctly configured as a standalone component.

The addition to the imports array is appropriate.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if IconCardComponent is a standalone component

# Test: Search for standalone: true in IconCardComponent
rg --type typescript 'standalone:\s*true' app/shared/icon-card/icon-card.component.ts

# If the above command doesn't find anything, it's likely not a standalone component
if [ $? -ne 0 ]; then
  echo "IconCardComponent might not be a standalone component. Consider moving it to the declarations array."
fi

Length of output: 351


Script:

#!/bin/bash
# Description: Check if IconCardComponent is a standalone component

# Corrected Test: Search for standalone: true in IconCardComponent
rg --type ts 'standalone:\s*true' app/shared/icon-card/icon-card.component.ts

# If the above command doesn't find anything, it's likely not a standalone component
if [ $? -ne 0 ]; then
  echo "IconCardComponent might not be a standalone component. Consider moving it to the declarations array."
fi

Length of output: 392


Script:

#!/bin/bash
# Description: Locate the IconCardComponent file

# Search for all files named 'icon-card.component.ts' in the repository
fd 'icon-card\.component\.ts$'

Length of output: 92


Script:

#!/bin/bash
# Description: Check if IconCardComponent is a standalone component

# Search for 'standalone: true' in the IconCardComponent file
rg 'standalone:\s*true' src/main/webapp/app/shared/icon-card/icon-card.component.ts

# If the above command doesn't find anything, it's likely not a standalone component
if [ $? -ne 0 ]; then
  echo "IconCardComponent might not be a standalone component. Consider moving it to the declarations array."
fi

Length of output: 125

src/test/javascript/spec/component/tutorial-groups/shared/tutorial-group-detail.component.spec.ts (5)

4-4: LGTM: New imports are consistent with test changes.

The added imports for MockDirective, TranslateDirective, and IconCardComponent align well with the modifications in the test setup. These additions support the enhanced mocking strategy in the updated tests.

Also applies to: 23-24


66-66: LGTM: MockComponent for IconCardComponent added.

The addition of MockComponent(IconCardComponent) to the declarations is a good practice. It ensures that the IconCardComponent is properly mocked in the test environment, isolating the component under test and potentially improving test performance.


71-71: LGTM: MockDirective for TranslateDirective added.

The addition of MockDirective(TranslateDirective) to the declarations is appropriate. It ensures that the translation functionality is properly mocked in the test environment, which helps isolate the component under test from translation dependencies and potentially improves test reliability.


118-118: LGTM: Consistent use of MockComponent for IconCardComponent.

The addition of MockComponent(IconCardComponent) in the TutorialGroupDetailComponent test setup is consistent with the changes in the MockWrapperComponent. This ensures that the IconCardComponent is properly mocked in both test scenarios, maintaining consistency and isolation in the test environment.


121-121: LGTM: Consistent use of MockDirective for TranslateDirective.

The addition of MockDirective(TranslateDirective) in the TutorialGroupDetailComponent test setup mirrors the changes in the MockWrapperComponent. This consistency ensures that the TranslateDirective is properly mocked across all test scenarios, maintaining a uniform approach to handling translations in the test environment.

src/main/webapp/i18n/en/tutorialGroups.json (5)

58-58: LGTM: Improved JSON formatting

The addition of a trailing comma to the profilePictureAlt entry improves JSON formatting consistency. This change makes it easier to add new entries in the future and aligns with best practices for maintaining JSON files.


59-59: LGTM: Added localization for "Name" label

The addition of the "name": "Name" entry provides necessary localization support for the redesigned UI mentioned in the PR objectives. This change aligns with the goal of improving the tutorial group overview page's layout and information presentation.


60-60: LGTM: Added localization for "Information" label

The addition of the "information": "Information" entry provides necessary localization support for the redesigned UI mentioned in the PR objectives. This change supports the new categorized cards layout, contributing to the improved organization and accessibility of the tutorial group overview page.


58-61: Summary: Localization updates align with PR objectives

The changes to the localization file support the redesigned UI for the tutorial group overview page as described in the PR objectives. The new entries for "Name", "Information", and "Not Online" status contribute to the improved layout and information presentation.

All changes are consistent with the existing file structure and naming conventions. The only point of consideration is the potential duplication between the new isNotOnline entry and the existing offline entry in the generic section. Please review the usage of these keys as suggested in the previous comment to ensure both are necessary and distinct.

Overall, these localization updates effectively support the UI improvements outlined in the PR objectives.


61-61: LGTM: Added localization for "Not Online" status, but verify necessity

The addition of the "isNotOnline": "Not Online" entry provides localization support for displaying the offline status of tutorial groups in the redesigned UI. This aligns with the PR objectives of improving information presentation.

However, please verify if this new entry is necessary, as there's an existing "offline": "Offline" entry in the generic section that might serve a similar purpose. If both are needed, consider adding a comment explaining the difference to avoid confusion for future maintainers.

To check for potential duplication, run the following script:

✅ Verification successful

LGTM: Added localization for "Not Online" status

The addition of the "isNotOnline": "Not Online" entry provides localization support for displaying the offline status of tutorial groups in the redesigned UI. This aligns with the PR objectives of improving information presentation.

No existing usages of "offline" or "isNotOnline" were found elsewhere in the codebase, indicating that this new entry does not duplicate existing keys.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for usage of both "offline" and "isNotOnline" keys in the codebase

echo "Searching for 'offline' key usage:"
rg --type typescript --type html "(?<!')\b(offline|'offline')\b(?!')" src/main/webapp

echo "\nSearching for 'isNotOnline' key usage:"
rg --type typescript --type html "(?<!')\b(isNotOnline|'isNotOnline')\b(?!')" src/main/webapp

Length of output: 875


Script:

#!/bin/bash
# Description: Search for usage of both "offline" and "isNotOnline" keys in the codebase without using look-around

echo "Searching for 'offline' key usage:"
rg --type typescript --type html '"offline"\s*:' src/main/webapp

echo "\nSearching for 'isNotOnline' key usage:"
rg --type typescript --type html '"isNotOnline"\s*:' src/main/webapp

Length of output: 389


Script:

#!/bin/bash
# Description: Search for usage of both "offline" and "isNotOnline" keys in the codebase by specifying file extensions

echo "Searching for 'offline' key usage:"
rg -g "*.ts" -g "*.tsx" -g "*.html" '"offline"\s*:' src/main/webapp

echo "\nSearching for 'isNotOnline' key usage:"
rg -g "*.ts" -g "*.tsx" -g "*.html" '"isNotOnline"\s*:' src/main/webapp

Length of output: 325

src/main/webapp/i18n/de/tutorialGroups.json (3)

58-58: LGTM: Improved JSON formatting

The addition of the trailing comma improves consistency in the JSON structure and follows best practices for maintainability.


59-59: LGTM: Appropriate translation for "name"

The translation for "name" is correct and concise. It uses a neutral term that doesn't require informal/formal distinction.


60-60: LGTM: Correct translation for "information"

The translation for "information" is accurate, using the same word in German. It's a neutral term that doesn't require informal/formal distinction.

src/main/webapp/app/course/tutorial-groups/shared/tutorial-group-detail/tutorial-group-detail.component.ts (4)

9-9: Appropriate Import of FontAwesome Icons

The import statement correctly imports the necessary FontAwesome icons for use in the component.


37-40: Property Names Adhere to CamelCase Convention

The properties tutorInitials, tutorDefaultProfilePictureHue, isMessagingEnabled, and utilization are well-named using camelCase, complying with the coding guidelines.


110-110: Consistent Update of Dependent Properties After Attendance Recalculation

Calling this.getTutorialDetail(); after recalculating attendance details ensures that all dependent properties, such as utilization, are updated accordingly. This maintains consistency in the component's state.


71-71: Verify the Invocation of getTutorialDetail() in ngOnChanges

Calling this.getTutorialDetail(); within ngOnChanges ensures that component properties are updated when input properties change. However, confirm that this does not introduce unnecessary computations or side effects, especially if ngOnChanges triggers frequently.

Run the following script to check for potential performance issues related to getTutorialDetail():

✅ Verification successful

Verified: Invocation of getTutorialDetail() in ngOnChanges does not introduce unnecessary computations or side effects.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if getTutorialDetail() has side effects that could affect performance.

# Search for all usages of getTutorialDetail() in the TypeScript files to ensure it doesn't cause unintended side effects.
rg --type ts 'getTutorialDetail\(\)' -A 5 -B 5

Length of output: 4532

src/main/webapp/app/course/tutorial-groups/shared/tutorial-group-detail/tutorial-group-detail.component.html (1)

95-96: Ensure Language Information is Localized

tutorialGroup.language might be a code or enum that isn't localized. To provide a better user experience, ensure that the language is displayed in the user's locale.

Please check if tutorialGroup.language is a localized string. If not, consider using a translation pipe or mapping it to a localized value.

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: 10

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

📥 Commits

Files that changed from the base of the PR and between a5c3824 and fc3e2d1.

📒 Files selected for processing (4)
  • src/main/webapp/app/course/tutorial-groups/shared/tutorial-group-detail/tutorial-group-detail.component.ts (5 hunks)
  • src/main/webapp/app/shared/icon-card/icon-card.component.html (1 hunks)
  • src/main/webapp/app/shared/icon-card/icon-card.component.ts (1 hunks)
  • src/test/javascript/spec/component/shared/icon-card/icon-card.component.spec.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
src/main/webapp/app/course/tutorial-groups/shared/tutorial-group-detail/tutorial-group-detail.component.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

src/main/webapp/app/shared/icon-card/icon-card.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/icon-card/icon-card.component.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

src/test/javascript/spec/component/shared/icon-card/icon-card.component.spec.ts (1)

Pattern src/test/javascript/spec/**/*.ts: jest: true; mock: NgMocks; bad_practices: avoid_full_module_import; perf_improvements: mock_irrelevant_deps; service_testing: mock_http_for_logic; no_schema: avoid_NO_ERRORS_SCHEMA; expectation_specificity: true; solutions: {boolean: toBeTrue/False, reference: toBe, existence: toBeNull/NotNull, undefined: toBeUndefined, class_obj: toContainEntries/toEqual, spy_calls: {not_called: not.toHaveBeenCalled, once: toHaveBeenCalledOnce, with_value: toHaveBeenCalledWith|toHaveBeenCalledExactlyOnceWith}}

🔇 Additional comments (8)
src/main/webapp/app/shared/icon-card/icon-card.component.ts (4)

1-5: LGTM: Imports are correct and well-organized.

The imports follow Angular style guide recommendations, including the correct order (Angular core, third-party libraries, application-specific imports). All imported items are used in the component, and necessary dependencies are included.


7-13: LGTM: Component decorator is well-configured.

The component decorator follows Angular best practices:

  • Standalone component configuration is used, aligning with modern Angular development.
  • The selector 'jhi-icon-card' follows the project's naming convention.
  • Template and style files are correctly linked.
  • Necessary shared modules are imported, promoting code reuse.

14-16: LGTM: Modern input syntax is used correctly.

The component class uses the new input() syntax for defining input properties, which aligns with the latest Angular practices. The default value for headerIcon is appropriately set to faCircleInfo.


17-17: 🧹 Nitpick (assertive)

Consider localizing the default 'Title' string.

To maintain consistency with localization practices and support multiple languages, consider using a localized string for the default 'Title' value.

src/test/javascript/spec/component/shared/icon-card/icon-card.component.spec.ts (1)

37-38: Unnecessary fixture.detectChanges() After Input Assignment

After assigning inputs directly to the component instance, Angular change detection should be run to update the view. However, since we're testing component properties and not the rendered template, you might not need fixture.detectChanges(); here. If you're asserting on the DOM, then this is appropriate.

Please verify if fixture.detectChanges(); is necessary in this context.

src/main/webapp/app/course/tutorial-groups/shared/tutorial-group-detail/tutorial-group-detail.component.ts (3)

9-9: Import statement follows best practices

The import of FontAwesome icons is correctly formatted and uses single quotes, adhering to the coding guidelines.


37-40: Properties are properly defined with appropriate naming conventions

The newly added properties are well-named using camelCase, and their types are correctly specified.


71-71: Appropriate method call to update component state

Calling this.getTutorialDetail(); within ngOnChanges ensures that the component updates its internal state whenever input properties change, which is appropriate.

coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 10, 2024
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: 5

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

📥 Commits

Files that changed from the base of the PR and between fc3e2d1 and 90fd4f8.

📒 Files selected for processing (1)
  • src/test/javascript/spec/component/shared/icon-card/icon-card.component.spec.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/test/javascript/spec/component/shared/icon-card/icon-card.component.spec.ts (1)

Pattern src/test/javascript/spec/**/*.ts: jest: true; mock: NgMocks; bad_practices: avoid_full_module_import; perf_improvements: mock_irrelevant_deps; service_testing: mock_http_for_logic; no_schema: avoid_NO_ERRORS_SCHEMA; expectation_specificity: true; solutions: {boolean: toBeTrue/False, reference: toBe, existence: toBeNull/NotNull, undefined: toBeUndefined, class_obj: toContainEntries/toEqual, spy_calls: {not_called: not.toHaveBeenCalled, once: toHaveBeenCalledOnce, with_value: toHaveBeenCalledWith|toHaveBeenCalledExactlyOnceWith}}

🔇 Additional comments (1)
src/test/javascript/spec/component/shared/icon-card/icon-card.component.spec.ts (1)

1-5: 🧹 Nitpick (assertive)

Organize imports for better readability.

Consider reorganizing the imports alphabetically and grouping them by module or functionality for improved readability and maintainability.

Apply this diff to reorganize the imports:

import { ComponentFixture, TestBed } from '@angular/core/testing';
+import { faCircleInfo, faCoffee } from '@fortawesome/free-solid-svg-icons';
import { MockDirective } from 'ng-mocks';
import { IconCardComponent } from 'app/shared/icon-card/icon-card.component';
import { TranslateDirective } from 'app/shared/language/translate.directive';
-import { faCircleInfo, faCoffee } from '@fortawesome/free-solid-svg-icons';

Likely invalid or redundant comment.

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: 2

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

📥 Commits

Files that changed from the base of the PR and between 90fd4f8 and 0de2b91.

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

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

🔇 Additional comments (5)
src/main/webapp/app/course/tutorial-groups/shared/tutorial-group-detail/tutorial-group-detail.component.ts (2)

94-94: ⚠️ Potential issue

Use Strict Null Checks for teachingAssistantId

The current ternary operator may incorrectly handle cases where teachingAssistantId is 0, as 0 is falsy in JavaScript. This could result in using 'default' instead of the actual ID.

Update the condition to use a strict null check:

- this.tutorDefaultProfilePictureHue = getBackgroundColorHue(tutorialGroup.teachingAssistantId ? tutorialGroup.teachingAssistantId.toString() : 'default');
+ this.tutorDefaultProfilePictureHue = getBackgroundColorHue(tutorialGroup.teachingAssistantId != null ? tutorialGroup.teachingAssistantId.toString() : 'default');

97-100: ⚠️ Potential issue

Handle Zero Values Correctly in Utilization Calculation

The condition if (tutorialGroup.averageAttendance && tutorialGroup.capacity) will evaluate to false if either averageAttendance or capacity is 0, even though 0 can be a valid value. This may prevent utilization from being calculated when appropriate.

Also, ensure division by zero is prevented when capacity is 0.

Adjust the condition to include strict null checks and explicitly handle zero:

- if (tutorialGroup.averageAttendance && tutorialGroup.capacity) {
+ if (tutorialGroup.averageAttendance != null && tutorialGroup.capacity != null && tutorialGroup.capacity !== 0) {
src/main/webapp/app/course/tutorial-groups/shared/tutorial-group-detail/tutorial-group-detail.component.html (3)

8-41: LGTM: Teaching Assistant Details Section

The implementation of the teaching assistant details using jhi-icon-card and Bootstrap grid classes is correct. The use of conditional rendering with @if enhances readability, and the component effectively displays the tutor's information.


44-88: LGTM: Utilization Metrics Section

The utilization metrics are accurately presented, and the use of progress bars with dynamic classes based on utilization thresholds is appropriate. The inclusion of tooltips improves user understanding.


90-132: LGTM: Tutorial Group Information Section

The tutorial group information is well-organized, and the conditional translation keys enhance internationalization support. The display logic for online status is clear and user-friendly.

@krusche krusche added this to the 7.6.0 milestone Oct 11, 2024
@krusche
Copy link
Member

krusche commented Oct 11, 2024

Great improvements 👍 let's merge this PR asap

Copy link

⚠️ Unable to deploy to test servers ⚠️

Testserver "artemis-test2.artemis.cit.tum.de" is already in use by PR #9454.

@github-actions github-actions bot added the deployment-error Added by deployment workflows if an error occured label Oct 12, 2024
@SimonEntholzer SimonEntholzer added deploy:artemis-test1 and removed deployment-error Added by deployment workflows if an error occured labels Oct 12, 2024
@SimonEntholzer SimonEntholzer temporarily deployed to artemis-test1.artemis.cit.tum.de October 12, 2024 10:28 — with GitHub Actions Inactive
Copy link
Member

@anian03 anian03 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 TS1, works as described, but I have some small remarks:

  • I'm a bit confused about the icon for "Tutor". Why does it have a checkmark? I don't really see what that checkmark says. Just having the person icon seems sufficient to me.
  • The placement of the conversation channel link under "Tutor" might be a bit confusing. Maybe we could rename this section into something more broad like "Tutorial" (and then "Tutor" instead of "Name", as well as the schedule in this section instead?)
  • An option to start a DM with the tutor might be nice on this screen :)

@krusche
Copy link
Member

krusche commented Oct 12, 2024

Tested on TS1, works as described, but I have some small remarks:

  • I'm a bit confused about the icon for "Tutor". Why does it have a checkmark? I don't really see what that checkmark says. Just having the person icon seems sufficient to me.
  • The placement of the conversation channel link under "Tutor" might be a bit confusing. Maybe we could rename this section into something more broad like "Tutorial" (and then "Tutor" instead of "Name", as well as the schedule in this section instead?)
  • An option to start a DM with the tutor might be nice on this screen :)

Thanks for these suggestions. Let’s work on them in a follow-up

Copy link
Member

@anian03 anian03 left a comment

Choose a reason for hiding this comment

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

Thanks for these suggestions. Let’s work on them in a follow-up

Alright, that's fine too, this is definitely not hugely important right now. Will approve 👍

@krusche krusche merged commit 29add81 into develop Oct 12, 2024
49 of 54 checks passed
@krusche krusche deleted the feature/tutorial-groups/redesign-overview-page branch October 12, 2024 16:04
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!) component:TutorialGroups ready for review tests
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants