Skip to content

Commit

Permalink
Reorganize left menu and account menu
Browse files Browse the repository at this point in the history
Add my-settings and my-library in left menu
Move administration below my-library
Split account menu: my-setting and my library
  • Loading branch information
Chocobozzz committed Nov 13, 2020
1 parent b4bc269 commit 17119e4
Show file tree
Hide file tree
Showing 68 changed files with 849 additions and 603 deletions.
6 changes: 3 additions & 3 deletions client/e2e/src/po/my-account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import { by, element, browser } from 'protractor'
export class MyAccountPage {

navigateToMyVideos () {
return element(by.css('a[href="/my-account/videos"]')).click()
return element(by.css('a[href="/my-library/videos"]')).click()
}

navigateToMyPlaylists () {
return element(by.css('a[href="/my-account/video-playlists"]')).click()
return element(by.css('a[href="/my-library/video-playlists"]')).click()
}

navigateToMyHistory () {
return element(by.css('a[href="/my-account/history/videos"]')).click()
return element(by.css('a[href="/my-library/history/videos"]')).click()
}

// My account Videos
Expand Down

This file was deleted.

This file was deleted.

97 changes: 21 additions & 76 deletions client/src/app/+my-account/my-account-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,12 @@ import { NgModule } from '@angular/core'
import { RouterModule, Routes } from '@angular/router'
import { MetaGuard } from '@ngx-meta/core'
import { LoginGuard } from '../core'
import { MyAccountAbusesListComponent } from './my-account-abuses/my-account-abuses-list.component'
import { MyAccountBlocklistComponent } from './my-account-blocklist/my-account-blocklist.component'
import { MyAccountServerBlocklistComponent } from './my-account-blocklist/my-account-server-blocklist.component'
import { MyAccountHistoryComponent } from './my-account-history/my-account-history.component'
import { MyAccountNotificationsComponent } from './my-account-notifications/my-account-notifications.component'
import { MyAccountOwnershipComponent } from './my-account-ownership/my-account-ownership.component'
import { MyAccountSettingsComponent } from './my-account-settings/my-account-settings.component'
import { MyAccountSubscriptionsComponent } from './my-account-subscriptions/my-account-subscriptions.component'
import { MyAccountVideoImportsComponent } from './my-account-video-imports/my-account-video-imports.component'
import { MyAccountVideoPlaylistCreateComponent } from './my-account-video-playlists/my-account-video-playlist-create.component'
import { MyAccountVideoPlaylistElementsComponent } from './my-account-video-playlists/my-account-video-playlist-elements.component'
import { MyAccountVideoPlaylistUpdateComponent } from './my-account-video-playlists/my-account-video-playlist-update.component'
import { MyAccountVideoPlaylistsComponent } from './my-account-video-playlists/my-account-video-playlists.component'
import { MyAccountVideosComponent } from './my-account-videos/my-account-videos.component'
import { MyAccountComponent } from './my-account.component'
import { MyAccountAbusesListComponent } from './my-account-abuses/my-account-abuses-list.component'

const myAccountRoutes: Routes = [
{
Expand All @@ -41,88 +32,50 @@ const myAccountRoutes: Routes = [

{
path: 'video-channels',
loadChildren: () => {
return import('./+my-account-video-channels/my-account-video-channels.module')
.then(m => m.MyAccountVideoChannelsModule)
}
redirectTo: '/my-library/video-channels',
pathMatch: 'full'
},

{
path: 'video-playlists',
component: MyAccountVideoPlaylistsComponent,
data: {
meta: {
title: $localize`Account playlists`
}
}
redirectTo: '/my-library/video-playlists',
pathMatch: 'full'
},
{
path: 'video-playlists/create',
component: MyAccountVideoPlaylistCreateComponent,
data: {
meta: {
title: $localize`Create new playlist`
}
}
redirectTo: '/my-library/video-playlists/create',
pathMatch: 'full'
},
{
path: 'video-playlists/:videoPlaylistId',
component: MyAccountVideoPlaylistElementsComponent,
data: {
meta: {
title: $localize`Playlist elements`
}
}
redirectTo: '/my-library/video-playlists/:videoPlaylistId',
pathMatch: 'full'
},
{
path: 'video-playlists/update/:videoPlaylistId',
component: MyAccountVideoPlaylistUpdateComponent,
data: {
meta: {
title: $localize`Update playlist`
}
}
redirectTo: '/my-library/video-playlists/update/:videoPlaylistId',
pathMatch: 'full'
},

{
path: 'videos',
component: MyAccountVideosComponent,
data: {
meta: {
title: $localize`Account videos`
},
reuse: {
enabled: true,
key: 'my-account-videos-list'
}
}
redirectTo: '/my-library/videos',
pathMatch: 'full'
},
{
path: 'video-imports',
component: MyAccountVideoImportsComponent,
data: {
meta: {
title: $localize`Account video imports`
}
}
redirectTo: '/my-library/video-imports',
pathMatch: 'full'
},
{
path: 'subscriptions',
component: MyAccountSubscriptionsComponent,
data: {
meta: {
title: $localize`Account subscriptions`
}
}
redirectTo: '/my-library/subscriptions',
pathMatch: 'full'
},
{
path: 'ownership',
component: MyAccountOwnershipComponent,
data: {
meta: {
title: $localize`Ownership changes`
}
}
redirectTo: '/my-library/ownership',
pathMatch: 'full'
},
{
path: 'blocklist/accounts',
Expand All @@ -144,16 +97,8 @@ const myAccountRoutes: Routes = [
},
{
path: 'history/videos',
component: MyAccountHistoryComponent,
data: {
meta: {
title: $localize`Videos history`
},
reuse: {
enabled: true,
key: 'my-videos-history-list'
}
}
redirectTo: '/my-library/history/videos',
pathMatch: 'full'
},
{
path: 'notifications',
Expand Down
84 changes: 10 additions & 74 deletions client/src/app/+my-account/my-account.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Component, OnInit } from '@angular/core'
import { AuthService, AuthUser, ScreenService, ServerService } from '@app/core'
import { ServerConfig } from '@shared/models'
import { AuthUser, ScreenService } from '@app/core'
import { TopMenuDropdownParam } from '../shared/shared-main/misc/top-menu-dropdown.component'

@Component({
Expand All @@ -12,11 +11,7 @@ export class MyAccountComponent implements OnInit {
menuEntries: TopMenuDropdownParam[] = []
user: AuthUser

private serverConfig: ServerConfig

constructor (
private serverService: ServerService,
private authService: AuthService,
private screenService: ScreenService
) { }

Expand All @@ -25,67 +20,12 @@ export class MyAccountComponent implements OnInit {
}

ngOnInit (): void {
this.serverConfig = this.serverService.getTmpConfig()
this.serverService.getConfig()
.subscribe(config => this.serverConfig = config)

this.user = this.authService.getUser()

this.authService.userInformationLoaded.subscribe(
() => this.buildMenu()
)
}

isVideoImportEnabled () {
const importConfig = this.serverConfig.import.videos

return importConfig.http.enabled || importConfig.torrent.enabled
this.buildMenu()
}

private buildMenu () {
const libraryEntries: TopMenuDropdownParam = {
label: $localize`My library`,
children: [
{
label: $localize`My channels`,
routerLink: '/my-account/video-channels',
iconName: 'channel'
},
{
label: $localize`My videos`,
routerLink: '/my-account/videos',
iconName: 'videos',
isDisplayed: () => this.user.canSeeVideosLink
},
{
label: $localize`My playlists`,
routerLink: '/my-account/video-playlists',
iconName: 'playlists'
},
{
label: $localize`My subscriptions`,
routerLink: '/my-account/subscriptions',
iconName: 'subscriptions'
},
{
label: $localize`My history`,
routerLink: '/my-account/history/videos',
iconName: 'history'
}
]
}

if (this.isVideoImportEnabled()) {
libraryEntries.children.push({
label: 'My imports',
routerLink: '/my-account/video-imports',
iconName: 'cloud-download',
isDisplayed: () => this.user.canSeeVideosLink
})
}

const miscEntries: TopMenuDropdownParam = {
label: $localize`Misc`,
const moderationEntries: TopMenuDropdownParam = {
label: $localize`Moderation`,
children: [
{
label: $localize`Muted accounts`,
Expand All @@ -98,29 +38,25 @@ export class MyAccountComponent implements OnInit {
iconName: 'peertube-x'
},
{
label: $localize`My abuse reports`,
label: $localize`Abuse reports`,
routerLink: '/my-account/abuses',
iconName: 'flag'
},
{
label: $localize`Ownership changes`,
routerLink: '/my-account/ownership',
iconName: 'download'
}
]
}

this.menuEntries = [
{
label: $localize`My settings`,
label: $localize`Settings`,
routerLink: '/my-account/settings'
},

{
label: $localize`My notifications`,
label: $localize`Notifications`,
routerLink: '/my-account/notifications'
},
libraryEntries,
miscEntries

moderationEntries
]
}
}
Loading

0 comments on commit 17119e4

Please sign in to comment.