Skip to content

[64112] Create an angular breadcrumb as placeholder for the toggle button #19229

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 9 commits into
base: dev
Choose a base branch
from

Conversation

bsatarnejad
Copy link
Contributor

Ticket

https://community.openproject.org/wp/64112

What are you trying to accomplish?

Create a breadcrumbs component for angular pages.

Screenshots

Screenshot 2025-06-18 at 12 25 06

What approach did you choose and why?

Create the component and add it to partition query space component, and pass the items to it from other components that are using its template like boards, calendars, ...

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

@bsatarnejad bsatarnejad force-pushed the 64112-create-an-angular-breadcrumb-as-placeholder-for-the-toggle-button branch from 2f8bcfd to 738c3a4 Compare June 20, 2025 07:27
@bsatarnejad bsatarnejad self-assigned this Jun 20, 2025
Copy link
Contributor

@HDinger HDinger left a comment

Choose a reason for hiding this comment

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

Looks good overall 👍 I have some code remarks and three styling related issues:

  • On some pages it looks like on mobile, there is too much space between the breadcrumb and the headline
Bildschirmfoto 2025-06-20 um 14 01 45

compared to the rails page

Bildschirmfoto 2025-06-20 um 14 01 53
  • The section headers of the sidebar are not reflected in the active breadcrumb element:
Bildschirmfoto 2025-06-20 um 14 17 26

compared to rails:
Bildschirmfoto 2025-06-20 um 14 16 39

  • The mobile BCF view is broken
Bildschirmfoto 2025-06-20 um 14 20 47

Comment on lines +124 to +128
if (this.isGantt) {
items[1] = {
href: this.pathHelperService.projectGanttChartsPath(this.currentProject.identifier as string),
text: this.I18n.t('js.work_packages.gantt_charts_label'),
};
Copy link
Contributor

Choose a reason for hiding this comment

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

This is very hacky. Please assign the value conditionally instead overwriting it based on the index in the array.

Suggested change
if (this.isGantt) {
items[1] = {
href: this.pathHelperService.projectGanttChartsPath(this.currentProject.identifier as string),
text: this.I18n.t('js.work_packages.gantt_charts_label'),
};
const items = [
{
href: this.pathHelperService.projectPath(this.currentProject.identifier as string),
text: this.currentProject.name,
},
this.breadcrumbModuleEntry();
this.selectedTitle ?? '',
];
...
breadcrumbModuleEntry():{href: string, text:string} {
if (this.isGantt) {
return ...
} else {
return ...
}

@@ -0,0 +1,40 @@
<div class="op-breadcrumbs">
<!-- Desktop Version -->
<nav aria-label="breadcrumb" class="desktop">
Copy link
Contributor

Choose a reason for hiding this comment

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

The aria label needs to be internationalised

Comment on lines +4 to +6
<ol class="breadcrumb">
<li
class="breadcrumb-item"
Copy link
Contributor

Choose a reason for hiding this comment

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

breadcrumb-item is the same class as the Primer breadcrumb component is using while breadcrumb seems to be new. I'd be very careful with re-using classes partially. At the top, you even have another namespace op-breadcrumbs. Please do not mix things here and keep it under one op-... namespace.

Comment on lines +13 to +16
.desktop
display: none
.mobile
display: block
Copy link
Contributor

Choose a reason for hiding this comment

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

We already have classes for this behavior hidden-for-mobile and hidden-for-desktop

selector: 'op-breadcrumbs',
styleUrls: ['./op-breadcrumbs.component.sass'],
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you remove the viewEncapsulation?

@@ -3,6 +3,7 @@ en:
js:
team_planner:
add_existing: 'Add existing'
team_planners_label: 'Team planners'
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
team_planners_label: 'Team planners'
label_team_planner_plural: 'Team planners'

@@ -151,6 +151,9 @@

team_planner.title

expect(team_planner).to have_test_selector("breadcrumb-item", text: "Team planners")
expect(team_planner).to have_css('.breadcrumb-item.active[aria-current="page"]', text: "Unnamed team planner")
Copy link
Contributor

Choose a reason for hiding this comment

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

See before

@@ -52,6 +52,9 @@
it do
expect(page).to have_content("All open")

expect(page).to have_test_selector("breadcrumb-item", text: "Work packages")
expect(page).to have_css('.breadcrumb-item.active[aria-current="page"]', text: "All open")
Copy link
Contributor

Choose a reason for hiding this comment

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

See before

</ng-container>

<ng-container *ngIf="last">
<span>{{ isLink(item) ? item.text : item }}</span>
Copy link
Contributor

Choose a reason for hiding this comment

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

The last item should be bold.

Primer breadcrumb:
Bildschirmfoto 2025-06-20 um 13 54 33

Angular:
Bildschirmfoto 2025-06-20 um 13 55 29

>
<ng-container *ngIf="!last">
<ng-container *ngIf="isLink(item); else plainText">
<a [href]="item.href">{{ item.text }}</a>
Copy link
Contributor

Choose a reason for hiding this comment

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

In the rails variant we set target attributes on the link. Although, this is mostly relevant for Turbo, I'd like to set them here as well for consistency

@HDinger HDinger added this to the 16.2.x milestone Jun 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants