Skip to content

feat(arc): implement breadcrumb feature #128

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

vaibhavbhalla2505
Copy link

@vaibhavbhalla2505 vaibhavbhalla2505 commented Jun 2, 2025

Description

This PR introduces a reusable breadcrumb component with both static and dynamic rendering support. The component helps users understand their navigation context and easily traverse application routes.

Fixes # (issue)

GH-126

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Intermediate change (work in progress)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Checklist:

  • Performed a self-review of my own code
  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Any dependent changes have been merged and published in downstream modules

Copilot

This comment was marked as outdated.

@rohit-sourcefuse rohit-sourcefuse requested a review from Copilot June 10, 2025 12:04
Copilot

This comment was marked as outdated.

@rohit-sourcefuse rohit-sourcefuse requested a review from Copilot June 10, 2025 12:09
Copilot

This comment was marked as outdated.

@rohit-sourcefuse rohit-sourcefuse requested a review from Copilot June 10, 2025 12:10
Copilot

This comment was marked as outdated.

@vaibhavbhalla2505 vaibhavbhalla2505 force-pushed the GH-126 branch 2 times, most recently from d38c74d to 30bb2c2 Compare June 11, 2025 05:56
@rohit-sourcefuse rohit-sourcefuse requested a review from Copilot June 11, 2025 10:10
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a reusable breadcrumb feature including a demo introduction component, integrates it into the main app navigation, and exposes it from the component library.

  • Introduces BreadCrumbIntroductionComponent with static and dynamic examples.
  • Registers BreadcrumbComponent (standalone) in the AppModule and adds a menu entry.
  • Implements BreadcrumbService, BreadcrumbComponent, and demo user/document resolvers in the library.

