Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Add to module, fix imports

Benjamin Bädorf11757dde3879
diff --git a/frontend/src/app/features/in-app-notifications/center/menu/menu.component.html b/frontend/src/app/features/in-app-notifications/center/menu/menu.component.html
index c32d105f3cb..cd2eb5aab45 100644
--- a/frontend/src/app/features/in-app-notifications/center/menu/menu.component.html
+++ b/frontend/src/app/features/in-app-notifications/center/menu/menu.component.html
@@ -24,28 +24,17 @@
</a>
</li>
<li>
- <div class="tree-menu--container">
- <ul class="pages-hierarchy -with-hierarchy collapsible-menu--container">
- <li class="-hierarchy-expanded">
- <div class="tree-menu--item">
- <span class="tree-menu--hierarchy-span">
- <button
- class="tree-menu--hierarchy-indicator collapsible-menu--category-toggle"
- type="button"
- >
- <span class="tree-menu--hierarchy-indicator-icon" aria-hidden="true"></span>
- </button>
- <span class="tree-menu--hierarchy-indicator-expanded hidden-for-sighted">Expanded. Click to collapse</span>
- <span class="tree-menu--hierarchy-indicator-collapsed hidden-for-sighted">Collapsed. Click to show</span>
- </span>
- <ul class="pages-hierarchy -with-hierarchy" *ngIf="notificationsByProject$ | async">
- <li class="collapsible-menu--placeholder" *ngFor="let item of (notificationsByProject$ | async)">
- {{ item | json }}
- </li>
- </ul>
- </div>
- </li>
- </ul>
- </div>
+ <op-collapsible-menu
+ *ngIf="notificationsByReason$ | async"
+ [items]="notificationsByReason$ | async"
+ title="Unread by Reason"
+ ></op-collapsible-menu>
+ </li>
+ <li>
+ <op-collapsible-menu
+ *ngIf="notificationsByProject$ | async"
+ [items]="notificationsByProject$ | async"
+ title="Unread by Project"
+ ></op-collapsible-menu>
</li>
</ul>
diff --git a/frontend/src/app/features/in-app-notifications/center/menu/menu.component.ts b/frontend/src/app/features/in-app-notifications/center/menu/menu.component.ts
index b40abadb896..2ca8acc3e3e 100644
--- a/frontend/src/app/features/in-app-notifications/center/menu/menu.component.ts
+++ b/frontend/src/app/features/in-app-notifications/center/menu/menu.component.ts
@@ -4,11 +4,15 @@ import {
Component,
OnInit,
} from '@angular/core';
+import { map } from 'rxjs/operators';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { IanMenuService } from './state/ian-menu.service';
export const ianMenuSelector = 'op-ian-menu';
+const REASON_MENU_ITEMS = [
+];
+
@Component({
selector: ianMenuSelector,
templateUrl: './menu.component.html',
@@ -18,7 +22,11 @@ export const ianMenuSelector = 'op-ian-menu';
})
export class IanMenuComponent implements OnInit {
notificationsByProject$ = this.ianMenuService.query.notificationsByProject$;
- notificationsByReason$ = this.ianMenuService.query.notificationsByReason$;
+ notificationsByReason$ = this.ianMenuService.query.notificationsByReason$; /*.pipe(
+ map((items) => {
+
+ }),
+ );*/
text = {
title: this.I18n.t('js.notifications.title'),
@@ -39,5 +47,6 @@ export class IanMenuComponent implements OnInit {
ngOnInit() {
this.ianMenuService.reload();
+ this.notificationsByProject$.subscribe(console.log);
}
}
diff --git a/frontend/src/app/features/in-app-notifications/in-app-notifications.module.ts b/frontend/src/app/features/in-app-notifications/in-app-notifications.module.ts
index f69f628ec3f..6131aa553df 100644
--- a/frontend/src/app/features/in-app-notifications/in-app-notifications.module.ts
+++ b/frontend/src/app/features/in-app-notifications/in-app-notifications.module.ts
@@ -10,6 +10,7 @@ import { ScrollingModule } from '@angular/cdk/scrolling';
import { IAN_ROUTES } from 'core-app/features/in-app-notifications/in-app-notifications.routes';
import { InAppNotificationCenterComponent } from 'core-app/features/in-app-notifications/center/in-app-notification-center.component';
import { InAppNotificationCenterPageComponent } from 'core-app/features/in-app-notifications/center/in-app-notification-center-page.component';
+import { IanMenuComponent } from 'core-app/features/in-app-notifications/center/menu/menu.component';
import { OpenprojectWorkPackagesModule } from 'core-app/features/work-packages/openproject-work-packages.module';
import { DynamicModule } from 'ng-dynamic-component';
import { InAppNotificationStatusComponent } from './entry/status/in-app-notification-status.component';
@@ -27,6 +28,7 @@ import { MarkAllAsReadButtonComponent } from './center/toolbar/mark-all-as-read/
NotificationSettingsButtonComponent,
ActivateFacetButtonComponent,
MarkAllAsReadButtonComponent,
+ IanMenuComponent,
],
imports: [
OPSharedModule,
diff --git a/frontend/src/app/shared/components/sidemenu/collapsible-menu.component.html b/frontend/src/app/shared/components/sidemenu/collapsible-menu.component.html
index be91dab2686..73f869a830c 100644
--- a/frontend/src/app/shared/components/sidemenu/collapsible-menu.component.html
+++ b/frontend/src/app/shared/components/sidemenu/collapsible-menu.component.html
@@ -11,8 +11,30 @@
<span class="tree-menu--hierarchy-indicator-expanded hidden-for-sighted">Expanded. Click to collapse</span>
<span class="tree-menu--hierarchy-indicator-collapsed hidden-for-sighted">Collapsed. Click to show</span>
</span>
- <ul class="pages-hierarchy -with-hierarchy">
- <li class="collapsible-menu--placeholder">You have no </li>
+ <button
+ class="collapsible-menu--category-toggle ellipsis"
+ type="button"
+ (click)="toggleCollapsed"
+ >
+ {{ title }}
+ </button>
+ <ul
+ class="pages-hierarchy -with-hierarchy"
+ *ngIf="!collapsed"
+ >
+ <li
+ class="collapsible-menu--placeholder"
+ *ngIf="!items || !items.length"
+ >{{ itemsPlaceholder }}</li>
+ <li class="ui-menu-item collapsible-menu--item" *ngFor="let item of items">
+ <a
+ class="collapsible-menu-item--item-link"
+ href="#"
+ >
+ <span>{{ item.value }}</span>
+ <span class="op-bubble" *ngIf="item.count">{{ item.count }}</span>
+ </a>
+ </li>
</ul>
</div>
</li>
diff --git a/frontend/src/app/shared/components/sidemenu/collapsible-menu.component.ts b/frontend/src/app/shared/components/sidemenu/collapsible-menu.component.ts
index 5d92d7480c5..cf592e565c8 100644
--- a/frontend/src/app/shared/components/sidemenu/collapsible-menu.component.ts
+++ b/frontend/src/app/shared/components/sidemenu/collapsible-menu.component.ts
@@ -21,7 +21,9 @@ export interface IOpCollapsibleMenuItem {
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class OpCollapsibleMenuComponent implements OnInit {
- @Input() items:IOpCollapsibleMenuItem[];
+ @Input() items:IOpCollapsibleMenuItem[] = [];
+
+ @Input('items-placeholder') itemsPlaceholder:string = '';
@Input() title:string;
@@ -33,5 +35,10 @@ export class OpCollapsibleMenuComponent implements OnInit {
) { }
ngOnInit() {
+ console.log(this.items);
+ }
+
+ toggleCollapsed() {
+ this.collapsed = !this.collapsed;
}
}