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: Always show favorite channels #9510

Merged
merged 17 commits into from
Oct 20, 2024

Conversation

cremertim
Copy link
Contributor

@cremertim cremertim commented Oct 18, 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 principle of data economy for all client-server REST calls.
  • 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.

Motivation and Context

Empty channels consume a lot of space in the sidebar for the fact that you cannot click on them

Description

Default open favorites tab on a new tab
removed empty channels

Steps for Testing

Prerequisites:

  • 1 Student
  • 1 Couse without a exercise / exam / lecture
  1. Log in to Artemis
  2. Navigate to Course Overview
  3. Go to communication tab
  4. See that favorite channels is per defauled uncollapsed
  5. See that exercise, exam and lecture channels are not shown
  6. Create for each one entity
  7. Go back to communication
  8. See the channels now
  9. Make sure each tab with the sidebar works (Conversation, Lectures, Exams, TutorialGroups, Exercises)

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
Lectures and exams are missing because they are empty

Summary by CodeRabbit

  • New Features

    • Enhanced sidebar functionality with dynamic visibility management for items.
    • Introduced a new property [sidebarItemAlwaysShow] for improved configurability.
    • Improved control over the display of the code of conduct based on user acceptance and course setup status.
  • Bug Fixes

    • Updated storage mechanism for sidebar collapse states from sessionStorage to localStorage for better persistence.
  • Improvements

    • Streamlined conditional rendering logic in the sidebar for improved clarity and usability.
    • Added a new type SidebarItemShowAlways to manage sidebar item visibility settings.

@cremertim cremertim requested a review from a team as a code owner October 18, 2024 10:06
@github-actions github-actions bot added the client Pull requests that update TypeScript code. (Added Automatically!) label Oct 18, 2024
@cremertim cremertim changed the title Feature/communication/hide empty channels Communication: Do not show channel if it is empty Oct 18, 2024
Copy link

coderabbitai bot commented Oct 18, 2024

Walkthrough

The changes enhance the sidebar functionality by introducing a new input property [sidebarItemAlwaysShow] across multiple components, linked to the DEFAULT_SHOW_ALWAYS constant. This constant is defined in the respective TypeScript files, allowing for dynamic visibility management of sidebar items. The storage mechanism for collapse states in the sidebar accordion component is switched from sessionStorage to localStorage, ensuring persistence across sessions. Additionally, the conditional rendering logic in the sidebar accordion is refined for clarity.

Changes

File Path Change Summary
src/main/webapp/app/overview/course-conversations/course-conversations.component.html Added property [sidebarItemAlwaysShow]="DEFAULT_SHOW_ALWAYS" in <jhi-sidebar>.
src/main/webapp/app/overview/course-conversations/course-conversations.component.ts Introduced constant DEFAULT_SHOW_ALWAYS: SidebarItemShowAlways; modified DEFAULT_COLLAPSE_STATE.
src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.html Streamlined conditional rendering logic for sidebar items.
src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.ts Updated storage from sessionStorage to localStorage for collapse states; added input property sidebarItemAlwaysShow.
src/main/webapp/app/shared/sidebar/sidebar.component.html Added property [sidebarItemAlwaysShow]="sidebarItemAlwaysShow()" in <jhi-sidebar-accordion>.
src/main/webapp/app/shared/sidebar/sidebar.component.ts Added input property sidebarItemAlwaysShow: SidebarItemShowAlways; updated event emitter initializations; defined inCommunication.
src/main/webapp/app/types/sidebar.ts New type SidebarItemShowAlways defined.
src/test/javascript/spec/component/shared/sidebar/sidebar-accordion.component.spec.ts Enhanced test setup by adding input property sidebarItemAlwaysShow to test visibility states.

Possibly related PRs

Suggested labels

small, bugfix, ready to merge, component:Communication

Suggested reviewers

  • edkaya
  • rabeatwork
  • SimonEntholzer
  • pzdr7

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 337f0b8 and 30acc67.