Reviewed Changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
projects/arc/src/app/main/constants/components.constant.ts Added “Breadcrumb” menu item
projects/arc/src/app/main/bread-crumb-introduction/**/* New demo component, template, and styles for demo
projects/arc/src/app/app.module.ts Imported and declared standalone BreadcrumbComponent
projects/arc/src/app/app-routing.module.ts Set data.skipLink on main route
projects/arc-lib/src/lib/components/index.ts Exported breadcrumb.component from the library
projects/arc-lib/src/lib/components/breadcrumb/* Added service, interface, standalone component, styles, template, and demo modules
Comments suppressed due to low confidence (2)

projects/arc/src/app/main/bread-crumb-introduction/bread-crumb-introduction.component.html:16

  • [nitpick] The title attribute says “Copy Routing Code” but this button copies the basic breadcrumb snippet. Update it to something like “Copy Basic Code”.
      (click)="copyCode(basicCode)" title="Copy Routing Code"

projects/arc-lib/src/lib/components/breadcrumb/breadcrumb.component.ts:15

  • [nitpick] New BreadcrumbComponent logic isn’t covered by unit tests. Consider adding tests for expansion behavior, input bindings, and service integration.
export class BreadcrumbComponent implements OnInit {

@@ -40,6 +40,7 @@ import {SidebarComponent} from '@project-lib/components/sidebar/sidebar.componen
BrowserAnimationsModule,
HeaderComponent,
SidebarComponent,
BreadcrumbComponent,
Copy link
Preview

Copilot AI Jun 11, 2025

Choose a reason for hiding this comment

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

Since BreadcrumbComponent is declared as a standalone component, it should be added to the NgModule's imports instead of declarations to avoid declaration conflicts.

Copilot uses AI. Check for mistakes.

Choose a reason for hiding this comment

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

@vaibhavbhalla2505

To move the BreadcrumbComponent from the declarations array to the imports array in the app.module.ts file, you can follow these steps:

  1. Open app.module.ts: Locate and open the file at projects/arc/src/app/app.module.ts in your code editor.

  2. Find the Arrays: Look for the declarations and imports arrays in the @NgModule decorator.

  3. Remove from Declarations: Remove the BreadcrumbComponent entry from the declarations array.

  4. Add to Imports: Add BreadcrumbComponent to the imports array.

Here’s how the modified code should look:

import { NgModule } from '@angular/core';
// Other imports...
import { BreadcrumbComponent } from '@project-lib/components/breadcrumb/breadcrumb.component';

@NgModule({
  declarations: [
    // Other components...
    HeaderComponent,
    SidebarComponent,
    // Remove BreadcrumbComponent from here
  ],
  imports: [
    BrowserAnimationsModule,
    HeaderComponent,
    SidebarComponent,
    BreadcrumbComponent,  // Add BreadcrumbComponent here
  ],
  // Other configurations...
})
export class AppModule { }

By following these steps, you'll properly integrate the standalone BreadcrumbComponent into your Angular module without causing declaration conflicts.

Copy link
Author

Choose a reason for hiding this comment

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

sir ,its already in imports array

@NgModule({
declarations: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [
BrowserModule,
AppRoutingModule,
HttpClientModule,
LocalizationModule,
CoreModule,
ThemeModule.forRoot('default'),
OverlayModule,
SelectModule,
GanttModule,
BrowserAnimationsModule,
HeaderComponent,
SidebarComponent,
BreadcrumbComponent,
],
providers: [
TranslationService,
TranslateService,
IconPacksManagerService,
TranslateStore,
SystemStoreFacadeService,
EnvAdapterService,
ApiService,
{
provide: APP_CONFIG,
useValue: environment,
},
],
bootstrap: [AppComponent],
})
export class AppModule {}

constructor(private readonly breadcrumbService: BreadcrumbService) {}
ngOnInit(): void {
this.breadcrumbs$.subscribe(breadcrumbs => {
console.log('Breadcrumbs:', breadcrumbs);
Copy link
Preview

Copilot AI Jun 11, 2025

Choose a reason for hiding this comment

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

Logging breadcrumb values on every navigation can clutter the console in production. Consider removing this or wrapping it in a debug flag.

Suggested change
console.log('Breadcrumbs:', breadcrumbs);
if (isDevMode()) {
console.log('Breadcrumbs:', breadcrumbs);
}

Copilot uses AI. Check for mistakes.

Copy link
Author

Choose a reason for hiding this comment

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

resolved sir

Comment on lines 26 to 32
ngOnInit(): void {
this.breadcrumbs$.subscribe(breadcrumbs => {
console.log('Breadcrumbs:', breadcrumbs);
});
}
Copy link
Preview

Copilot AI Jun 11, 2025

Choose a reason for hiding this comment

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

Subscribing without unsubscribing may lead to memory leaks. Consider using the async pipe in the template or managing the subscription lifecycle.

Suggested change
ngOnInit(): void {
this.breadcrumbs$.subscribe(breadcrumbs => {
console.log('Breadcrumbs:', breadcrumbs);
});
}
// Removed the ngOnInit lifecycle method as it is no longer needed.

Copilot uses AI. Check for mistakes.

templateUrl: './user-title.component.html',
})
export class UserTitleComponent {
title: any;
Copy link
Contributor

Choose a reason for hiding this comment

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

remove any

Copy link
Author

Choose a reason for hiding this comment

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

done mam

id: string;
title: string;
}
@Injectable({providedIn: 'root'})
Copy link
Contributor

Choose a reason for hiding this comment

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

why root?

import {Observable} from 'rxjs';
import {TitleService} from './user-title.service';

export interface Title {
Copy link
Contributor

Choose a reason for hiding this comment

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

create seperate interface folder

Copy link
Author

Choose a reason for hiding this comment

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

done mam

const id = route.paramMap.get('id');
return this.titleService.getTitleById(id);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

use linter

import {Injectable} from '@angular/core';
import {Observable, of} from 'rxjs';

@Injectable({providedIn: 'root'})
Copy link
Contributor

Choose a reason for hiding this comment

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

no root

imports: [CommonModule, RouterModule],
})
export class UserComponent {
user: any;
Copy link
Contributor

Choose a reason for hiding this comment

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

remove any

Copy link
Author

Choose a reason for hiding this comment

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

done mam

id: string;
name: string;
email: string;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

create in separate file

Copy link
Author

Choose a reason for hiding this comment

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

done mam

name: string;
email: string;
}
@Injectable({providedIn: 'root'})
Copy link
Contributor

Choose a reason for hiding this comment

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

remove root from everywhere and add in appropriate modules

}

return breadcrumbs;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

modify this function to keep it clean, readable and remove if else if

Copy link
Author

Choose a reason for hiding this comment

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

done mam

@@ -40,6 +40,7 @@ import {SidebarComponent} from '@project-lib/components/sidebar/sidebar.componen
BrowserAnimationsModule,
HeaderComponent,
SidebarComponent,
BreadcrumbComponent,
Copy link
Contributor

Choose a reason for hiding this comment

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

resolve this

@@ -0,0 +1,9 @@
export interface User {
Copy link
Contributor

Choose a reason for hiding this comment

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

user model already exists in the library

Copy link
Author

Choose a reason for hiding this comment

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

done mam,i changed the name

name: string;
email: string;
}
export interface Title {
Copy link
Contributor

Choose a reason for hiding this comment

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

use name id model in library core

export class TitleService {
private readonly titles = TITLES;

getTitleById(id: string): Observable<any> {
Copy link
Contributor

Choose a reason for hiding this comment

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

remove any

Copy link
Author

Choose a reason for hiding this comment

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

done !

@@ -9,7 +9,7 @@ import { Lead } from '../../../shared/models';
import { BillingPlanService } from '../../../shared/services/billing-plan-service';
import { OnBoardingService } from '../../../shared/services/on-boarding-service';

declare var Stripe: any;
declare let Stripe: any;

Copy link
Contributor

Choose a reason for hiding this comment

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

I still see 13-14 places where any is used, fix them

const paramName = route.routeConfig.path.slice(1);
return route.params[paramName] ?? paramName;
}
return this._toTitleCase(path);
Copy link
Contributor

Choose a reason for hiding this comment

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

remove so many ifs, use array instead

expanded = false;
constructor(private readonly breadcrumbService: BreadcrumbService) {}
ngOnInit(): void {
this.breadcrumbs$.subscribe(breadcrumbs => {
Copy link
Contributor

Choose a reason for hiding this comment

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

destroy observable for all the observables

Copy link
Author

Choose a reason for hiding this comment

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

done!

export const TITLES = [
{id: '1', title: 'Contract.pdf'},
{id: '2', title: 'Appointment.pdf'},
];
Copy link
Contributor

Choose a reason for hiding this comment

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

use types here

Copy link
Author

Choose a reason for hiding this comment

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

done mam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Dynamic Breadcrumb Component
3 participants