X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Bmy-account%2Fmy-account.component.ts;h=450454ca2659940d83d7b24da3e71e604da32a2b;hb=464e4ed92c119c8f5d8ae561ad1d27a90d2581a0;hp=548f6a1c0b5ef183064d0f5ec2d14ce9443d937f;hpb=4c8e4e04d1b3f0f207e9155df393ceeb23dc2172;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/+my-account/my-account.component.ts b/client/src/app/+my-account/my-account.component.ts index 548f6a1c0..450454ca2 100644 --- a/client/src/app/+my-account/my-account.component.ts +++ b/client/src/app/+my-account/my-account.component.ts @@ -1,8 +1,6 @@ import { Component, OnInit } from '@angular/core' -import { ServerService } from '@app/core' -import { NavigationStart, Router } from '@angular/router' -import { filter } from 'rxjs/operators' -import { I18n } from '@ngx-translate/i18n-polyfill' +import { AuthUser, ScreenService } from '@app/core' +import { TopMenuDropdownParam } from '../shared/shared-main/misc/top-menu-dropdown.component' @Component({ selector: 'my-my-account', @@ -10,41 +8,60 @@ import { I18n } from '@ngx-translate/i18n-polyfill' styleUrls: [ './my-account.component.scss' ] }) export class MyAccountComponent implements OnInit { - - libraryLabel = '' + menuEntries: TopMenuDropdownParam[] = [] + user: AuthUser constructor ( - private serverService: ServerService, - private router: Router, - private i18n: I18n - ) {} - - ngOnInit () { - console.log(this.router.url) - this.updateLibraryLabel(this.router.url) - - this.router.events - .pipe(filter(event => event instanceof NavigationStart)) - .subscribe((event: NavigationStart) => this.updateLibraryLabel(event.url)) + private screenService: ScreenService + ) { } + + get isBroadcastMessageDisplayed () { + return this.screenService.isBroadcastMessageDisplayed } - isVideoImportEnabled () { - return this.serverService.getConfig().import.videos.http.enabled + ngOnInit (): void { + this.buildMenu() } - private updateLibraryLabel (url: string) { - const [ path ] = url.split('?') - - if (path === '/my-account/video-channels') { - this.libraryLabel = this.i18n('Channels') - } else if (path === '/my-account/videos') { - this.libraryLabel = this.i18n('Videos') - } else if (path === '/my-account/subscriptions') { - this.libraryLabel = this.i18n('Subscriptions') - } else if (path === '/my-account/video-imports') { - this.libraryLabel = this.i18n('Video imports') - } else { - this.libraryLabel = '' + private buildMenu () { + const moderationEntries: TopMenuDropdownParam = { + label: $localize`Moderation`, + children: [ + { + label: $localize`Muted accounts`, + routerLink: '/my-account/blocklist/accounts', + iconName: 'user-x' + }, + { + label: $localize`Muted servers`, + routerLink: '/my-account/blocklist/servers', + iconName: 'peertube-x' + }, + { + label: $localize`Abuse reports`, + routerLink: '/my-account/abuses', + iconName: 'flag' + } + ] } + + this.menuEntries = [ + { + label: $localize`Settings`, + routerLink: '/my-account/settings' + }, + + { + label: $localize`Notifications`, + routerLink: '/my-account/notifications' + }, + + { + label: $localize`Applications`, + routerLink: '/my-account/applications' + }, + + moderationEntries + ] } }