diff options
author | Chocobozzz <me@florianbigard.com> | 2020-11-12 15:28:54 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-11-13 12:02:21 +0100 |
commit | 17119e4a546522468878cf115558b17949ab50d0 (patch) | |
tree | 3f130cfd7fdccf5aeeac9beee941750590239047 /client/src/app/+my-account/my-account.component.ts | |
parent | b4bc269e5517849b5b89052f0c1a2c01b6f65089 (diff) | |
download | PeerTube-17119e4a546522468878cf115558b17949ab50d0.tar.gz PeerTube-17119e4a546522468878cf115558b17949ab50d0.tar.zst PeerTube-17119e4a546522468878cf115558b17949ab50d0.zip |
Reorganize left menu and account menu
Add my-settings and my-library in left menu
Move administration below my-library
Split account menu: my-setting and my library
Diffstat (limited to 'client/src/app/+my-account/my-account.component.ts')
-rw-r--r-- | client/src/app/+my-account/my-account.component.ts | 84 |
1 files changed, 10 insertions, 74 deletions
diff --git a/client/src/app/+my-account/my-account.component.ts b/client/src/app/+my-account/my-account.component.ts index d3bf8d143..d6e9d1c15 100644 --- a/client/src/app/+my-account/my-account.component.ts +++ b/client/src/app/+my-account/my-account.component.ts | |||
@@ -1,6 +1,5 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { AuthService, AuthUser, ScreenService, ServerService } from '@app/core' | 2 | import { AuthUser, ScreenService } from '@app/core' |
3 | import { ServerConfig } from '@shared/models' | ||
4 | import { TopMenuDropdownParam } from '../shared/shared-main/misc/top-menu-dropdown.component' | 3 | import { TopMenuDropdownParam } from '../shared/shared-main/misc/top-menu-dropdown.component' |
5 | 4 | ||
6 | @Component({ | 5 | @Component({ |
@@ -12,11 +11,7 @@ export class MyAccountComponent implements OnInit { | |||
12 | menuEntries: TopMenuDropdownParam[] = [] | 11 | menuEntries: TopMenuDropdownParam[] = [] |
13 | user: AuthUser | 12 | user: AuthUser |
14 | 13 | ||
15 | private serverConfig: ServerConfig | ||
16 | |||
17 | constructor ( | 14 | constructor ( |
18 | private serverService: ServerService, | ||
19 | private authService: AuthService, | ||
20 | private screenService: ScreenService | 15 | private screenService: ScreenService |
21 | ) { } | 16 | ) { } |
22 | 17 | ||
@@ -25,67 +20,12 @@ export class MyAccountComponent implements OnInit { | |||
25 | } | 20 | } |
26 | 21 | ||
27 | ngOnInit (): void { | 22 | ngOnInit (): void { |
28 | this.serverConfig = this.serverService.getTmpConfig() | 23 | this.buildMenu() |
29 | this.serverService.getConfig() | ||
30 | .subscribe(config => this.serverConfig = config) | ||
31 | |||
32 | this.user = this.authService.getUser() | ||
33 | |||
34 | this.authService.userInformationLoaded.subscribe( | ||
35 | () => this.buildMenu() | ||
36 | ) | ||
37 | } | ||
38 | |||
39 | isVideoImportEnabled () { | ||
40 | const importConfig = this.serverConfig.import.videos | ||
41 | |||
42 | return importConfig.http.enabled || importConfig.torrent.enabled | ||
43 | } | 24 | } |
44 | 25 | ||
45 | private buildMenu () { | 26 | private buildMenu () { |
46 | const libraryEntries: TopMenuDropdownParam = { | 27 | const moderationEntries: TopMenuDropdownParam = { |
47 | label: $localize`My library`, | 28 | label: $localize`Moderation`, |
48 | children: [ | ||
49 | { | ||
50 | label: $localize`My channels`, | ||
51 | routerLink: '/my-account/video-channels', | ||
52 | iconName: 'channel' | ||
53 | }, | ||
54 | { | ||
55 | label: $localize`My videos`, | ||
56 | routerLink: '/my-account/videos', | ||
57 | iconName: 'videos', | ||
58 | isDisplayed: () => this.user.canSeeVideosLink | ||
59 | }, | ||
60 | { | ||
61 | label: $localize`My playlists`, | ||
62 | routerLink: '/my-account/video-playlists', | ||
63 | iconName: 'playlists' | ||
64 | }, | ||
65 | { | ||
66 | label: $localize`My subscriptions`, | ||
67 | routerLink: '/my-account/subscriptions', | ||
68 | iconName: 'subscriptions' | ||
69 | }, | ||
70 | { | ||
71 | label: $localize`My history`, | ||
72 | routerLink: '/my-account/history/videos', | ||
73 | iconName: 'history' | ||
74 | } | ||
75 | ] | ||
76 | } | ||
77 | |||
78 | if (this.isVideoImportEnabled()) { | ||
79 | libraryEntries.children.push({ | ||
80 | label: 'My imports', | ||
81 | routerLink: '/my-account/video-imports', | ||
82 | iconName: 'cloud-download', | ||
83 | isDisplayed: () => this.user.canSeeVideosLink | ||
84 | }) | ||
85 | } | ||
86 | |||
87 | const miscEntries: TopMenuDropdownParam = { | ||
88 | label: $localize`Misc`, | ||
89 | children: [ | 29 | children: [ |
90 | { | 30 | { |
91 | label: $localize`Muted accounts`, | 31 | label: $localize`Muted accounts`, |
@@ -98,29 +38,25 @@ export class MyAccountComponent implements OnInit { | |||
98 | iconName: 'peertube-x' | 38 | iconName: 'peertube-x' |
99 | }, | 39 | }, |
100 | { | 40 | { |
101 | label: $localize`My abuse reports`, | 41 | label: $localize`Abuse reports`, |
102 | routerLink: '/my-account/abuses', | 42 | routerLink: '/my-account/abuses', |
103 | iconName: 'flag' | 43 | iconName: 'flag' |
104 | }, | ||
105 | { | ||
106 | label: $localize`Ownership changes`, | ||
107 | routerLink: '/my-account/ownership', | ||
108 | iconName: 'download' | ||
109 | } | 44 | } |
110 | ] | 45 | ] |
111 | } | 46 | } |
112 | 47 | ||
113 | this.menuEntries = [ | 48 | this.menuEntries = [ |
114 | { | 49 | { |
115 | label: $localize`My settings`, | 50 | label: $localize`Settings`, |
116 | routerLink: '/my-account/settings' | 51 | routerLink: '/my-account/settings' |
117 | }, | 52 | }, |
53 | |||
118 | { | 54 | { |
119 | label: $localize`My notifications`, | 55 | label: $localize`Notifications`, |
120 | routerLink: '/my-account/notifications' | 56 | routerLink: '/my-account/notifications' |
121 | }, | 57 | }, |
122 | libraryEntries, | 58 | |
123 | miscEntries | 59 | moderationEntries |
124 | ] | 60 | ] |
125 | } | 61 | } |
126 | } | 62 | } |