Skip to content
Projects
Groups
Snippets
Help
Sign in / Register
Toggle navigation
Minds Frontend
Project overview
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
808
Merge Requests
55
CI / CD
Security & Compliance
Packages
Wiki
Snippets
Members
Collapse sidebar
Close sidebar
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Frontend
Commits
16f1375c
Commit
16f1375c
authored
1 day ago
by
Olivia Madrid
Browse files
Options
Download
(refactor): sidebar menu is now only populated with a menu object as input
parent
57c998dd
pro-settings-2163
1 merge request
!638
Refactor PRO settings
Pipeline
#96340114
failed with stages
in 32 minutes and 43 seconds
Changes
15
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
92 additions
and
168 deletions
+92
-168
src/app/common/components/page-layout/page-layout.component.html
View file @
16f1375c
<m-sidebarMenu
[menu
Id]=
"menuId"
[menuObj]=
"menuObj
"
></m-sidebarMenu>
<m-sidebarMenu
[menu
]=
"menu
"
></m-sidebarMenu>
<section
class=
"m-pageLayout__main"
>
<ng-content
select=
"[m-pageLayout__main]"
></ng-content>
</section>
This diff is collapsed.
src/app/common/components/page-layout/page-layout.component.spec.ts
View file @
16f1375c
...
...
@@ -8,8 +8,7 @@ import { PageLayoutComponent } from './page-layout.component';
})
class
SidebarMenuComponentMock
{
@
Input
()
catId
;
@
Input
()
menuId
;
@
Input
()
menuObj
;
@
Input
()
menu
;
}
describe
(
'
PageLayoutComponent
'
,
()
=>
{
...
...
This diff is collapsed.
src/app/common/components/page-layout/page-layout.component.ts
View file @
16f1375c
import
{
Component
,
OnInit
,
Input
,
HostBinding
}
from
'
@angular/core
'
;
import
{
Menu
}
from
'
../sidebar-menu/sidebar-menu.component
'
;
@
Component
({
selector
:
'
m-pageLayout
'
,
templateUrl
:
'
./page-layout.component.html
'
,
})
export
class
PageLayoutComponent
implements
OnInit
{
@
Input
()
menuId
:
string
;
// TODO remove this and use menuObj in analytics
@
Input
()
menuObj
:
any
;
@
Input
()
menu
:
Menu
;
@
HostBinding
(
'
class.isForm
'
)
@
Input
()
isForm
:
boolean
=
false
;
constructor
()
{}
...
...
This diff is collapsed.
src/app/common/components/sidebar-menu/sidebar-menu-categories.default.ts
deleted
100644 → 0
View file @
57c998dd
const
sidebarMenuCategories
=
[
{
header
:
{
id
:
'
analytics
'
,
label
:
'
Analytics
'
,
path
:
'
/analytics/dashboard/
'
,
permissions
:
[
'
admin
'
,
'
user
'
],
},
links
:
[
{
id
:
'
summary
'
,
label
:
'
Summary
'
,
permissions
:
[
'
admin
'
],
},
{
id
:
'
traffic
'
,
label
:
'
Traffic
'
,
permissions
:
[
'
admin
'
,
'
user
'
],
},
{
id
:
'
earnings
'
,
label
:
'
Earnings
'
,
permissions
:
[
'
admin
'
,
'
user
'
],
},
{
id
:
'
engagement
'
,
label
:
'
Engagement
'
,
permissions
:
[
'
admin
'
,
'
user
'
],
// path: '/some/path/outside/header/path',
},
{
id
:
'
trending
'
,
label
:
'
Trending
'
,
permissions
:
[
'
admin
'
,
'
user
'
],
},
// {
// id: 'referrers',
// label: 'Referrers',
// permissions: ['admin', 'user'],
// },
// {
// id: 'plus',
// label: 'Plus',
// permissions: ['admin'],
// },
// {
// id: 'pro',
// label: 'Pro',
// permissions: ['admin'],
// {
// id: 'boost',
// label: 'Boost',
// permissions: ['admin'],
// },
// {
// id: 'nodes',
// label: 'Nodes',
// permissions: ['admin'],
// },
],
},
];
export
default
sidebarMenuCategories
;
This diff is collapsed.
src/app/common/components/sidebar-menu/sidebar-menu.component.spec.ts
View file @
16f1375c
...
...
@@ -4,7 +4,7 @@ import { RouterTestingModule } from '@angular/router/testing';
import
{
Session
}
from
'
../../../services/session
'
;
import
{
sessionMock
}
from
'
../../../../tests/session-mock.spec
'
;
import
{
SidebarMenuComponent
}
from
'
./sidebar-menu.component
'
;
import
sidebarMenu
s
from
'
./sidebar-menus
.default
'
;
import
sidebarMenu
from
'
../../../modules/pro/settings/sidebar-menu
.default
'
;
describe
(
'
SidebarMenuComponent
'
,
()
=>
{
let
component
:
SidebarMenuComponent
;
...
...
@@ -21,7 +21,7 @@ describe('SidebarMenuComponent', () => {
beforeEach
(()
=>
{
fixture
=
TestBed
.
createComponent
(
SidebarMenuComponent
);
component
=
fixture
.
componentInstance
;
component
.
menu
Id
=
'
analytics
'
;
component
.
menu
=
sidebarMenu
;
// component.user = sessionMock.user;
fixture
.
detectChanges
();
});
...
...
This diff is collapsed.
src/app/common/components/sidebar-menu/sidebar-menu.component.ts
View file @
16f1375c
import
{
Component
,
OnInit
,
Input
}
from
'
@angular/core
'
;
import
{
ActivatedRoute
}
from
'
@angular/router
'
;
import
{
Session
}
from
'
../../../services/session
'
;
import
sidebarMenus
from
'
./sidebar-menus.default
'
;
interface
Menu
{
header
:
MenuLink
;
...
...
@@ -25,10 +24,8 @@ export { MenuLink };
templateUrl
:
'
./sidebar-menu.component.html
'
,
})
export
class
SidebarMenuComponent
implements
OnInit
{
@
Input
()
menuId
:
string
;
@
Input
()
menuObj
:
Menu
;
@
Input
()
menu
:
Menu
;
menu
:
Menu
;
mobileMenuExpanded
=
false
;
minds
:
Minds
;
user
;
...
...
@@ -39,9 +36,6 @@ export class SidebarMenuComponent implements OnInit {
ngOnInit
()
{
this
.
minds
=
window
.
Minds
;
this
.
user
=
this
.
session
.
getLoggedInUser
();
this
.
menu
=
this
.
menuObj
?
this
.
menuObj
:
sidebarMenus
.
find
(
menu
=>
menu
.
header
.
id
===
this
.
menuId
);
this
.
getUserRoles
();
this
.
grantPermissions
();
}
...
...
@@ -66,11 +60,11 @@ export class SidebarMenuComponent implements OnInit {
?
this
.
checkForRoleMatch
(
link
.
permissions
)
:
true
;
if
(
link
.
id
===
'
:user
'
)
{
if
(
link
.
id
===
'
:user
name
'
)
{
link
.
id
=
this
.
user
.
username
;
}
if
(
link
.
path
)
{
link
.
path
=
link
.
path
.
replace
(
'
:user
'
,
this
.
user
.
username
);
link
.
path
=
link
.
path
.
replace
(
'
:user
name
'
,
this
.
user
.
username
);
}
});
}
...
...
This diff is collapsed.
src/app/common/components/sidebar-menu/sidebar-menus.default.ts
deleted
100644 → 0
View file @
57c998dd
const
sidebarMenus
=
[
{
header
:
{
id
:
'
analytics
'
,
label
:
'
Analytics
'
,
path
:
'
/analytics/dashboard/
'
,
permissions
:
[
'
admin
'
,
'
user
'
],
},
links
:
[
{
id
:
'
summary
'
,
label
:
'
Summary
'
,
permissions
:
[
'
admin
'
],
},
{
id
:
'
traffic
'
,
label
:
'
Traffic
'
,
permissions
:
[
'
admin
'
,
'
user
'
],
},
{
id
:
'
earnings
'
,
label
:
'
Earnings
'
,
permissions
:
[
'
admin
'
,
'
user
'
],
},
{
id
:
'
engagement
'
,
label
:
'
Engagement
'
,
permissions
:
[
'
admin
'
,
'
user
'
],
// path: '/some/path/outside/analytics/dashboard',
},
{
id
:
'
trending
'
,
label
:
'
Trending
'
,
permissions
:
[
'
admin
'
,
'
user
'
],
},
// {
// id: 'referrers',
// label: 'Referrers',
// permissions: ['admin', 'user'],
// },
// {
// id: 'plus',
// label: 'Plus',
// permissions: ['admin'],
// },
// {
// id: 'pro',
// label: 'Pro',
// permissions: ['admin'],
// {
// id: 'boost',
// label: 'Boost',
// permissions: ['admin'],
// },
// {
// id: 'nodes',
// label: 'Nodes',
// permissions: ['admin'],
// },
],
},
];
export
default
sidebarMenus
;
This diff is collapsed.
src/app/modules/analytics/v2/dashboard.component.html
View file @
16f1375c
<m-pageLayout
menuId=
"analytics
"
>
<m-pageLayout
[menu]=
"menu
"
>
<div
class=
"m-analyticsDashboard"
*ngIf=
"ready$ | async"
m-pageLayout__main
>
<m-dashboardLayout>
<ng-container
m-dashboardLayout__header
>
...
...
This diff is collapsed.
src/app/modules/analytics/v2/dashboard.component.ts
View file @
16f1375c
...
...
@@ -16,6 +16,8 @@ import { Session } from '../../../services/session';
import
{
AnalyticsDashboardService
}
from
'
./dashboard.service
'
;
import
{
Filter
}
from
'
./../../../interfaces/dashboard
'
;
import
sidebarMenu
from
'
./sidebar-menu.default
'
;
import
{
Menu
}
from
'
../../../common/components/sidebar-menu/sidebar-menu.component
'
;
@
Component
({
selector
:
'
m-analytics__dashboard
'
,
...
...
@@ -24,6 +26,7 @@ import { Filter } from './../../../interfaces/dashboard';
providers
:
[
AnalyticsDashboardService
],
})
export
class
AnalyticsDashboardComponent
implements
OnInit
,
OnDestroy
{
menu
:
Menu
=
sidebarMenu
;
paramsSubscription
:
Subscription
;
ready$
=
this
.
analyticsService
.
ready$
;
...
...
This diff is collapsed.
src/app/modules/analytics/v2/sidebar-menu.default.ts
0 → 100644
View file @
16f1375c
const
sidebarMenu
=
{
header
:
{
id
:
'
analytics
'
,
label
:
'
Analytics
'
,
permissions
:
[
'
admin
'
,
'
user
'
],
},
links
:
[
{
id
:
'
summary
'
,
label
:
'
Summary
'
,
permissions
:
[
'
admin
'
],
// path: '/some/path/outside/analytics/dashboard',
},
{
id
:
'
traffic
'
,
label
:
'
Traffic
'
,
permissions
:
[
'
admin
'
,
'
user
'
],
},
{
id
:
'
earnings
'
,
label
:
'
Earnings
'
,
permissions
:
[
'
admin
'
,
'
user
'
],
},
{
id
:
'
engagement
'
,
label
:
'
Engagement
'
,
permissions
:
[
'
admin
'
,
'
user
'
],
},
{
id
:
'
trending
'
,
label
:
'
Trending
'
,
permissions
:
[
'
admin
'
,
'
user
'
],
},
// {
// id: 'referrers',
// label: 'Referrers',
// permissions: ['admin', 'user'],
// },
// {
// id: 'plus',
// label: 'Plus',
// permissions: ['admin'],
// },
// {
// id: 'pro',
// label: 'Pro',
// permissions: ['admin'],
// {
// id: 'boost',
// label: 'Boost',
// permissions: ['admin'],
// },
// {
// id: 'nodes',
// label: 'Nodes',
// permissions: ['admin'],
// },
],
};
export
default
sidebarMenu
;
This diff is collapsed.
src/app/modules/pro/channel/hamburger-menu/hamburger-menu.component.html
View file @
16f1375c
...
...
@@ -23,7 +23,7 @@
<m-pro
__subscribeButton
(onAction)=
"closeMenu()"
></m-pro
__subscribeButton
>
</li>
<li>
<li
class=
"m-proHamburgerMenu__linkWrapper"
>
<a
[routerLink]=
"feedRouterLink"
routerLinkActive=
"m-proHamburgerMenu__item--active"
...
...
@@ -91,7 +91,7 @@
<li
class=
"m-proHamburgerMenu__spacer"
></li>
<ng-container
*ngIf=
"items && items.length"
>
<li
*ngFor=
"let item of items"
>
<li
*ngFor=
"let item of items"
class=
"m-proHamburgerMenu__linkWrapper"
>
<a
[class.m-proHamburgerMenu__item--active]=
"item.isActive()"
(click)=
"item.onClick(); closeMenu()"
...
...
This diff is collapsed.
src/app/modules/pro/channel/hamburger-menu/hamburger-menu.component.scss
View file @
16f1375c
...
...
@@ -26,6 +26,7 @@ m-pro__hamburger-menu {
top
:
30px
;
right
:
40px
;
padding
:
8px
;
cursor
:
pointer
;
}
>
ul
{
...
...
@@ -47,7 +48,9 @@ m-pro__hamburger-menu {
text-transform
:
uppercase
;
font-weight
:
700
;
letter-spacing
:
1px
;
&
.m-proHamburgerMenu__linkWrapper
{
cursor
:
pointer
;
}
&
.m-proHamburgerMenu__logo
{
height
:
100px
;
...
...
@@ -114,3 +117,7 @@ m-pro__hamburger-menu {
body
.hamburger-menu--open
{
overflow
:
hidden
;
}
.m-proHamburgerMenu__trigger
{
cursor
:
pointer
;
}
This diff is collapsed.
src/app/modules/pro/settings/settings.component.html
View file @
16f1375c
<m-pageLayout
[menu
Obj]=
"menuObj
"
[isForm]=
"true"
>
<m-pageLayout
[menu
]=
"menu
"
[isForm]=
"true"
>
<ng-container
m-pageLayout__main
*ngIf=
"settings"
>
<m-shadowboxLayout
[scrollableHeader]=
"false"
...
...
This diff is collapsed.
src/app/modules/pro/settings/settings.component.ts
View file @
16f1375c
...
...
@@ -33,7 +33,7 @@ import {
templateUrl
:
'
settings.component.html
'
,
})
export
class
ProSettingsComponent
implements
OnInit
,
OnDestroy
{
menu
Obj
:
Menu
=
sidebarMenu
;
menu
:
Menu
=
sidebarMenu
;
activeTab
:
any
;
tabs
=
[
{
...
...
@@ -152,7 +152,6 @@ export class ProSettingsComponent implements OnInit, OnDestroy {
if
(
this
.
session
.
isAdmin
())
{
this
.
user
=
params
.
get
(
'
username
'
)
||
null
;
this
.
updatePreviewRoute
();
}
this
.
detectChanges
();
...
...
@@ -167,16 +166,6 @@ export class ProSettingsComponent implements OnInit, OnDestroy {
});
}
updatePreviewRoute
()
{
const
previewRouteLink
=
this
.
menuObj
.
links
.
find
(
link
=>
link
.
id
===
'
:user
'
);
if
(
previewRouteLink
)
{
previewRouteLink
.
path
=
`pro/
${
this
.
user
}
`
;
this
.
detectChanges
();
}
}
ngOnDestroy
()
{
this
.
paramMap$
.
unsubscribe
();
this
.
formChanges$
.
unsubscribe
();
...
...
This diff is collapsed.
src/app/modules/pro/settings/sidebar-menu.default.ts
View file @
16f1375c
...
...
@@ -2,7 +2,6 @@ const sidebarMenu = {
header
:
{
id
:
'
pro_settings
'
,
label
:
'
Pro Settings
'
,
path
:
'
/pro/:username/settings/
'
,
permissions
:
[
'
pro
'
],
},
links
:
[
...
...
@@ -30,19 +29,19 @@ const sidebarMenu = {
id
:
'
domain
'
,
label
:
'
Domain
'
,
},
{
id
:
'
payouts
'
,
label
:
'
Payouts
'
,
},
{
id
:
'
subscription
'
,
label
:
'
Pro Subscription
'
,
path
:
'
pro
'
,
},
{
id
:
'
payouts
'
,
label
:
'
Payouts
'
,
},
{
id
:
'
:user
'
,
id
:
'
:username
'
,
label
:
'
View Pro Channel
'
,
path
:
'
pro/:user
'
,
path
:
'
pro/:user
name
'
,
newWindow
:
true
,
},
],
...
...
This diff is collapsed.
Please
register
or
sign in
to comment