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: Add default message to empty FAQ view #9467

Merged

Conversation

cremertim
Copy link
Contributor

@cremertim cremertim commented Oct 13, 2024

Checklist

General

Client

  • I added multiple screenshots/screencasts of my UI changes.
  • I translated all newly inserted strings into English and German.

Steps for Testing

Prerequisites:

  • 1 Student
  • 1 Instructor
  • 1 Course with FAQ enabled
  1. Log in to Artemis

  2. Navigate into FAQ tab of a course without FAQ

  3. See new message displayed

  4. Create a FAQ

  5. Enter a search value, that does NOT meet the new FAQ

  6. See new message displayed

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

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Screenshots

image
image

Summary by CodeRabbit

  • New Features

    • Enhanced FAQ section with conditional messages for empty FAQs and no matching results.
    • Added support for Markdown formatting in FAQs.
  • Localization Updates

    • New German and English messages for when no FAQs exist or match the search criteria.

@cremertim cremertim requested a review from a team as a code owner October 13, 2024 12:57
@github-actions github-actions bot added the client Pull requests that update TypeScript code. (Added Automatically!) label Oct 13, 2024
@ls1intum ls1intum deleted a comment from coderabbitai bot Oct 13, 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: 4

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

📥 Commits

Files that changed from the base of the PR and between 330a677 and 70cda66.

