Skip to content

Conversation

@amolsontakke3576
Copy link
Contributor

@amolsontakke3576 amolsontakke3576 commented Jun 24, 2025

This pull request introduces several changes across multiple files, primarily focusing on refactoring and improving the dashboard components, updating dependencies, and removing unused code. The most significant updates include replacing the AuthComponent with a new AuthDashboardComponent, enhancing the ClaDashboardComponent with additional functionality, and simplifying project title bindings in various dashboard components.

Dashboard Refactoring and Enhancements:

  • Replaced AuthComponent with AuthDashboardComponent in src/app/app-routing.module.ts and implemented its logic to handle project and user redirection based on stored settings. ([[1]](https://github.com/linuxfoundation/easycla-contributor-console/pull/449/files#diff-bdebfe9c9aa11d74e7d28dcfb0cc5c678070b2d01d56edad196cb18357f96487L12-R19), [[2]](https://github.com/linuxfoundation/easycla-contributor-console/pull/449/files#diff-b2506bb873cf4bade0774059387e5a732f19a4bd51fce7ddce59b4020ab9f133R1-R23), [[3]](https://github.com/linuxfoundation/easycla-contributor-console/pull/449/files#diff-ad216ff6ffcdc0297ec04c876db602a484b6ab4b94505c63ddc04e04d7ed5972R1-R25), [[4]](https://github.com/linuxfoundation/easycla-contributor-console/pull/449/files#diff-99453c3bef5e14943b85476cdaf74f8ed95341083a4a139fc32a835dce95de3eR1))
  • Enhanced ClaDashboardComponent to detect private browsing modes, authenticate users, and dynamically bind project settings. Introduced hasCclaEnabled and hasIclaEnabled computed properties for cleaner logic. ([[1]](https://github.com/linuxfoundation/easycla-contributor-console/pull/449/files#diff-62df717bac294a04b900316d01bedb51d8e889c81247e341871ef86904233e86R11-R12), [[2]](https://github.com/linuxfoundation/easycla-contributor-console/pull/449/files#diff-62df717bac294a04b900316d01bedb51d8e889c81247e341871ef86904233e86L20-R98), [[3]](https://github.com/linuxfoundation/easycla-contributor-console/pull/449/files#diff-62df717bac294a04b900316d01bedb51d8e889c81247e341871ef86904233e86L85-L91))
  • Removed redundant bindings for projectId and userId in app-project-title across multiple dashboard components (cla-request-authorization, corporate-dashboard, individual-dashboard, and cla-dashboard). ([[1]](https://github.com/linuxfoundation/easycla-contributor-console/pull/449/files#diff-2228ddb8afafed19683b3f5ccc2ca9b8d48b66504cb4c1e1126a1aa38fd9112eL4-R4), [[2]](https://github.com/linuxfoundation/easycla-contributor-console/pull/449/files#diff-1dd51e7420cb30f246e1f6e70945e2a973138da7a386559448051b97fa7717ceL4-L8), [[3]](https://github.com/linuxfoundation/easycla-contributor-console/pull/449/files#diff-36e9ed202e855e6b9f0629754e7e5a96271f0c836298026842e7fc3ff21c62a7L4-R4), [[4]](https://github.com/linuxfoundation/easycla-contributor-console/pull/449/files#diff-dfe617114d75550db10ba00918d10e62648c0b273012e1aa961b6d41387f6a06L3-L8))

Dependency Updates:

  • Updated package.json to include new dependencies (detectincognitojs) and specify the package manager ([email protected]). ([[1]](https://github.com/linuxfoundation/easycla-contributor-console/pull/449/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R57-R64), [[2]](https://github.com/linuxfoundation/easycla-contributor-console/pull/449/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L142-R144))

Code Cleanup:

  • Removed unused AuthComponent files (auth.component.html and auth.component.scss). ([[1]](https://github.com/linuxfoundation/easycla-contributor-console/pull/449/files#diff-290f3823c625f5db1a64cc26e02ff1bd641503b7322bbbba06fcd7fae0154ed3L1-L8), [[2]](https://github.com/linuxfoundation/easycla-contributor-console/pull/449/files#diff-03568fda6cfa2102882b9c96802697f438531eaf27ccad9099d74f4c7b187f87L1-L11))
  • Eliminated unnecessary console logging in ConfigureClaManagerModalComponent. ([src/app/modules/corporate-contributor/component/configure-cla-manager-modal/configure-cla-manager-modal.component.tsL285](https://github.com/linuxfoundation/easycla-contributor-console/pull/449/files#diff-5300d32dfb5c1fc831d8d1deb3ef9a53af1678c76ad683caf9051e4dc0a97c6cL285))

Minor Fixes:

  • Fixed typos in variable names (corporateHightlightscorporateHightLights, individualHightlightsindividualHightLights) in ClaDashboardComponent. ([src/app/modules/dashboard/container/cla-dashboard/cla-dashboard.component.tsL20-R98](https://github.com/linuxfoundation/easycla-contributor-console/pull/449/files#diff-62df717bac294a04b900316d01bedb51d8e889c81247e341871ef86904233e86L20-R98))
  • Adjusted alert.component.scss to remove fixed positioning from .alert. ([src/app/shared/components/alert/alert.component.scssL6](https://github.com/linuxfoundation/easycla-contributor-console/pull/449/files#diff-d1e5619c43c0ef7d66bab46c7e119805d0bb69faf46c0ac843a894a0cf747f52L6))

Summary by CodeRabbit

  • New Features

    • Introduced a new authentication dashboard component that redirects users based on stored project and user information.
    • Added detection for private/incognito browsing mode with user alerts.
  • Bug Fixes

    • Corrected property naming inconsistencies and improved error handling in dashboard components.
    • Updated conditional bindings and event handlers in dashboard templates for improved reliability.
  • Refactor

    • Streamlined authentication and redirection flow by removing the old authentication component and related logic.
    • Consolidated initialization and authentication logic in dashboard components.
    • Updated project title component to rely on stored values instead of input bindings.
    • Simplified routing by associating the root path directly with the new authentication dashboard.
  • Style

    • Adjusted alert styling for improved display.
  • Chores

    • Updated dependencies and added a new package for incognito detection.
    • Cleaned up unused files and declarations related to the removed authentication component.
  • Tests

    • Added unit tests for the new authentication dashboard component.

Signed-off-by: Amol Sontakke <[email protected]>
Signed-off-by: Amol Sontakke <[email protected]>
@coderabbitai
Copy link

coderabbitai bot commented Jun 24, 2025

Walkthrough

This update restructures authentication and dashboard navigation flows in the application. It removes the AuthComponent and its associated files, introduces a new AuthDashboardComponent for authentication redirection, updates routing and module declarations, and refactors dashboard and project title components to rely on stored values instead of input bindings. Private browsing detection and authentication checks are added, and minor UI and style adjustments are made.

Changes

File(s) Change Summary
package.json Reordered dependencies and added detectincognitojs package.
src/app/app-routing.module.ts Updated routing: removed root redirect to /cla, set root to AuthDashboardComponent, and removed AuthComponent route.
src/app/app.component.ts Injected AuthService and ActivatedRoute in the constructor.
src/app/app.module.ts Added trailing comma in the imports array.
src/app/shared/components/auth/auth.component.*
src/app/shared/shared.module.ts
Removed AuthComponent and its template, styles, tests, and module declaration.
src/app/modules/dashboard/container/auth-dashboard/auth-dashboard.component.* Added new AuthDashboardComponent with template, spec, and TypeScript logic for redirecting based on stored project/user/redirect values.
src/app/modules/dashboard/dashboard.module.ts Declared AuthDashboardComponent in the DashboardModule.
src/app/modules/dashboard/container/cla-dashboard/cla-dashboard.component.ts
.html
Refactored initialization logic, added private browsing detection, authentication checks, new getters, renamed highlight properties, and updated template bindings and events.
src/app/modules/corporate-contributor/component/configure-cla-manager-modal/configure-cla-manager-modal.component.ts Removed a console log statement.
src/app/modules/corporate-contributor/container/cla-request-authorization/cla-request-authorization.component.html
src/app/modules/corporate-contributor/container/corporate-dashboard/corporate-dashboard.component.html
src/app/modules/individual-contributor/container/individual-dashboard/individual-dashboard.component.html
Removed projectId and userId input bindings from <app-project-title> or removed the component entirely from the template.
src/app/shared/components/project-title/project-title.component.ts Switched lifecycle to AfterViewInit, removed @Input properties, refactored to use stored values, and updated event emissions.
src/app/shared/services/auth.service.ts Removed handleAuthCallback and related logic; reduced login delay.
src/app/shared/components/alert/alert.component.scss Removed position: fixed; from .alert class.
src/app/shared/components/page-not-found/page-not-found.component.html
.ts
Replaced dynamic message with static text; refactored to use redirectUrl from storage and removed unused properties and logic.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant AppComponent
    participant AuthDashboardComponent
    participant StorageService
    participant Router
    participant AuthService

    User->>AppComponent: Loads root path ('/')
    AppComponent->>AuthDashboardComponent: Initializes component
    AuthDashboardComponent->>StorageService: Retrieve PROJECT_ID, USER_ID, REDIRECT
    AuthDashboardComponent->>Router: Navigate to /dashboard/project/:projectId/user/:userId?redirect=...
    Router->>AuthService: (If needed) Check authentication
    AuthService-->>Router: (If not authenticated) Trigger login
Loading
sequenceDiagram
    participant User
    participant ClaDashboardComponent
    participant detectIncognito
    participant AuthService

    User->>ClaDashboardComponent: Loads dashboard
    ClaDashboardComponent->>detectIncognito: Check for private browsing
    detectIncognito-->>ClaDashboardComponent: Returns result
    ClaDashboardComponent->>AuthService: Subscribe to loading/authenticated
    AuthService-->>ClaDashboardComponent: Returns authentication status
    ClaDashboardComponent->>AuthService: If not authenticated and not private, trigger login
Loading

Poem

Hoppity hop, the dashboards align,
Old AuthComponent now resigns.
With storage and routes, the flow is new,
Incognito checks—just for you!
Project titles fetch with glee,
As rabbits code in harmony.
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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 anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

Signed-off-by: Amol Sontakke <[email protected]>
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: 13

♻️ Duplicate comments (1)
src/app/modules/individual-contributor/container/individual-dashboard/individual-dashboard.component.html (1)

4-4: Same note as corporate dashboard – validate component interface

Double-check that app-project-title fetches its context from storage and has zero required inputs, otherwise this dashboard will fail to render silently.

🧹 Nitpick comments (4)
src/app/modules/dashboard/container/auth-dashboard/auth-dashboard.component.spec.ts (1)

22-24: Consider expanding test coverage.

The current test only verifies component creation. For a new authentication component, consider adding tests for:

  • Component initialization logic
  • Navigation behavior
  • Storage interaction
  • Error handling scenarios
src/app/modules/dashboard/container/auth-dashboard/auth-dashboard.component.ts (1)

13-13: Fix spacing inconsistency in constructor parameters.

-  constructor(private router:Router, private storageService:StorageService) { }
+  constructor(private router: Router, private storageService: StorageService) { }
src/app/shared/components/project-title/project-title.component.ts (1)

4-4: Consider using OnInit instead of AfterViewInit.

Since this component doesn't manipulate view children or require DOM access, OnInit would be more appropriate than AfterViewInit.

-import { Component, EventEmitter, Output, AfterViewInit } from '@angular/core';
+import { Component, EventEmitter, Output, OnInit } from '@angular/core';
-export class ProjectTitleComponent implements AfterViewInit {
+export class ProjectTitleComponent implements OnInit {
-  ngAfterViewInit(): void {
+  ngOnInit(): void {

Also applies to: 17-17, 31-31

src/app/modules/dashboard/container/cla-dashboard/cla-dashboard.component.ts (1)

71-71: Fix spacing in if statement.

-      if(this.hasPrivateWindow){
+      if (this.hasPrivateWindow) {
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9462d03 and 59167d0.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (24)
  • package.json (1 hunks)
  • src/app/app-routing.module.ts (1 hunks)
  • src/app/app.component.ts (2 hunks)
  • src/app/app.module.ts (1 hunks)
  • src/app/modules/corporate-contributor/component/configure-cla-manager-modal/configure-cla-manager-modal.component.ts (0 hunks)
  • src/app/modules/corporate-contributor/container/cla-request-authorization/cla-request-authorization.component.html (1 hunks)
  • src/app/modules/corporate-contributor/container/corporate-dashboard/corporate-dashboard.component.html (0 hunks)
  • src/app/modules/dashboard/container/auth-dashboard/auth-dashboard.component.html (1 hunks)
  • src/app/modules/dashboard/container/auth-dashboard/auth-dashboard.component.spec.ts (1 hunks)
  • src/app/modules/dashboard/container/auth-dashboard/auth-dashboard.component.ts (1 hunks)
  • src/app/modules/dashboard/container/cla-dashboard/cla-dashboard.component.html (5 hunks)
  • src/app/modules/dashboard/container/cla-dashboard/cla-dashboard.component.ts (2 hunks)
  • src/app/modules/dashboard/dashboard.module.ts (1 hunks)
  • src/app/modules/individual-contributor/container/individual-dashboard/individual-dashboard.component.html (1 hunks)
  • src/app/shared/components/alert/alert.component.scss (0 hunks)
  • src/app/shared/components/auth/auth.component.html (0 hunks)
  • src/app/shared/components/auth/auth.component.scss (0 hunks)
  • src/app/shared/components/auth/auth.component.spec.ts (0 hunks)
  • src/app/shared/components/auth/auth.component.ts (0 hunks)
  • src/app/shared/components/page-not-found/page-not-found.component.html (1 hunks)
  • src/app/shared/components/page-not-found/page-not-found.component.ts (2 hunks)
  • src/app/shared/components/project-title/project-title.component.ts (6 hunks)
  • src/app/shared/services/auth.service.ts (3 hunks)
  • src/app/shared/shared.module.ts (0 hunks)
💤 Files with no reviewable changes (8)
  • src/app/shared/components/alert/alert.component.scss
  • src/app/shared/shared.module.ts
  • src/app/shared/components/auth/auth.component.scss
  • src/app/modules/corporate-contributor/component/configure-cla-manager-modal/configure-cla-manager-modal.component.ts
  • src/app/shared/components/auth/auth.component.spec.ts
  • src/app/shared/components/auth/auth.component.html
  • src/app/modules/corporate-contributor/container/corporate-dashboard/corporate-dashboard.component.html
  • src/app/shared/components/auth/auth.component.ts
🧰 Additional context used
🪛 HTMLHint (1.5.0)
src/app/modules/dashboard/container/auth-dashboard/auth-dashboard.component.html

[error] 1-1: Doctype must be declared before any non-comment content.

(doctype-first)

src/app/modules/individual-contributor/container/individual-dashboard/individual-dashboard.component.html

[error] 4-4: Doctype must be declared before any non-comment content.

(doctype-first)

src/app/modules/corporate-contributor/container/cla-request-authorization/cla-request-authorization.component.html

[error] 4-4: Doctype must be declared before any non-comment content.

(doctype-first)

src/app/modules/dashboard/container/cla-dashboard/cla-dashboard.component.html

[error] 3-3: Doctype must be declared before any non-comment content.

(doctype-first)

🪛 Biome (1.9.4)
src/app/modules/dashboard/container/auth-dashboard/auth-dashboard.component.spec.ts

[error] 16-20: Disallow duplicate setup and teardown hooks.

Disallow beforeEach duplicacy inside the describe function.

(lint/suspicious/noDuplicateTestHooks)

🪛 GitHub Actions: License Header Check
src/app/modules/dashboard/container/auth-dashboard/auth-dashboard.component.spec.ts

[error] 1-1: Missing license header in source file.

src/app/modules/dashboard/container/auth-dashboard/auth-dashboard.component.ts

[error] 1-1: Missing license header in source file.

🪛 GitHub Actions: Snyk Scan NPM Dependencies
package.json

[error] 1-1: Snyk authentication error (SNYK-0005): Authentication credentials not recognized or user access not provisioned. Command 'snyk test --org=*** --file=package.json' failed with exit code 2.

🪛 GitHub Actions: Snyk Scan Edge NPM Dependencies
package.json

[error] 1-1: Snyk monitor failed: Could not find the specified file 'package.json'. Please check that it exists and try again. (SNYK-CLI-0000)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (16)
src/app/shared/components/page-not-found/page-not-found.component.ts (2)

5-6: LGTM!

The imports are correctly added for the new storage-based redirect functionality.


17-19: LGTM!

The constructor correctly injects the StorageService dependency.

package.json (1)

55-66: Verify new dependency & monitor licensing/security before shipping

The only functional change here is the introduction of detectincognitojs (^1.5.0) and the re-ordering of a couple of existing deps.
Before merging, please double-check:

  1. License compatibility (GPL vs MIT/Apache for the rest of the stack).
  2. Bundle impact – the lib ships transpiled ES5 + UMD; tree-shaking might not remove the whole thing.
  3. Any known supply-chain advisories (Snyk / OSV).

The current pipeline already fails on Snyk auth; until that is unblocked we have no automated gate on the above.
Consider running a one-off npm audit --production locally or fixing the CI secret so Snyk resumes.

src/app/app.module.ts (1)

35-35: LGTM – change keeps comma-style consistent

The trailing comma after FormsModule matches the existing style in this array; no functional impact.

src/app/modules/corporate-contributor/container/cla-request-authorization/cla-request-authorization.component.html (1)

4-4: Confirm <app-project-title> no longer expects inputs

Inputs projectId / userId were removed across templates.
Please ensure ProjectTitleComponent’s @Input decorators are actually gone; otherwise Angular will log warnings at runtime.

src/app/app.component.ts (1)

6-7: LGTM! Clean dependency injection setup.

The injection of AuthService and ActivatedRoute aligns well with the authentication refactoring. The imports and constructor changes look correct.

Also applies to: 19-19

src/app/modules/dashboard/dashboard.module.ts (1)

11-11: LGTM! Proper module registration.

The AuthDashboardComponent is correctly imported and declared in the module following Angular conventions.

Also applies to: 17-18

src/app/app-routing.module.ts (1)

12-12: LGTM! Routing refactoring looks correct.

The change from redirecting to '/cla' to directly loading AuthDashboardComponent on the root path aligns with the authentication flow refactoring. The import and route configuration are properly updated.

Also applies to: 19-19

src/app/shared/services/auth.service.ts (3)

7-7: LGTM! Clean import removal.

Removing unused combineLatest import improves code cleanliness.


128-128: Verify timeout reduction won't affect slower networks.

The login timeout was reduced from 1500ms to 500ms, but the comment above (line 118-119) specifically mentions the timeout was increased to 1500ms for slower networks to avoid "Cannot read property 'querySelector' of null" errors.

This change could potentially reintroduce the original issue on slower networks. Please verify this reduction is safe or update the comment if the timeout is no longer needed.


147-150: LGTM! Consistent code formatting.

The change to use block body syntax in the logout subscription callback improves code consistency.

src/app/modules/dashboard/container/cla-dashboard/cla-dashboard.component.html (3)

3-3: LGTM!

The event handler name change from onAPILoad to setProject is more descriptive and better reflects its purpose.


32-32: Good use of safe navigation operators.

Adding the safe navigation operator (?.) prevents potential runtime errors when project is null or undefined.

Also applies to: 41-41


55-55: Excellent refactoring to use computed properties.

Using hasCclaEnabled and hasIclaEnabled computed properties improves code readability and maintainability.

Also applies to: 63-63

src/app/shared/components/project-title/project-title.component.ts (1)

53-53: ```shell
#!/bin/bash

Display class definition and property declarations

rg -n "export class ClaDashboardComponent" -A 20 src/app/modules/dashboard/container/cla-dashboard/cla-dashboard.component.ts


</details>
<details>
<summary>src/app/modules/dashboard/container/cla-dashboard/cla-dashboard.component.ts (1)</summary>

`95-97`: **LGTM!**

The `setProject` method provides a clean way to update the project model from the template.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Comment on lines +6 to +7
<div class="col-auto not-found ">The page you are looking for was not found. Please <a [href]="redirectUrl" class="">click here</a>
to go back on main page or contact the administrator.</div>
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add validation and error handling for the redirect URL.

The template directly binds redirectUrl to href without validation, which could lead to issues if the URL is null, undefined, or contains malicious content.

Consider adding validation in the template:

-        <div class="col-auto not-found ">The page you are looking for was not found. Please <a [href]="redirectUrl" class="">click here</a>
+        <div class="col-auto not-found ">The page you are looking for was not found. Please <a [href]="redirectUrl || '/'" class="">click here</a>
             to go back on main page or contact the administrator.</div>

Or better yet, add proper URL validation in the component and use conditional rendering:

-        <div class="col-auto not-found ">The page you are looking for was not found. Please <a [href]="redirectUrl" class="">click here</a>
+        <div class="col-auto not-found ">The page you are looking for was not found. Please <a *ngIf="isValidUrl(redirectUrl)" [href]="redirectUrl" class="">click here</a><span *ngIf="!isValidUrl(redirectUrl)">contact the administrator</span>
             to go back on main page or contact the administrator.</div>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div class="col-auto not-found ">The page you are looking for was not found. Please <a [href]="redirectUrl" class="">click here</a>
to go back on main page or contact the administrator.</div>
<div class="col-auto not-found ">
The page you are looking for was not found. Please
<a [href]="redirectUrl || '/'" class="">click here</a>
to go back on main page or contact the administrator.
</div>
🤖 Prompt for AI Agents
In src/app/shared/components/page-not-found/page-not-found.component.html around
lines 6 to 7, the redirectUrl is directly bound to the href attribute without
validation, which risks null, undefined, or unsafe URLs. To fix this, add
validation logic in the component to ensure redirectUrl is a valid, safe URL
before binding it. Then update the template to conditionally render the anchor
tag only if redirectUrl passes validation, otherwise display a fallback message
or disable the link.

export class PageNotFoundComponent implements OnInit {
message: string;
actionType: string;
redirectUrl:string;
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Improve type safety and initialization.

The redirectUrl property should handle the possibility of null/undefined values from storage.

-  redirectUrl:string;
+  redirectUrl: string | null = null;

This ensures type safety and prevents potential runtime errors when the storage value is not available.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
redirectUrl:string;
redirectUrl: string | null = null;
🤖 Prompt for AI Agents
In src/app/shared/components/page-not-found/page-not-found.component.ts at line
15, the redirectUrl property is declared without a type or initialization, which
risks runtime errors if the storage value is null or undefined. Update the
declaration to explicitly type redirectUrl as string or null, and initialize it
safely by checking the storage value, ensuring it handles null or undefined
cases to improve type safety and prevent errors.

Comment on lines 21 to 23
ngOnInit(): void {
this.message = 'Wait... we are validating session';
// If auth0 response is null then page not exist.
setTimeout(() => {
this.message = 'The page you are looking for was not found.';
}, 2000);
this.redirectUrl = JSON.parse(this.storageService.getItem(AppSettings.REDIRECT));
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add proper error handling and validation for JSON parsing.

The current implementation has several critical issues:

  1. JSON.parse() can throw an error if the stored value is not valid JSON
  2. No null/undefined check before parsing
  3. Potential security risk parsing arbitrary JSON from storage
  ngOnInit(): void {
-    this.redirectUrl = JSON.parse(this.storageService.getItem(AppSettings.REDIRECT));
+    try {
+      const storedValue = this.storageService.getItem(AppSettings.REDIRECT);
+      if (storedValue) {
+        this.redirectUrl = JSON.parse(storedValue);
+        // Validate URL format for security
+        if (!this.isValidUrl(this.redirectUrl)) {
+          this.redirectUrl = null;
+        }
+      }
+    } catch (error) {
+      console.error('Error parsing redirect URL from storage:', error);
+      this.redirectUrl = null;
+    }
  }
+
+  private isValidUrl(url: string | null): boolean {
+    if (!url) return false;
+    try {
+      const urlObj = new URL(url);
+      return ['http:', 'https:'].includes(urlObj.protocol);
+    } catch {
+      return false;
+    }
+  }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
ngOnInit(): void {
this.message = 'Wait... we are validating session';
// If auth0 response is null then page not exist.
setTimeout(() => {
this.message = 'The page you are looking for was not found.';
}, 2000);
this.redirectUrl = JSON.parse(this.storageService.getItem(AppSettings.REDIRECT));
}
ngOnInit(): void {
try {
const storedValue = this.storageService.getItem(AppSettings.REDIRECT);
if (storedValue) {
this.redirectUrl = JSON.parse(storedValue);
// Validate URL format for security
if (!this.isValidUrl(this.redirectUrl)) {
this.redirectUrl = null;
}
}
} catch (error) {
console.error('Error parsing redirect URL from storage:', error);
this.redirectUrl = null;
}
}
private isValidUrl(url: string | null): boolean {
if (!url) return false;
try {
const urlObj = new URL(url);
return ['http:', 'https:'].includes(urlObj.protocol);
} catch {
return false;
}
}
🤖 Prompt for AI Agents
In src/app/shared/components/page-not-found/page-not-found.component.ts around
lines 21 to 23, the code directly parses JSON from storage without validation or
error handling, which can cause runtime errors or security issues. Modify the
code to first check if the stored value exists and is a non-empty string, then
wrap the JSON.parse call in a try-catch block to handle any parsing errors
gracefully. If parsing fails or the value is invalid, set redirectUrl to a safe
default or null to avoid runtime exceptions.

<div class="row">
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
<app-dashboard-contributor-card [type]="corporateContributor" [highlights]="corporateHightlights"
<app-dashboard-contributor-card [type]="corporateContributor" [highlights]="corporateHightLights"
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Property name mismatch between template and component.

The template uses corporateHightLights and individualHightLights, but these should match the corrected spelling in the component properties.

-                    <app-dashboard-contributor-card [type]="corporateContributor" [highlights]="corporateHightLights"
+                    <app-dashboard-contributor-card [type]="corporateContributor" [highlights]="corporateHighlights"
                         (btnEmitter)="onClickCorporateProceed()">
-                    <app-dashboard-contributor-card [type]="individualContributor" [highlights]="individualHightLights"
+                    <app-dashboard-contributor-card [type]="individualContributor" [highlights]="individualHighlights"
                         (btnEmitter)="onClickIndividualProceed()">

Also applies to: 23-23

🤖 Prompt for AI Agents
In
src/app/modules/dashboard/container/cla-dashboard/cla-dashboard.component.html
at lines 18 and 23, the property names used in the template are misspelled as
corporateHightLights and individualHightLights. Update these property bindings
to match the correct spelling used in the component, which should be
corporateHighlights and individualHighlights respectively, ensuring consistency
between the template and component properties.

Comment on lines +45 to +46
const projectId = JSON.parse(this.storageService.getItem(AppSettings.PROJECT_ID));
if (projectId) {
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add error handling for JSON.parse operations.

Multiple JSON.parse calls could throw errors if the stored values are not valid JSON.

For example, in the getProject method:

-    const projectId = JSON.parse(this.storageService.getItem(AppSettings.PROJECT_ID));
+    let projectId;
+    try {
+      projectId = JSON.parse(this.storageService.getItem(AppSettings.PROJECT_ID) || 'null');
+    } catch (error) {
+      this.errorEmitter.emit(true);
+      this.alertService.error('Invalid project ID format');
+      return;
+    }

Apply similar error handling to other JSON.parse calls in lines 69 and 32.

Also applies to: 51-51, 69-70, 74-74

🤖 Prompt for AI Agents
In src/app/shared/components/project-title/project-title.component.ts around
lines 32, 45-46, 51, 69-70, and 74, the JSON.parse calls lack error handling and
may throw exceptions if the stored values are invalid JSON. Wrap each JSON.parse
call in a try-catch block to safely handle parsing errors, returning a default
value or null if parsing fails, to prevent runtime exceptions and improve
robustness.

Comment on lines +22 to +23
corporateHightLights: string[];
individualHightLights: string[];
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix the spelling of highlight properties.

The property names still use the misspelled "hightLights" instead of "highlights".

-  corporateHightLights: string[];
-  individualHightLights: string[];
+  corporateHighlights: string[];
+  individualHighlights: string[];
-    this.corporateHightLights = [
+    this.corporateHighlights = [
-    this.individualHightLights = [
+    this.individualHighlights = [

Also applies to: 41-41, 48-48

🤖 Prompt for AI Agents
In src/app/modules/dashboard/container/cla-dashboard/cla-dashboard.component.ts
at lines 22-23, 41, and 48, the property names use the incorrect spelling
"hightLights". Rename these properties to "highlights" to correct the spelling.
Update all references to these properties accordingly to maintain consistency
and avoid errors.

Comment on lines +76 to +84
this.authService.loading$.subscribe((loading) => {
if (!loading) {
this.authService.isAuthenticated$.subscribe((authenticated) => {
if (!authenticated && !this.hasPrivateWindow) {
this.authService.login();
}
});
}
});
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Manage subscriptions to prevent memory leaks.

The nested subscriptions are not unsubscribed, which can cause memory leaks. Consider using RxJS operators and implementing OnDestroy.

First, import the necessary items:

-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, OnDestroy } from '@angular/core';
+import { Subject } from 'rxjs';
+import { takeUntil, filter, switchMap } from 'rxjs/operators';

Then update the class:

-export class ClaDashboardComponent implements OnInit {
+export class ClaDashboardComponent implements OnInit, OnDestroy {
+  private destroy$ = new Subject<void>();

Refactor the subscription logic:

-    this.authService.loading$.subscribe((loading) => {
-      if (!loading) {
-        this.authService.isAuthenticated$.subscribe((authenticated) => {
-          if (!authenticated && !this.hasPrivateWindow) {
-            this.authService.login();
-          }
-        });
-      }
-    });
+    this.authService.loading$.pipe(
+      filter(loading => !loading),
+      switchMap(() => this.authService.isAuthenticated$),
+      takeUntil(this.destroy$)
+    ).subscribe((authenticated) => {
+      if (!authenticated && !this.hasPrivateWindow) {
+        this.authService.login();
+      }
+    });

Add the ngOnDestroy method:

  ngOnDestroy(): void {
    this.destroy$.next();
    this.destroy$.complete();
  }
🤖 Prompt for AI Agents
In src/app/modules/dashboard/container/cla-dashboard/cla-dashboard.component.ts
around lines 76 to 84, the nested subscriptions to loading$ and isAuthenticated$
are not unsubscribed, risking memory leaks. Refactor by using RxJS operators
like switchMap and takeUntil with a destroy$ subject to manage unsubscription.
Import Subject and takeUntil, declare a private destroy$ subject in the class,
pipe the observables with takeUntil(this.destroy$), and implement ngOnDestroy to
call destroy$.next() and destroy$.complete() to clean up subscriptions properly.

this.userId = this.route.snapshot.paramMap.get('userId');
const redirect = this.route.snapshot.queryParamMap.get('redirect');

this.project = JSON.parse(this.storageService.getItem(AppSettings.PROJECT));
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add error handling for JSON.parse.

The JSON.parse call could throw if the stored value is not valid JSON.

-    this.project = JSON.parse(this.storageService.getItem(AppSettings.PROJECT));
+    try {
+      const storedProject = this.storageService.getItem(AppSettings.PROJECT);
+      this.project = storedProject ? JSON.parse(storedProject) : new ProjectModel();
+    } catch (error) {
+      console.error('Error parsing stored project:', error);
+      this.project = new ProjectModel();
+    }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
this.project = JSON.parse(this.storageService.getItem(AppSettings.PROJECT));
try {
const storedProject = this.storageService.getItem(AppSettings.PROJECT);
this.project = storedProject
? JSON.parse(storedProject)
: new ProjectModel();
} catch (error) {
console.error('Error parsing stored project:', error);
this.project = new ProjectModel();
}
🤖 Prompt for AI Agents
In src/app/modules/dashboard/container/cla-dashboard/cla-dashboard.component.ts
at line 62, the JSON.parse call on the stored project data can throw an error if
the data is not valid JSON. Wrap the JSON.parse call in a try-catch block to
handle potential parsing errors gracefully. In the catch block, handle the error
by either setting this.project to a default value or logging the error for
debugging purposes.

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

♻️ Duplicate comments (1)
src/app/modules/dashboard/container/auth-dashboard/auth-dashboard.component.spec.ts (1)

12-23: Duplicate beforeEach hooks still violate Biome rule.

The lint error flagged earlier (noDuplicateTestHooks) remains because lines 12-17 and 19-23 define two separate beforeEach blocks. Merge them to a single hook:

-  beforeEach(async () => {
-    await TestBed.configureTestingModule({
-      declarations: [ AuthDashboardComponent ]
-    })
-    .compileComponents();
-  });
-
-  beforeEach(() => {
-    fixture = TestBed.createComponent(AuthDashboardComponent);
-    component = fixture.componentInstance;
-    fixture.detectChanges();
-  });
+  beforeEach(async () => {
+    await TestBed.configureTestingModule({
+      declarations: [AuthDashboardComponent],
+    }).compileComponents();
+
+    fixture = TestBed.createComponent(AuthDashboardComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
🧹 Nitpick comments (1)
src/app/modules/dashboard/container/auth-dashboard/auth-dashboard.component.html (1)

1-2: Template is now empty – consider adding a loader or router outlet

The placeholder paragraph is gone (✅ thanks!), but the template is now completely empty apart from the license header.
If the TS logic performs an immediate redirect this is fine, otherwise end-users will see a blank screen.
Typical patterns are to either:

+<cla-loader *ngIf="isLoading"></cla-loader>
+<router-outlet *ngIf="!isLoading"></router-outlet>

or leave an explanatory comment so future maintainers know the emptiness is intentional.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 59167d0 and d63807a.

📒 Files selected for processing (4)
  • src/app/modules/dashboard/container/auth-dashboard/auth-dashboard.component.html (1 hunks)
  • src/app/modules/dashboard/container/auth-dashboard/auth-dashboard.component.scss (1 hunks)
  • src/app/modules/dashboard/container/auth-dashboard/auth-dashboard.component.spec.ts (1 hunks)
  • src/app/modules/dashboard/container/auth-dashboard/auth-dashboard.component.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/app/modules/dashboard/container/auth-dashboard/auth-dashboard.component.scss
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/app/modules/dashboard/container/auth-dashboard/auth-dashboard.component.ts
🧰 Additional context used
🪛 HTMLHint (1.5.0)
src/app/modules/dashboard/container/auth-dashboard/auth-dashboard.component.html

[error] 2-2: Doctype must be declared before any non-comment content.

(doctype-first)

🪛 Biome (1.9.4)
src/app/modules/dashboard/container/auth-dashboard/auth-dashboard.component.spec.ts

[error] 19-23: Disallow duplicate setup and teardown hooks.

Disallow beforeEach duplicacy inside the describe function.

(lint/suspicious/noDuplicateTestHooks)

🔇 Additional comments (2)
src/app/modules/dashboard/container/auth-dashboard/auth-dashboard.component.spec.ts (1)

1-3: License header now present – nice catch.

The required SPDX-MIT header has been added, resolving the pipeline error. 👍

src/app/modules/dashboard/container/auth-dashboard/auth-dashboard.component.html (1)

1-2: License header looks good

The SPDX identifier and copyright notice are correctly added.
No further action required.

Copy link
Member

@lukaszgryglicki lukaszgryglicki left a comment

Choose a reason for hiding this comment

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

/lgtm

@amolsontakke3576 amolsontakke3576 merged commit 96934a7 into main Jun 25, 2025
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants