92 lines
3.3 KiB
TypeScript
92 lines
3.3 KiB
TypeScript
import { Component, Input, OnInit } from '@angular/core';
|
|
import { TranslateService } from '@ngx-translate/core';
|
|
import { MatGridTileHeaderCssMatStyler } from '@angular/material';
|
|
|
|
declare interface RouteInfo {
|
|
path: string;
|
|
title: string;
|
|
icon: string;
|
|
}
|
|
declare interface GroupMenuItem {
|
|
title: string;
|
|
routes: RouteInfo[];
|
|
}
|
|
|
|
export const GENERAL_ROUTES: RouteInfo[] = [
|
|
{ path: '/home', title: '', icon: 'dashboard'}
|
|
];
|
|
export const DMP_ROUTES: RouteInfo[] = [
|
|
{ path: '/plans', title: '', icon: 'view_agenda'},
|
|
{ path: '/datasets', title: '', icon: 'library_books'},
|
|
{ path: '/projects', title: '', icon: 'work_outline'}
|
|
];
|
|
// export const HISTORY_ROUTES: RouteInfo[] = [
|
|
// { path: '/typography', title: 'LAST VISITED', icon: 'visibility'},
|
|
// { path: '/icons', title: 'LAST EDITED', icon: 'edit'}
|
|
// ];
|
|
export const PUBLIC_ROUTES: RouteInfo[] = [
|
|
// { path: '/maps', title: 'PUBLIC DMPs', icon: 'public'},
|
|
{ path: '/explore', title: 'PUBLIC DATASET DESCRIPTIONS', icon: 'public'},
|
|
{ path: '/exploreplans', title: 'PUBLIC DATASET PLANS ', icon: 'public'}
|
|
];
|
|
|
|
@Component({
|
|
selector: 'app-sidebar',
|
|
templateUrl: './sidebar.component.html',
|
|
styleUrls: ['./sidebar.component.css']
|
|
})
|
|
export class SidebarComponent implements OnInit {
|
|
generalItems: GroupMenuItem;
|
|
dmpItems: GroupMenuItem;
|
|
// historyItems: GroupMenuItem;
|
|
publicItems: GroupMenuItem;
|
|
groupMenuItems: GroupMenuItem[] = [];
|
|
|
|
constructor(public translate: TranslateService) { }
|
|
|
|
ngOnInit() {
|
|
this.translate.get('SIDE-BAR.DASHBOARD').subscribe((res: string) => {GENERAL_ROUTES[0].title = res});
|
|
this.translate.get('SIDE-BAR.MY-DMPS').subscribe((res: string) => {DMP_ROUTES[0].title = res});
|
|
this.translate.get('SIDE-BAR.MY-DATASET-DESC').subscribe((res: string) => {DMP_ROUTES[1].title = res});
|
|
this.translate.get('SIDE-BAR.MY-PROJECTS').subscribe((res: string) => {DMP_ROUTES[2].title = res});
|
|
// this.translate.get('SIDE-BAR.HISTORY-VISITED').subscribe((res: string) => {HISTORY_ROUTES[0].title = res});
|
|
// this.translate.get('SIDE-BAR.HISTORY-EDITED').subscribe((res: string) => {HISTORY_ROUTES[1].title = res});
|
|
this.translate.get('SIDE-BAR.PUBLIC-DESC').subscribe((res: string) => {PUBLIC_ROUTES[0].title = res});
|
|
this.translate.get('SIDE-BAR.PUBLIC-DMPS').subscribe((res: string) => {PUBLIC_ROUTES[1].title = res});
|
|
this.generalItems = {
|
|
title: '',
|
|
routes: GENERAL_ROUTES.filter(menuItem => menuItem)
|
|
}
|
|
this.translate.get('SIDE-BAR.GENERAL').subscribe((res: string) => {this.generalItems.title = res});
|
|
this.groupMenuItems.push(this.generalItems);
|
|
|
|
this.dmpItems = {
|
|
title: '',
|
|
routes: DMP_ROUTES.filter(menuItem => menuItem)
|
|
}
|
|
this.translate.get('SIDE-BAR.DMP').subscribe((res: string) => {this.dmpItems.title = res});
|
|
this.groupMenuItems.push(this.dmpItems);
|
|
|
|
// this.historyItems = {
|
|
// title: '',
|
|
// routes: HISTORY_ROUTES.filter(menuItem => menuItem)
|
|
// }
|
|
// this.translate.get('SIDE-BAR.HISTORY').subscribe((res: string) => {this.historyItems.title = res});
|
|
// this.groupMenuItems.push(this.historyItems);
|
|
|
|
this.publicItems = {
|
|
title: '',
|
|
routes: PUBLIC_ROUTES.filter(menuItem => menuItem)
|
|
}
|
|
this.translate.get('SIDE-BAR.PUBLIC').subscribe((res: string) => {this.publicItems.title = res});
|
|
this.groupMenuItems.push(this.publicItems);
|
|
}
|
|
// isMobileMenu() {
|
|
// if ($(window).width() > 991) {
|
|
// return false;
|
|
// }
|
|
// return true;
|
|
// };
|
|
|
|
}
|