-
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
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
9d7ac29
to
51af24a
Compare
51af24a
to
1c196b6
Compare
bd931a5
to
3d85028
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 introduces a reusable breadcrumb component to improve user navigation by supporting both static and dynamic rendering, along with minor updates to existing components such as enhanced Stripe integration and form control refactoring. Key changes include:
- Refactoring the add-tenant component for cleaner imports and updated Stripe integration.
- Adding a new breadcrumb component and demonstration modules in both arc and arc-lib packages.
- Updating routing and module declarations to incorporate breadcrumb routes and functionalities.
Reviewed Changes
Copilot reviewed 26 out of 27 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
projects/saas-ui/src/app/on-boarding/components/add-tenant/add-tenant.component.ts | Reorganized imports and refactored form control definitions for Stripe support. |
projects/saas-ui/src/app/main/components/add-plan/add-plan.component.ts | Simplified subscription call by removing an unnecessary callback. |
projects/arc/src/app/main/main.module.ts | Added BreadcrumbComponent to the module declarations. |
projects/arc/src/app/main/main.component.html | Inserted the new element for navigation context. |
projects/arc/src/app/main/main-routing.module.ts | Introduced new routes for dynamic breadcrumb generation with async loading. |
projects/arc/src/app/main/introduction/introduction-routing.module.ts | Added a route for the breadcrumb demo component. |
projects/arc/src/app/main/constants/components.constant.ts | Updated components constant with a new link for the breadcrumb demo. |
projects/arc/src/app/main/bread-crumb-introduction/ | New component files demonstrating breadcrumb usage. |
projects/arc/src/app/app.module.ts & app-routing.module.ts | Updated module configuration with breadcrumb-related providers and route data. |
projects/arc-lib/src/lib/components/breadcrumb/ | Added new breadcrumb service, component, and demo files along with associated styles and interfaces. |
this.destroy$.complete(); | ||
} | ||
toggleExpand() { | ||
this.expanded = true; |
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.
The toggleExpand method always sets 'expanded' to true instead of toggling its state, which prevents collapsing the expanded breadcrumb view. Consider updating it to: this.expanded = !this.expanded;
this.expanded = true; | |
this.expanded = !this.expanded; |
Copilot uses AI. Check for mistakes.
export class BreadcrumbComponent implements OnInit { | ||
breadcrumbs$: Observable<Breadcrumb[]> = this.breadcrumbService.breadcrumbs; | ||
|
||
@Input() staticBreadcrumbs = []; |
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.
where is this being used in component?
<ng-container *ngFor="let breadcrumb of breadcrumbs; let last = last"> | ||
<li class="breadcrumb-item" [class.active]="last"> | ||
<ng-container *ngIf="!breadcrumb.skipLink && !last; else noLink"> | ||
<a [routerLink]="breadcrumb.url">{{ breadcrumb.label }}</a> |
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.
what if a breacrumb label is too long? Shouldn't we trim it ?
.breadcrumb-item { | ||
display: flex; | ||
align-items: center; | ||
font-size: 14px; |
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.
Shouldn't we use rem for responsive design?
const paramValue = params.get('id'); | ||
const fallback = | ||
asyncConfig.fallbackLabel?.(params) || this._toTitleCase(path); | ||
const loadingLabel = asyncConfig.loadingLabel || fallback; |
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.
Do we have a reusable loader service? If yes, then I think it will be better to show loader instead of a text
asyncConfig.fallbackLabel?.(params) || this._toTitleCase(path); | ||
const loadingLabel = asyncConfig.loadingLabel || fallback; | ||
|
||
setTimeout(async () => { |
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 setTimeout?
const asyncConfig = data?.asyncBreadcrumb; | ||
if (asyncConfig?.service && asyncConfig?.method) { | ||
const params = route.paramMap; | ||
const paramValue = params.get('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.
id shouldn't be hardcoded.
setTimeout(async () => { | ||
try { | ||
const serviceInstance = this.injector.get(asyncConfig.service); | ||
const result$ = serviceInstance[asyncConfig.method](paramValue); |
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.
This seems a little restrictive as the method can only have 1 required argument of string type.
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: