disabled re-navigation after on interaction with orgminer content

This commit is contained in:
2026-09-28 17:32:44 +02:00
parent a519f60fc1
commit e02631544f
3 changed files with 75 additions and 38 deletions
@@ -19,17 +19,32 @@
<nav class="accordion">
<!-- STAFF -->
<div class="accordion-section">
<button
class="accordion-toggle"
[class.active]="expandedCategory() === 'staff'"
(click)="toggleCategory('staff')">
<mat-icon>{{ PERSONS_ICON }}</mat-icon>
<span class="cat-label">Personal</span>
<span class="cat-count">{{ categoryCount('staff') }}</span>
<span class="chevron" [class.open]="expandedCategory() === 'staff'"
>▾</span
>
</button>
<div class="splitted-accordion">
<button
class="accordion-toggle"
[class.active]="expandedCategory() === 'staff'"
(click)="toggleCategory('staff')">
<mat-icon>{{ PERSONS_ICON }}</mat-icon>
<span class="cat-label">Personal</span>
<span class="cat-count">{{ categoryCount('staff') }}</span>
<span class="chevron" [class.open]="expandedCategory() === 'staff'"
>▾</span
>
</button>
<button
class="accordion-toggle"
[class.active]="expandedCategory() === 'verified_staff'"
(click)="toggleCategory('verified_staff')">
<mat-icon>{{ PERSONS_ICON }}</mat-icon>
<span class="cat-label">Verifiziertes Personal</span>
<span class="cat-count">{{ categoryCount('verified_staff') }}</span>
<span
class="chevron"
[class.open]="expandedCategory() === 'verified_staff'"
>▾</span
>
</button>
</div>
@if (expandedCategory() === 'staff') {
<ul class="accordion-list">
@@ -43,6 +58,18 @@
}
</ul>
}
@if (expandedCategory() === 'verified_staff') {
<ul class="accordion-list">
@for (person of data()?.verified_staff ?? []; track person.name) {
<li
class="accordion-item"
[class.selected]="isSelected('verified_staff', person)"
(click)="selectItem('verified_staff', person)">
{{ person.name }}
</li>
}
</ul>
}
</div>
<!-- PROJECTS -->
@@ -12,7 +12,7 @@
/* ============================ SIDEBAR ============================ */
.orgminer-sidebar {
width: 280px;
width: 340px;
flex-shrink: 0;
border-right: 1px solid #e2e5ea;
background: #f7f8fa;
@@ -53,6 +53,11 @@
.accordion-section {
border-bottom: 1px solid #e9ebef;
}
.splitted-accordion {
display: flex;
justify-content: space-between;
align-items: center;
}
.accordion-toggle {
width: 100%;
@@ -25,7 +25,7 @@ import {
} from '../../../shared/ui/icons';
/* ------------------------------ Data model ------------------------------ */
type CategoryKey = 'staff' | 'projects' | 'news';
type CategoryKey = 'staff' | 'verified_staff' | 'projects' | 'news';
const EXPANDED_CATEGORY_PARAM = 'orgExpanded';
const SELECTION_CATEGORY_PARAM = 'orgSelectionCategory';
@@ -83,9 +83,9 @@ export class OrgminerContentComponent implements OnChanges, OnInit {
const expandedCategory =
this.expandedCategory() === category ? null : category;
this.expandedCategory.set(expandedCategory);
this.updateQueryParams({
[EXPANDED_CATEGORY_PARAM]: expandedCategory,
});
// this.updateQueryParams({
// [EXPANDED_CATEGORY_PARAM]: expandedCategory,
// });
}
selectItem(
@@ -94,11 +94,11 @@ export class OrgminerContentComponent implements OnChanges, OnInit {
): void {
this.selection.set({ category, item });
this.expandedCategory.set(category);
this.updateQueryParams({
[EXPANDED_CATEGORY_PARAM]: category,
[SELECTION_CATEGORY_PARAM]: category,
[SELECTION_INDEX_PARAM]: this.itemIndex(category, item),
});
// this.updateQueryParams({
// [EXPANDED_CATEGORY_PARAM]: category,
// [SELECTION_CATEGORY_PARAM]: category,
// [SELECTION_INDEX_PARAM]: this.itemIndex(category, item),
// });
}
private restoreStateFromUrl(): void {
@@ -118,21 +118,21 @@ export class OrgminerContentComponent implements OnChanges, OnInit {
}
}
private updateQueryParams(
queryParams: Record<string, string | number | null>,
): void {
this.isOwnNavigation = true;
this.router
.navigate([], {
relativeTo: this.route,
queryParams,
queryParamsHandling: 'merge',
replaceUrl: true,
})
.then((navigated) => {
if (!navigated) this.isOwnNavigation = false;
});
}
// private updateQueryParams(
// queryParams: Record<string, string | number | null>,
// ): void {
// this.isOwnNavigation = true;
// this.router
// .navigate([], {
// relativeTo: this.route,
// queryParams,
// queryParamsHandling: 'merge',
// replaceUrl: true,
// })
// .then((navigated) => {
// if (!navigated) this.isOwnNavigation = false;
// });
// }
private itemIndex(
category: CategoryKey,
@@ -150,7 +150,10 @@ export class OrgminerContentComponent implements OnChanges, OnInit {
}
private toCategoryKey(value: string | null): CategoryKey | null {
return value === 'staff' || value === 'projects' || value === 'news'
return value === 'staff' ||
value === 'verified_staff' ||
value === 'projects' ||
value === 'news'
? value
: null;
}
@@ -170,7 +173,9 @@ export class OrgminerContentComponent implements OnChanges, OnInit {
selectedStaff(): OrgminerStaff | null {
const s = this.selection();
return s?.category === 'staff' ? (s.item as OrgminerStaff) : null;
return s?.category === 'staff' || s?.category === 'verified_staff'
? (s.item as OrgminerStaff)
: null;
}
selectedProject(): OrgminerProject | null {