📒 Files selected for processing (4)
  • src/main/webapp/app/overview/course-faq/course-faq.component.html (1 hunks)
  • src/main/webapp/app/overview/course-faq/course-faq.component.ts (1 hunks)
  • src/main/webapp/i18n/de/faq.json (1 hunks)
  • src/main/webapp/i18n/en/faq.json (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
src/main/webapp/app/overview/course-faq/course-faq.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/overview/course-faq/course-faq.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/faq.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".

🔇 Additional comments (8)
src/main/webapp/i18n/en/faq.json (2)

23-23: LGTM: Syntactically correct modification

The addition of a trailing comma after the "course" key is correct and necessary for adding new key-value pairs. This change aligns with JSON best practices and improves maintainability.


23-25: Summary: Changes align well with PR objectives

The modifications to this localization file successfully address the PR objective of enhancing user experience in the FAQ section. The new messages provide clear feedback when the FAQ view is empty or when search/filter criteria yield no results. These changes will significantly improve user guidance and clarity in such scenarios.

The implementation is consistent with localization best practices and integrates well with the existing structure. The minor suggestions for key naming, if applied, would further enhance code readability and maintainability.

Overall, these changes effectively fulfill the PR's goal of displaying a default message when the FAQ view is empty, thereby improving the overall user experience in the Artemis application.

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

24-24: LGTM: Correct informal style and accurate translation.

The new entry "noExisting" adheres to the informal style (dutzen) as required by the coding guidelines. The translation accurately conveys the message that no FAQ exists for the course yet.

src/main/webapp/app/overview/course-faq/course-faq.component.html (2)

30-32: LGTM! Correct usage of new Angular syntax.

The conditional rendering for empty FAQ list is implemented correctly using the new @if syntax as per the coding guidelines. The message is properly localized using the jhiTranslate directive, which aligns with best practices for internationalization.


30-40: Summary: Excellent implementation of user feedback for empty FAQ scenarios.

The changes in this file successfully address the PR objectives by enhancing the user experience in the FAQ section. The implementation provides clear feedback when there are no FAQs or no matching FAQs after filtering. Key points:

  1. Correct usage of new Angular @if syntax as per coding guidelines.
  2. Proper localization of messages using jhiTranslate directive.
  3. Logical placement of conditional blocks for different scenarios.

These changes will significantly improve the clarity and guidance for users navigating the FAQ section, especially when it's empty or when a search yields no results.

src/main/webapp/app/overview/course-faq/course-faq.component.ts (3)

19-19: LGTM: Import of ArtemisMarkdownModule

The import of ArtemisMarkdownModule is correctly added and follows the Angular style guide recommendations.


27-27: LGTM: Addition of ArtemisMarkdownModule to imports

The ArtemisMarkdownModule is correctly added to the imports array of the component decorator.


Line range hint 1-121: Consider the following improvements and verifications:

  1. Memory Management: The component implements OnDestroy and unsubscribes from observables, which is good practice. However, consider using the takeUntil operator with ngUnsubscribe for all subscriptions to ensure proper cleanup.

  2. Error Handling: The error handling in loadFaqs method uses onError utility. Ensure this utility provides appropriate error messages to users.

  3. Performance: The refreshFaqList method is called on each keystroke (debounced). For large datasets, consider implementing virtual scrolling or pagination to improve performance.

  4. Accessibility: Ensure that the FAQ list and search functionality are accessible. This includes proper ARIA attributes and keyboard navigation.

  5. Localization: Verify that all user-facing strings are properly localized using Angular's i18n features.

To verify the template changes and localization:

Copy link

coderabbitai bot commented Oct 13, 2024

Walkthrough

The pull request introduces modifications to the FAQ component in the application. It adds conditional rendering in the HTML file to display messages based on the state of the FAQ data. Additionally, it imports the ArtemisMarkdownModule into the component's TypeScript file. The localization files for both German and English are updated with new keys to provide appropriate messages when no FAQs are available or when no matching FAQs are found.

Changes

File Path Change Summary
src/main/webapp/app/overview/course-faq/course-faq.component.html Added conditional blocks to display messages when faqs are empty or when there are no matching FAQs.
src/main/webapp/app/overview/course-faq/course-faq.component.ts Imported ArtemisMarkdownModule into the component's imports array.
src/main/webapp/i18n/de/faq.json Added new keys "noExisting" and "noMatching" with corresponding German messages for the FAQ section.
src/main/webapp/i18n/en/faq.json Added new keys "noExisting" and "noMatching" with corresponding English messages for the FAQ section; modified existing "course" label to include a trailing comma.

Possibly related PRs

Suggested labels

tests, user interface, ready to merge, communication

Suggested reviewers

  • JohannesStoehr
  • pzdr7
  • SimonEntholzer
  • anian03

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

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

📥 Commits

Files that changed from the base of the PR and between 330a677 and 70cda66.

📒 Files selected for processing (4)
  • src/main/webapp/app/overview/course-faq/course-faq.component.html (1 hunks)
  • src/main/webapp/app/overview/course-faq/course-faq.component.ts (1 hunks)
  • src/main/webapp/i18n/de/faq.json (1 hunks)
  • src/main/webapp/i18n/en/faq.json (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
src/main/webapp/app/overview/course-faq/course-faq.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/overview/course-faq/course-faq.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/faq.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".

🔇 Additional comments (8)
src/main/webapp/i18n/en/faq.json (2)

23-23: LGTM: Proper JSON formatting

The addition of the trailing comma after the "course" key is a good practice. It allows for easier addition of new entries and improves the overall maintainability of the JSON file.


23-25: Overall assessment: LGTM with minor suggestions

The changes to this file successfully implement the required functionality for displaying messages when no FAQs are available or no matching FAQs are found. This aligns perfectly with the PR objectives to enhance the user experience in the FAQ section.

The messages are clear, concise, and informative. The only suggestions are to consider renaming the keys for improved clarity and consistency, as mentioned in the individual comments.

Great job on implementing these user-friendly messages!

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

25-25: Acknowledging past review comment.

The new entry "noMatching" adheres to the informal style (dutzen) as required by the coding guidelines. The translation accurately conveys the message that no FAQ matches the combination of filter and search criteria.

A previous review comment has already suggested pluralizing "FAQ" in this entry for consistency and clarity. This suggestion is still valid and applicable.

src/main/webapp/app/overview/course-faq/course-faq.component.html (2)

30-32: LGTM! Conditional rendering for empty FAQ state implemented correctly.

The changes introduce a new conditional block using the @if directive, which aligns with the coding guidelines. The condition faqs.length === 0 correctly checks for an empty FAQ list, and the message is properly localized using jhiTranslate. The implementation enhances user experience by providing feedback when no FAQs exist.


38-40: LGTM! Conditional rendering for no matching FAQs implemented correctly.

The changes introduce a new conditional block using the @if directive, adhering to the coding guidelines. The condition filteredFaqs.length === 0 && faqs.length > 0 correctly checks for no matching FAQs after filtering while ensuring existing FAQs are present. The message is properly localized using jhiTranslate, and the CSS class "markdown-preview" is used consistently with the previous message.

Note: The past review comment suggesting a minor adjustment for consistency has been addressed in this implementation.

src/main/webapp/app/overview/course-faq/course-faq.component.ts (3)

19-19: LGTM: Import of ArtemisMarkdownModule

The import of ArtemisMarkdownModule is correctly placed and follows the coding guidelines. It uses single quotes and adheres to the PascalCase naming convention for modules.


Line range hint 1-124: Overall assessment: Changes look good

The changes to this file are minimal and focused on adding markdown functionality to the CourseFaqComponent. The import and usage of ArtemisMarkdownModule adhere to the provided coding guidelines. No other parts of the component logic were modified, maintaining the existing functionality.

To ensure these changes are fully utilized:

  1. Verify that markdown is used in the corresponding template file as suggested in the previous comment.
  2. Consider adding a brief comment explaining the purpose of adding markdown functionality to this component, which would enhance code maintainability.

27-27: LGTM: Addition of ArtemisMarkdownModule to imports

The ArtemisMarkdownModule is correctly added to the imports array in the @component decorator. This addition suggests that markdown functionality will be used in the component's template.

To ensure this addition is necessary, please verify that markdown functionality is actually used in the corresponding template file. You can run the following command to check for markdown usage in the template:

If no results are found, consider removing the ArtemisMarkdownModule import and its addition to the imports array to keep the component lean.

✅ Verification successful

Verified: ArtemisMarkdownModule is utilized in the component's template

The presence of markdown-preview classes in course-faq.component.html confirms that ArtemisMarkdownModule is being used to provide markdown functionality in the component.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for markdown usage in the course-faq component template

# Test: Search for markdown-related elements or directives in the template file
rg --type html 'markdown|artemis-markdown' src/main/webapp/app/overview/course-faq/course-faq.component.html

Length of output: 278

src/main/webapp/i18n/en/faq.json Show resolved Hide resolved
src/main/webapp/i18n/en/faq.json Show resolved Hide resolved
src/main/webapp/i18n/de/faq.json Show resolved Hide resolved
Copy link
Contributor

@SimonEntholzer SimonEntholzer left a comment

Choose a reason for hiding this comment

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

Code changes for the UI improvement make sense

Copy link
Contributor

@asliayk asliayk left a comment

Choose a reason for hiding this comment

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

tested locally and works as expected

@krusche krusche changed the title Communication Add default message to empty FAQ view Communication: Add default message to empty FAQ view Oct 13, 2024
@krusche krusche added this to the 7.6.0 milestone Oct 13, 2024
@krusche krusche changed the title Communication: Add default message to empty FAQ view Communication: Add default message to empty FAQ view Oct 13, 2024
@krusche krusche merged commit ba666c4 into develop Oct 13, 2024
31 of 38 checks passed
@krusche krusche deleted the bugfix/communication/add-default-message-to-course-overview branch October 13, 2024 20:28
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!) ready for review
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants