Fix infinite scroll on big screens
[oweals/peertube.git] / client / src / app / +my-account / my-account.component.ts
1 import { Component } from '@angular/core'
2 import { ServerService } from '@app/core'
3 import { I18n } from '@ngx-translate/i18n-polyfill'
4 import { TopMenuDropdownParam } from '@app/shared/menu/top-menu-dropdown.component'
5
6 @Component({
7   selector: 'my-my-account',
8   templateUrl: './my-account.component.html',
9   styleUrls: [ './my-account.component.scss' ]
10 })
11 export class MyAccountComponent {
12   menuEntries: TopMenuDropdownParam[] = []
13
14   constructor (
15     private serverService: ServerService,
16     private i18n: I18n
17   ) {
18
19     const libraryEntries: TopMenuDropdownParam = {
20       label: this.i18n('My library'),
21       children: [
22         {
23           label: this.i18n('My channels'),
24           routerLink: '/my-account/video-channels',
25           iconName: 'folder'
26         },
27         {
28           label: this.i18n('My videos'),
29           routerLink: '/my-account/videos',
30           iconName: 'videos'
31         },
32         {
33           label: this.i18n('My playlists'),
34           routerLink: '/my-account/video-playlists',
35           iconName: 'playlists'
36         },
37         {
38           label: this.i18n('My subscriptions'),
39           routerLink: '/my-account/subscriptions',
40           iconName: 'subscriptions'
41         },
42         {
43           label: this.i18n('My history'),
44           routerLink: '/my-account/history/videos',
45           iconName: 'history'
46         }
47       ]
48     }
49
50     if (this.isVideoImportEnabled()) {
51       libraryEntries.children.push({
52         label: 'My imports',
53         routerLink: '/my-account/video-imports',
54         iconName: 'cloud-download'
55       })
56     }
57
58     const miscEntries: TopMenuDropdownParam = {
59       label: this.i18n('Misc'),
60       children: [
61         {
62           label: this.i18n('Muted accounts'),
63           routerLink: '/my-account/blocklist/accounts',
64           iconName: 'user'
65         },
66         {
67           label: this.i18n('Muted instances'),
68           routerLink: '/my-account/blocklist/servers',
69           iconName: 'server'
70         },
71         {
72           label: this.i18n('Ownership changes'),
73           routerLink: '/my-account/ownership',
74           iconName: 'im-with-her'
75         }
76       ]
77     }
78
79     this.menuEntries = [
80       {
81         label: this.i18n('My settings'),
82         routerLink: '/my-account/settings'
83       },
84       {
85         label: this.i18n('My notifications'),
86         routerLink: '/my-account/notifications'
87       },
88       libraryEntries,
89       miscEntries
90     ]
91   }
92
93   isVideoImportEnabled () {
94     const importConfig = this.serverService.getConfig().import.videos
95
96     return importConfig.http.enabled || importConfig.torrent.enabled
97   }
98
99 }