📒 Files selected for processing (1)
  • src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.html (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.html

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

🧹 Outside diff range and nitpick comments (16)
src/main/webapp/app/overview/course-tutorial-groups/course-tutorial-groups.component.html (1)

4-10: LGTM! Consider adding a comment for clarity.

The addition of the [sidebarItemShowAlways] input property to the <jhi-sidebar> component aligns well with the PR objective of managing the visibility of sidebar items. The use of DEFAULT_ALWAYS_SHOW constant is a good practice for maintaining consistency.

Consider adding a brief comment above the <jhi-sidebar> component to explain the purpose of the sidebarItemShowAlways property, which could help other developers understand its role in hiding empty channels. For example:

<!-- Controls visibility of sidebar items, used to hide empty channels -->
<jhi-sidebar
    [itemSelected]="tutorialGroupSelected"
    [courseId]="courseId"
    [sidebarData]="sidebarData"
    [collapseState]="DEFAULT_COLLAPSE_STATE"
    [sidebarItemShowAlways]="DEFAULT_ALWAYS_SHOW"
/>
src/main/webapp/app/overview/course-exercises/course-exercises.component.html (1)

4-11: LGTM! Consider adding a comment for clarity.

The addition of the [sidebarItemShowAlways] input property aligns well with the PR objective of hiding empty channels. This change allows for more granular control over which sidebar items are always displayed.

Consider adding a brief comment above the <jhi-sidebar> component to explain the purpose of the DEFAULT_ALWAYS_SHOW constant and how it affects the visibility of sidebar items. This would enhance code readability and maintainability.

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

3-12: Consider simplifying the ngClass condition.

The restructuring of the div elements looks good and maintains the existing functionality. However, the ngClass directive contains a complex condition:

[ngClass]="{ 'd-none': (!showAddOptions || searchValue?.length !== 0) && !(groupedData[groupKey].entityData | searchFilter: ['title', 'type'] : searchValue)?.length }"

This condition might be difficult to understand and maintain. Consider extracting this logic into a component method for better readability and maintainability.

src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.ts (1)

35-35: LGTM: New input property declaration looks good.

The use of input.required<SidebarItemShowAlways>() for the sidebarItemShowAlways property ensures type safety and makes it a required input. This aligns with Angular's latest best practices for declaring input properties.

Consider adding a brief JSDoc comment above this line to describe the purpose of this input property. For example:

/** Determines which sidebar items should always be shown */
sidebarItemShowAlways = input.required<SidebarItemShowAlways>();

This would enhance code readability and provide context for other developers.

src/main/webapp/app/overview/course-conversations/course-conversations.component.html (1)

35-37: LGTM! Consider adding a comment for clarity.

The addition of the [sidebarItemShowAlways] input property is a good implementation for managing the visibility of sidebar items dynamically. This aligns well with the PR objectives of enhancing the user interface.

Consider adding a brief comment above this line to explain the purpose of the ALWAYS_SHOW constant and how it affects the sidebar item visibility. This would improve code readability and maintainability.

+    <!-- ALWAYS_SHOW constant determines which sidebar items are always visible -->
     [sidebarItemShowAlways]="ALWAYS_SHOW"
     [collapseState]="DEFAULT_COLLAPSE_STATE"
src/main/webapp/app/shared/sidebar/sidebar.component.html (1)

54-54: LGTM! Consider adding a comment for clarity.

The addition of the [sidebarItemShowAlways] input property to the <jhi-sidebar-accordion> component is correct and aligns with the PR objective of managing the visibility of sidebar items. The implementation uses proper Angular property binding syntax.

For improved clarity, consider adding a brief comment above this line explaining the purpose of the sidebarItemShowAlways property. For example:

<!-- Controls the visibility of sidebar items that should always be shown -->
[sidebarItemShowAlways]="sidebarItemShowAlways()"

This would help other developers quickly understand the purpose of this property without needing to refer to the component's TypeScript file.

src/main/webapp/app/types/sidebar.ts (1)

28-30: LGTM! Consider adding a brief comment for clarity.

The new SidebarItemShowAlways type is well-structured and consistent with existing types. It effectively combines a flexible string-keyed record with specific category records, which aligns with the PR's objective of managing sidebar item visibility.

Consider adding a brief comment above the type definition to explain its purpose and usage. For example:

/**
 * Defines which sidebar items should always be shown for different categories.
 * Allows for both custom string keys and predefined category keys.
 */
export type SidebarItemShowAlways = {
    // ... (rest of the type definition)

This would enhance code readability and maintainability.

src/main/webapp/app/overview/course-lectures/course-lectures.component.ts (2)

26-32: LGTM: New constant DEFAULT_ALWAYS_SHOW added correctly.

The new constant DEFAULT_ALWAYS_SHOW is well-defined and follows the coding guidelines. It's appropriately typed as SidebarItemShowAlways and all properties are set to false, which aligns with the PR objectives of hiding empty channels by default.

Consider adding a brief comment explaining the purpose of this constant, especially its relationship to hiding empty channels. This would enhance code readability and maintainability.

// Default visibility settings for sidebar items, initially set to hide all empty channels
const DEFAULT_ALWAYS_SHOW: SidebarItemShowAlways = {
    // ... (rest of the code remains the same)
};

130-130: LGTM: New protected readonly property added correctly.

The new protected readonly property DEFAULT_ALWAYS_SHOW is correctly added to the component class. It follows the coding guidelines and provides access to the constant within the component's template.

Consider moving this property declaration to the top of the class, grouping it with other class properties. This would improve code organization and readability. For example:

export class CourseLecturesComponent implements OnInit, OnDestroy {
    private parentParamSubscription: Subscription;
    private courseUpdatesSubscription: Subscription;
    course?: Course;
    courseId: number;

    lectureSelected: boolean = true;
    sidebarData: SidebarData;
    accordionLectureGroups: AccordionGroups = DEFAULT_UNIT_GROUPS;
    sortedLectures: Lecture[] = [];
    sidebarLectures: SidebarCardElement[] = [];
    isCollapsed: boolean = false;
    readonly DEFAULT_COLLAPSE_STATE = DEFAULT_COLLAPSE_STATE;
    protected readonly DEFAULT_ALWAYS_SHOW = DEFAULT_ALWAYS_SHOW;

    // ... rest of the class
}
src/main/webapp/app/overview/course-exercises/course-exercises.component.ts (2)

30-36: LGTM: New constant declaration is correct. Consider adding a comment.

The new constant DEFAULT_ALWAYS_SHOW is correctly declared and initialized. It follows the proper naming convention for constants and uses the SidebarItemShowAlways type appropriately.

Consider adding a brief comment explaining the purpose of this constant, similar to the other constants in this file. For example:

// Default configuration for always showing sidebar items
const DEFAULT_ALWAYS_SHOW: SidebarItemShowAlways = {
    // ... (rest of the code remains the same)
};

165-165: LGTM: Class property added correctly. Consider relocating for better organization.

The DEFAULT_ALWAYS_SHOW constant is correctly added as a protected readonly property to the CourseExercisesComponent class.

For better code organization and readability, consider moving this property declaration to the top of the class, grouping it with other similar properties or constants. For example:

export class CourseExercisesComponent implements OnInit, OnDestroy {
    private parentParamSubscription: Subscription;
    private courseUpdatesSubscription: Subscription;
    private ltiSubscription: Subscription;

    course?: Course;
    courseId: number;
    sortedExercises?: Exercise[];
    exerciseForGuidedTour?: Exercise;

    exerciseSelected: boolean = true;
    accordionExerciseGroups: AccordionGroups = DEFAULT_UNIT_GROUPS;
    sidebarData: SidebarData;
    sidebarExercises: SidebarCardElement[] = [];
    isCollapsed: boolean = false;
    readonly DEFAULT_COLLAPSE_STATE = DEFAULT_COLLAPSE_STATE;
    protected readonly DEFAULT_ALWAYS_SHOW = DEFAULT_ALWAYS_SHOW;
    isLti: boolean = false;

    // ... rest of the class
}

This organization keeps all the class properties and constants together, improving the overall structure of the component.

src/main/webapp/app/shared/sidebar/sidebar.component.ts (1)

35-35: LGTM: New input property added correctly.

The sidebarItemShowAlways property is correctly implemented using the new input.required<>() syntax from Angular. This ensures that the property must be provided by the parent component, which aligns with the PR objective of managing the visibility of sidebar items.

Consider adding a brief comment explaining the purpose of this property and how it affects the sidebar's behavior. This would improve code readability and maintainability.

src/main/webapp/app/overview/course-tutorial-groups/course-tutorial-groups.component.ts (1)

31-35: LGTM: New constant DEFAULT_ALWAYS_SHOW added correctly.

The constant is well-defined and follows the coding guidelines. However, for better readability and consistency with the coding guidelines, consider using single quotes for the property names.

Here's a suggested improvement:

const DEFAULT_ALWAYS_SHOW: SidebarItemShowAlways = {
    'registered': false,
    'all': false,
    'further': false,
};
src/main/webapp/app/overview/course-exams/course-exams.component.ts (2)

27-30: Clarify the purpose of DEFAULT_ALWAYS_SHOW and consider reducing duplication.

The new constant adheres to the naming convention (PascalCase) and uses single quotes for strings, which is good. However:

  1. The purpose of DEFAULT_ALWAYS_SHOW is not immediately clear from its name or surrounding context. Could you provide a comment explaining its intended use?

  2. There seems to be structural duplication between DEFAULT_ALWAYS_SHOW and DEFAULT_COLLAPSE_STATE. Consider if these could be combined or if there's a way to reduce this duplication.


Line range hint 1-324: Overall assessment: Minor changes with room for clarification

The changes to this file are minimal and correctly implemented. They adhere to Angular style guidelines and coding conventions. However, there are a few points to consider:

  1. The purpose of the new DEFAULT_ALWAYS_SHOW constant is not clear. Adding a comment to explain its intended use would improve code readability.

  2. There's potential duplication between DEFAULT_ALWAYS_SHOW and DEFAULT_COLLAPSE_STATE. Consider if these could be combined or refactored to reduce duplication.

  3. The overall structure and logic of the component remain unchanged, which is good for maintaining consistency.

These small improvements would enhance the clarity and maintainability of the code.

src/main/webapp/app/overview/course-conversations/course-conversations.component.ts (1)

67-76: Consider adding explanatory comments.

While the code changes are clear and well-implemented, it would be beneficial to add brief comments explaining the purpose of the DEFAULT_ALWAYS_SHOW constant and the ALWAYS_SHOW property. This would help future maintainers understand the rationale behind these additions and how they relate to the sidebar's behavior.

Also applies to: 108-108

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 96284c7 and c04936c.

📒 Files selected for processing (15)
  • src/main/webapp/app/overview/course-conversations/course-conversations.component.html (1 hunks)
  • src/main/webapp/app/overview/course-conversations/course-conversations.component.ts (3 hunks)
  • src/main/webapp/app/overview/course-exams/course-exams.component.html (1 hunks)
  • src/main/webapp/app/overview/course-exams/course-exams.component.ts (2 hunks)
  • src/main/webapp/app/overview/course-exercises/course-exercises.component.html (1 hunks)
  • src/main/webapp/app/overview/course-exercises/course-exercises.component.ts (3 hunks)
  • src/main/webapp/app/overview/course-lectures/course-lectures.component.html (1 hunks)
  • src/main/webapp/app/overview/course-lectures/course-lectures.component.ts (3 hunks)
  • src/main/webapp/app/overview/course-tutorial-groups/course-tutorial-groups.component.html (1 hunks)
  • src/main/webapp/app/overview/course-tutorial-groups/course-tutorial-groups.component.ts (3 hunks)
  • src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.html (1 hunks)
  • src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.ts (5 hunks)
  • src/main/webapp/app/shared/sidebar/sidebar.component.html (1 hunks)
  • src/main/webapp/app/shared/sidebar/sidebar.component.ts (2 hunks)
  • src/main/webapp/app/types/sidebar.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (15)
src/main/webapp/app/overview/course-conversations/course-conversations.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-conversations/course-conversations.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/overview/course-exams/course-exams.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-exams/course-exams.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/overview/course-exercises/course-exercises.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-exercises/course-exercises.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/overview/course-lectures/course-lectures.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-lectures/course-lectures.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/overview/course-tutorial-groups/course-tutorial-groups.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-tutorial-groups/course-tutorial-groups.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/sidebar/sidebar-accordion/sidebar-accordion.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-accordion/sidebar-accordion.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/sidebar/sidebar.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.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/types/sidebar.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 (28)
src/main/webapp/app/overview/course-lectures/course-lectures.component.html (2)

4-10: New input property added to <jhi-sidebar> component

The addition of the [sidebarItemShowAlways]="DEFAULT_ALWAYS_SHOW" property to the <jhi-sidebar> component aligns with the PR objectives to enhance the user interface by managing the visibility of sidebar items. This change allows for more dynamic control over which items are always displayed in the sidebar.

Correct usage of new Angular syntax

The template correctly uses the new Angular syntax @if instead of *ngIf, adhering to the provided coding guidelines.


Line range hint 1-27: Summary of changes and their impact

The changes in this file successfully implement the new [sidebarItemShowAlways] input property for the <jhi-sidebar> component. This addition aligns with the PR objectives to enhance the user interface by allowing more control over the visibility of sidebar items. The template also correctly uses the new Angular syntax @if instead of *ngIf, adhering to the provided coding guidelines.

These changes contribute to the overall goal of removing empty communication channels from the sidebar, as outlined in the PR objectives. The new property will likely be used in conjunction with other components to determine which items should always be shown, regardless of their content status.

src/main/webapp/app/overview/course-exams/course-exams.component.html (1)

2-2: Correct usage of new Angular syntax

The template correctly uses the new @if syntax instead of *ngIf as per the coding guidelines. This is applied consistently for both the outer and inner conditional blocks.

Also applies to: 13-13, 17-17

src/main/webapp/app/overview/course-exercises/course-exercises.component.html (1)

Line range hint 1-26: Excellent adherence to coding guidelines!

The template correctly uses the new Angular syntax @if instead of *ngIf, as specified in the coding guidelines. This is evident in two instances within the file.

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

1-2: LGTM: New syntax and improved conditional rendering.

The changes here are well-implemented:

  1. The use of @for instead of *ngFor adheres to the new Angular syntax as per our coding guidelines.
  2. The conditional rendering logic with @if effectively addresses the PR objective of hiding empty channels while allowing for exceptions through the sidebarItemShowAlways() function.

These changes contribute to a cleaner UI by removing empty communication channels from the sidebar.

Also applies to: 47-47


25-44: LGTM: Improved content rendering logic.

The changes to the accordion item content rendering are well-implemented:

  1. The use of @if to conditionally render content only when there's data to display aligns perfectly with the PR objective of hiding empty channels.
  2. The existing accordion functionality is maintained through the use of ngbCollapse.

These changes contribute to a more efficient and cleaner UI by ensuring that empty content is not rendered unnecessarily.


28-40: LGTM: Correct implementation of new @for syntax.

The changes in this section are well-implemented:

  1. The use of @for instead of *ngFor adheres to the new Angular syntax as per our coding guidelines.
  2. The track by expression and the use of the last variable for conditional styling are correctly implemented, maintaining the existing functionality.

This change contributes to keeping the codebase up-to-date with the latest Angular practices.


30-38: LGTM: Unchanged jhiSidebarCard implementation.

The implementation of the jhiSidebarCard directive remains unchanged:

  1. It correctly binds multiple input properties: size, itemSelected, sidebarType, and sidebarItem.
  2. The output event (onUpdateSidebar) is properly emitted.

This part of the code maintains the existing functionality without introducing any changes, which is appropriate given the focus of this PR.

src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.ts (2)

1-12: LGTM: Import and type declaration changes look good.

The addition of input from '@angular/core' and SidebarItemShowAlways from 'app/types/sidebar' enhances type safety and aligns with Angular's latest input signal syntax. These changes contribute to better code organization and maintainability.


56-56: Clarify the switch from sessionStorage to localStorage.

The change from sessionStorage to localStorage for storing the collapse state will persist this information across browser sessions. While this can improve user experience by maintaining preferences, it's important to consider:

  1. Is this the intended behavior?
  2. Are there any privacy implications to consider?
  3. Should we provide a way for users to clear this persistent state?

Please confirm if this change aligns with the project's requirements and user expectations. If confirmed, consider adding a brief comment explaining the rationale behind this change.

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

Line range hint 18-18: Excellent use of new Angular syntax!

The implementation consistently uses the new @if directive instead of *ngIf throughout the file. This adheres to the provided coding guidelines and represents best practices in modern Angular development.

Also applies to: 28-28, 40-40, 51-51


Line range hint 1-65: Overall, excellent implementation addressing PR objectives.

The changes in this file effectively implement the PR objectives of enhancing the user interface for the course conversations component. Key points:

  1. The new [sidebarItemShowAlways] property allows for dynamic control of sidebar item visibility.
  2. Consistent use of new Angular syntax (@if) throughout the file, adhering to coding guidelines.
  3. The structure and conditional rendering logic align well with the described functionality in the PR summary.

The implementation is clean, follows best practices, and should effectively remove empty communication channels from the sidebar as intended.

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

Line range hint 1-80: Excellent use of new Angular syntax!

The template consistently uses the new @if and @for directives instead of the older *ngIf and *ngFor syntax. This aligns perfectly with the provided coding guidelines and demonstrates a commitment to using modern Angular best practices.

Great job on adopting the new syntax throughout the template. This will improve readability and maintainability of the code.

src/main/webapp/app/types/sidebar.ts (1)

Line range hint 1-30: Overall, the changes look good and align with the PR objectives.

The addition of the SidebarItemShowAlways type is well-integrated into the existing type definitions. It provides a flexible structure for managing the visibility of sidebar items, which is consistent with the PR's goal of enhancing the user interface by removing empty communication channels.

The file adheres to the specified coding guidelines, including:

  • Using PascalCase for types
  • Following Angular style guide recommendations
  • Maintaining consistent naming conventions

No further issues or improvements are identified in this file.

src/main/webapp/app/overview/course-lectures/course-lectures.component.ts (2)

7-7: LGTM: Import statement correctly updated.

The import statement has been properly updated to include the new SidebarItemShowAlways type. This change follows the coding guidelines and is consistent with the new constant being introduced.


Line range hint 1-131: Summary: Changes align with PR objectives and follow coding guidelines.

The modifications to this file contribute effectively to the PR's goal of hiding empty communication channels in the sidebar. The new DEFAULT_ALWAYS_SHOW constant and its corresponding class property provide the necessary structure to manage the visibility of sidebar items.

Key points:

  1. The changes follow Angular and project-specific coding guidelines.
  2. The new constant and property are correctly implemented and typed.
  3. The modifications lay the groundwork for dynamic sidebar item visibility management.

To ensure these changes are properly utilized, please verify that:

  1. The DEFAULT_ALWAYS_SHOW constant is used in the template or other components to control sidebar item visibility.
  2. The hiding of empty channels is implemented correctly in the related HTML template.

You can use the following script to check for the usage of DEFAULT_ALWAYS_SHOW in other files:

This will help ensure that the changes are fully implemented across the necessary components.

src/main/webapp/app/overview/course-exercises/course-exercises.component.ts (2)

10-10: LGTM: Import statement updated correctly.

The import statement has been properly updated to include the new SidebarItemShowAlways type from the 'app/types/sidebar' module. This change follows the Angular style guide for imports and maintains consistency with the existing code.


Line range hint 1-165: Summary: Changes align with PR objectives, with minor suggestions for improvement.

The changes made to this file contribute to the PR's objective of enhancing the user interface for communication channels. The introduction of the DEFAULT_ALWAYS_SHOW constant and its integration as a class property provide a foundation for managing the visibility of sidebar items, which is crucial for removing empty communication channels from the sidebar.

The code changes are generally well-implemented, following Angular best practices and maintaining consistency with the existing codebase. Minor suggestions have been made for improved documentation and code organization.

To fully achieve the PR objectives:

  1. Ensure that this new constant is utilized in the component's template or in other methods to control the visibility of sidebar items.
  2. Verify that empty channels are indeed hidden in the UI when using this new configuration.
  3. Test the functionality across different scenarios as outlined in the PR description.

To verify the implementation, please run the following script:

This script will help ensure that the new constant is being used appropriately and that there are no remaining TODO items related to this feature.

✅ Verification successful

Verification Successful: DEFAULT_ALWAYS_SHOW is correctly implemented and utilized

  • DEFAULT_ALWAYS_SHOW is properly used in course-exercises.component.html as expected.
  • Consistent usage of DEFAULT_ALWAYS_SHOW across related components ensures uniform behavior.
  • No TODO comments related to sidebar visibility were found, indicating completeness.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of DEFAULT_ALWAYS_SHOW in the component's template and related files.

# Test 1: Check if DEFAULT_ALWAYS_SHOW is used in the component's template
echo "Checking usage in component template:"
rg --type html "\[sidebarItemShowAlways\]" src/main/webapp/app/overview/course-exercises/course-exercises.component.html

# Test 2: Check for any other usages of DEFAULT_ALWAYS_SHOW in related files
echo "Checking usage in related files:"
rg "DEFAULT_ALWAYS_SHOW" src/main/webapp/app/overview/

# Test 3: Verify if there are any TODO comments related to this feature
echo "Checking for related TODO comments:"
rg "TODO.*sidebar.*visibility" src/main/webapp/app/overview/

Length of output: 2434

src/main/webapp/app/shared/sidebar/sidebar.component.ts (2)

6-6: LGTM: Import statement updated correctly.

The addition of SidebarItemShowAlways to the import statement is consistent with the coding guidelines and Angular best practices. This change is necessary to support the new input property.


Line range hint 1-185: Verify the usage of the new sidebarItemShowAlways property.

While the new sidebarItemShowAlways property has been correctly added to the component, its usage is not evident in the current changes. To ensure the PR objective of hiding empty channels is met:

  1. Verify that the property is being used in the component's template or passed to child components to control the visibility of sidebar items.
  2. Consider adding logic in the component class to filter or process the sidebar items based on this property.
  3. Update the ngOnChanges method to react to changes in this property if necessary.

To help verify the property's usage, you can run the following command:

This will help ensure that the new property is being utilized as intended to meet the PR objectives.

✅ Verification successful

Verified the usage of the sidebarItemShowAlways property.

The sidebarItemShowAlways property is properly defined in both sidebar.component.ts and sidebar-accordion.component.ts and is utilized in their respective HTML templates to control the visibility of sidebar items. This ensures that empty channels are appropriately hidden, meeting the PR's objective.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for usage of sidebarItemShowAlways in the component's template and related files
rg --type html 'sidebarItemShowAlways' src/main/webapp/app/shared/sidebar/
rg --type typescript 'sidebarItemShowAlways' src/main/webapp/app/shared/sidebar/

Length of output: 562


Script:

#!/bin/bash
# Search for usage of sidebarItemShowAlways in the component's TypeScript files
rg --type ts 'sidebarItemShowAlways' src/main/webapp/app/shared/sidebar/

Length of output: 350

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

15-15: LGTM: Import statement updated correctly.

The addition of SidebarItemShowAlways to the import statement is consistent with the coding guidelines and is correctly placed with other related imports.


58-58: LGTM: DEFAULT_ALWAYS_SHOW added as readonly property.

The addition of DEFAULT_ALWAYS_SHOW as a readonly property in the CourseTutorialGroupsComponent class is correct and follows the coding guidelines.


Line range hint 1-324: Summary: Changes align with PR objectives and coding guidelines.

The modifications to this file, including the addition of DEFAULT_ALWAYS_SHOW constant and its integration as a readonly property in the CourseTutorialGroupsComponent class, contribute to the PR's goal of enhancing the user interface for communication channels in the sidebar. These changes provide a configuration option for controlling the visibility of sidebar items, which is consistent with the objective of removing empty communication channels from the sidebar.

The changes adhere to the coding guidelines and best practices for Angular development. The only suggestion for improvement is a minor code style change in the constant definition.

Overall, these changes appear to be a solid foundation for implementing the feature described in the PR objectives.

src/main/webapp/app/overview/course-exams/course-exams.component.ts (1)

65-65: LGTM: Readonly property addition is correct.

The addition of DEFAULT_ALWAYS_SHOW as a readonly property is correct and follows best practices:

  • It uses camelCase naming convention for properties.
  • It's marked as readonly, preventing accidental modifications.
  • Its placement next to DEFAULT_COLLAPSE_STATE is logical and improves code organization.
src/main/webapp/app/overview/course-conversations/course-conversations.component.ts (4)

16-16: LGTM: Import statement updated correctly.

The addition of SidebarItemShowAlways to the import statement is consistent with its usage in the new constant and follows Angular style guidelines.


57-62: LGTM: Default collapse states updated.

The changes to DEFAULT_COLLAPSE_STATE alter the initial visibility of general and favorite channels in the sidebar. This modification is consistent with the component's logic and likely reflects an intentional design decision. Ensure that this change aligns with the expected user experience.


67-76: LGTM: New constant for sidebar item visibility added.

The DEFAULT_ALWAYS_SHOW constant provides a clear structure for managing the visibility of sidebar items. It follows the correct naming convention and uses the appropriate type. The default values seem logical, ensuring that important channels like general, group chats, direct messages, and favorites are always visible.


108-108: LGTM: New readonly property added to component.

The ALWAYS_SHOW readonly property provides a clean way for the component to access the always-show configuration. It follows coding guidelines and ensures immutability, which is a good practice for configuration properties.

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.

Left a few comments, nothing major

I have left quite a few comments on the names of the variables, however, I do not have a strong opinion there. If you think it is more readable as it is feel free to resolve the comments without any changes :)

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.

this is already solved by this PR #9356, can you please have a look at it?

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 (3)
src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.ts (3)

35-35: LGTM: New input property looks good, with a minor suggestion

The new sidebarItemShowAlways input property is well-implemented using the new Angular 16 input syntax. It aligns with the PR objectives and follows the coding guidelines.

Consider adding a brief JSDoc comment to explain the purpose of this property, which will improve code documentation:

/** Determines which sidebar items should always be shown */
sidebarItemShowAlways = input.required<SidebarItemShowAlways>();

56-57: LGTM: Storage mechanism change looks good, with a minor suggestion

The switch from sessionStorage to localStorage is a good improvement, ensuring that the collapse state persists across browser sessions. This change aligns well with the PR objectives.

To improve code readability, consider extracting the storage key into a constant:

private readonly STORAGE_KEY = 'sidebar.accordion.collapseState';

// ...

setStoredCollapseState() {
    const key = `${this.STORAGE_KEY}.${this.storageId}.byCourse.${this.courseId}`;
    const storedCollapseState: string | null = localStorage.getItem(key);
    if (storedCollapseState) this.collapseState = JSON.parse(storedCollapseState);
}

This change would make the code more maintainable and reduce the risk of typos when using the same key in multiple places.


83-83: LGTM: Storage mechanism change is consistent

The change from sessionStorage to localStorage in toggleGroupCategoryCollapse is consistent with the earlier modification and aligns well with the PR objectives.

For consistency and improved readability, apply the same suggestion as before:

toggleGroupCategoryCollapse(groupCategoryKey: string) {
    this.collapseState[groupCategoryKey] = !this.collapseState[groupCategoryKey];
    const key = `${this.STORAGE_KEY}.${this.storageId}.byCourse.${this.courseId}`;
    localStorage.setItem(key, JSON.stringify(this.collapseState));
}

This change would use the same STORAGE_KEY constant suggested earlier, improving maintainability and reducing the risk of inconsistencies.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between c04936c and 1e84ded.

📒 Files selected for processing (12)
  • src/main/webapp/app/overview/course-conversations/course-conversations.component.html (1 hunks)
  • src/main/webapp/app/overview/course-conversations/course-conversations.component.ts (3 hunks)
  • src/main/webapp/app/overview/course-exams/course-exams.component.html (1 hunks)
  • src/main/webapp/app/overview/course-exams/course-exams.component.ts (2 hunks)
  • src/main/webapp/app/overview/course-exercises/course-exercises.component.html (1 hunks)
  • src/main/webapp/app/overview/course-exercises/course-exercises.component.ts (3 hunks)
  • src/main/webapp/app/overview/course-lectures/course-lectures.component.html (1 hunks)
  • src/main/webapp/app/overview/course-lectures/course-lectures.component.ts (3 hunks)
  • src/main/webapp/app/overview/course-tutorial-groups/course-tutorial-groups.component.html (1 hunks)
  • src/main/webapp/app/overview/course-tutorial-groups/course-tutorial-groups.component.ts (3 hunks)
  • src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.html (1 hunks)
  • src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.ts (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (11)
  • src/main/webapp/app/overview/course-conversations/course-conversations.component.html
  • src/main/webapp/app/overview/course-conversations/course-conversations.component.ts
  • src/main/webapp/app/overview/course-exams/course-exams.component.html
  • src/main/webapp/app/overview/course-exams/course-exams.component.ts
  • src/main/webapp/app/overview/course-exercises/course-exercises.component.html
  • src/main/webapp/app/overview/course-exercises/course-exercises.component.ts
  • src/main/webapp/app/overview/course-lectures/course-lectures.component.html
  • src/main/webapp/app/overview/course-lectures/course-lectures.component.ts
  • src/main/webapp/app/overview/course-tutorial-groups/course-tutorial-groups.component.html
  • src/main/webapp/app/overview/course-tutorial-groups/course-tutorial-groups.component.ts
  • src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.html
🧰 Additional context used
📓 Path-based instructions (1)
src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.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 (2)
src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.ts (2)

1-12: LGTM: Import changes look good

The import changes are well-organized and align with the coding guidelines. The addition of SidebarItemShowAlways is consistent with the PR objectives for improving sidebar functionality.


Line range hint 1-92: Overall assessment: Good changes with minor suggestions for improvement

The changes in this file align well with the PR objectives of improving sidebar functionality. The switch from sessionStorage to localStorage for storing collapse states is a good improvement, ensuring persistence across browser sessions. The new input property sidebarItemShowAlways is well-implemented using the new Angular 16 input syntax.

Key points:

  1. Import changes are well-organized and consistent with coding guidelines.
  2. The new input property enhances sidebar functionality as intended.
  3. Storage mechanism changes are consistent and improve user experience.

Minor suggestions have been made to improve code readability and maintainability:

  1. Adding a JSDoc comment for the new input property.
  2. Extracting the storage key into a constant for better maintainability.

These changes look good overall, and implementing the minor suggestions would further enhance the code quality.

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 (4)
src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.ts (4)

35-35: LGTM: New input property added using modern Angular syntax.

The sidebarItemAlwaysShow property is correctly implemented using the new Angular 16 input syntax and is properly typed. This change supports the PR objective of improving sidebar functionality.

Consider adding a brief JSDoc comment to explain the purpose of this property, enhancing code readability and maintainability.


56-56: LGTM: Storage mechanism updated for better persistence.

The change from sessionStorage to localStorage is appropriate and aligns with the PR objective of persisting UI state across sessions. The key structure allows for course-specific settings.

Consider extracting the storage key construction to a separate method for better reusability and maintainability, as it's used in multiple places.


83-83: LGTM: Consistent update of storage mechanism.

The change to localStorage in toggleGroupCategoryCollapse is consistent with the earlier modification and ensures persistence of the collapse state across sessions.

As mentioned earlier, consider extracting the storage key construction to a separate method. This would improve code maintainability and reduce the risk of inconsistencies. For example:

private getStorageKey(): string {
  return `sidebar.accordion.collapseState.${this.storageId}.byCourse.${this.courseId}`;
}

Then use it in both setStoredCollapseState and toggleGroupCategoryCollapse:

localStorage.getItem(this.getStorageKey());
localStorage.setItem(this.getStorageKey(), JSON.stringify(this.collapseState));

Line range hint 1-83: Summary: Improved sidebar functionality with persistent state.

The changes in this file successfully implement the PR objectives:

  1. Introduction of sidebarItemAlwaysShow property for dynamic visibility management.
  2. Switching from sessionStorage to localStorage for persistent collapse state across sessions.
  3. Consistent implementation of storage mechanism changes.

These modifications enhance the user experience by maintaining sidebar state and allowing for more flexible control over item visibility. The code adheres to Angular best practices and TypeScript conventions.

To further improve the component:

  1. Consider implementing a caching mechanism or debounce function for frequent localStorage operations to optimize performance.
  2. Evaluate the possibility of using Angular's ChangeDetectionStrategy.OnPush for potential performance benefits, especially if this component is used in a large application.
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 1e84ded and 4585d70.

📒 Files selected for processing (9)
  • src/main/webapp/app/overview/course-conversations/course-conversations.component.html (1 hunks)
  • src/main/webapp/app/overview/course-exams/course-exams.component.html (1 hunks)
  • src/main/webapp/app/overview/course-exercises/course-exercises.component.html (1 hunks)
  • src/main/webapp/app/overview/course-lectures/course-lectures.component.html (1 hunks)
  • src/main/webapp/app/overview/course-tutorial-groups/course-tutorial-groups.component.html (1 hunks)
  • src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.html (1 hunks)
  • src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.ts (4 hunks)
  • src/main/webapp/app/shared/sidebar/sidebar.component.html (1 hunks)
  • src/main/webapp/app/shared/sidebar/sidebar.component.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (8)
  • src/main/webapp/app/overview/course-conversations/course-conversations.component.html
  • src/main/webapp/app/overview/course-exams/course-exams.component.html
  • src/main/webapp/app/overview/course-exercises/course-exercises.component.html
  • src/main/webapp/app/overview/course-lectures/course-lectures.component.html
  • src/main/webapp/app/overview/course-tutorial-groups/course-tutorial-groups.component.html
  • src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.html
  • src/main/webapp/app/shared/sidebar/sidebar.component.html
  • src/main/webapp/app/shared/sidebar/sidebar.component.ts
🧰 Additional context used
📓 Path-based instructions (1)
src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.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 (1)
src/main/webapp/app/shared/sidebar/sidebar-accordion/sidebar-accordion.component.ts (1)

1-12: LGTM: Import changes are well-organized and support new functionality.

The new imports, including SidebarItemShowAlways, are correctly added and grouped. This aligns with the coding guidelines and supports the implementation of the new sidebarItemAlwaysShow property.

coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 18, 2024
sachmii
sachmii previously approved these changes Oct 18, 2024
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 TS3. Works as described, if there is no lecture, exercise or exam they are not shown in the sidebar. After creating a lecture the lectures in the sidebar would show up again also in the communication. The Favourites are uncollapsed.

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.

Approve code, thanks for addressing the comments

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 20, 2024
@github-actions github-actions bot removed the deployment-error Added by deployment workflows if an error occured label Oct 20, 2024
@JanaNF JanaNF temporarily deployed to artemis-test1.artemis.cit.tum.de October 20, 2024 13:42 — with GitHub Actions Inactive
Copy link

@JanaNF JanaNF left a comment

Choose a reason for hiding this comment

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

Manual tested on TS1. Worked as expected. Created all entities and could write and reply in the new channels with different accounts/roles.

Copy link

@Cathy0123456789 Cathy0123456789 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.
Favorites tab was uncollapsed when opening course the first time. Creating/removing exercises, lectures and exams created/removed new channels.
After adding channels as favorites and collapsing the favorite tab, logging out, closing the browser tab, reopening it, logging in and navigating to the course, favorites tab was still collapsed. If that's meant to be, then everything works fine from my side.

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 tests
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

10 participants