-
Notifications
You must be signed in to change notification settings - Fork 1
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
base: master
Are you sure you want to change the base?
Conversation
b0b35bd
to
5c4bd27
Compare
ff4a508
to
8056c69
Compare
d38c74d
to
30bb2c2
Compare
There was a problem hiding this 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, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To move the BreadcrumbComponent
from the declarations
array to the imports
array in the app.module.ts
file, you can follow these steps:
-
Open
app.module.ts
: Locate and open the file atprojects/arc/src/app/app.module.ts
in your code editor. -
Find the Arrays: Look for the
declarations
andimports
arrays in the@NgModule
decorator. -
Remove from Declarations: Remove the
BreadcrumbComponent
entry from thedeclarations
array. -
Add to Imports: Add
BreadcrumbComponent
to theimports
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.
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
console.log('Breadcrumbs:', breadcrumbs); | |
if (isDevMode()) { | |
console.log('Breadcrumbs:', breadcrumbs); | |
} |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved sir
ngOnInit(): void { | ||
this.breadcrumbs$.subscribe(breadcrumbs => { | ||
console.log('Breadcrumbs:', breadcrumbs); | ||
}); | ||
} |
There was a problem hiding this comment.
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.
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.
30bb2c2
to
b10cd1c
Compare
templateUrl: './user-title.component.html', | ||
}) | ||
export class UserTitleComponent { | ||
title: any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove any
There was a problem hiding this comment.
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'}) |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create seperate interface folder
There was a problem hiding this comment.
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); | ||
} | ||
} |
There was a problem hiding this comment.
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'}) |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove any
There was a problem hiding this comment.
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; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create in separate file
There was a problem hiding this comment.
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'}) |
There was a problem hiding this comment.
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; | ||
} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolve this
b10cd1c
to
a876cf9
Compare
a876cf9
to
3f9dda5
Compare
@@ -0,0 +1,9 @@ | |||
export interface User { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove any
There was a problem hiding this comment.
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; | |||
|
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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 => { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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'}, | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use types here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done mam
653ce83
to
9d7ac29
Compare
9d7ac29
to
51af24a
Compare
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.
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
Checklist: