Commit 4e5d6aef authored by Emiliano Balbuena's avatar Emiliano Balbuena

(chore): Owner/Standalone links

1 merge request!507WIP: (feat): Minds Pro (development branch) - Release 3
Pipeline #77439823 running with stages
......@@ -63,28 +63,45 @@
i18n
>Communities</a>
<a
class="m-proChannelTopbar__navItem"
[routerLink]="donateRouterLink"
routerLinkActive="active"
i18n
>Donate</a>
<ng-container *ngIf="currentUser?.guid != channel.guid; else ownerNavLinks">
<a
class="m-proChannelTopbar__navItem"
[routerLink]="donateRouterLink"
routerLinkActive="active"
i18n
>Donate</a>
<button
class="m-proChannelTopbar__subscribe"
[class.m-proChannelTopbar__subscribe--subscribed]="channel.subscribed"
(click)="toggleSubscription($event)"
>
<span class="m-proChannelTopbar__subscribe--label">
<ng-container *ngIf="!channel.subscribed; else subscribedActionButton" i18n>Subscribe</ng-container>
<ng-template #subscribedActionButton><ng-container i18n>Subscribed</ng-container></ng-template>
</span>
<button
class="m-proChannelTopbar__subscribe"
[class.m-proChannelTopbar__subscribe--subscribed]="channel.subscribed"
(click)="toggleSubscription($event)"
[hidden]="currentUser?.guid === channel.guid"
>
<span class="m-proChannelTopbar__subscribe--label">
<ng-container *ngIf="!channel.subscribed; else subscribedActionButton" i18n>Subscribe</ng-container>
<ng-template #subscribedActionButton><ng-container i18n>Subscribed</ng-container></ng-template>
</span>
<span class="m-proChannelTopbar__subscribe--counter">
{{ subscribersCount | abbr:0 }}
</span>
</button>
</ng-container>
<ng-template #ownerNavLinks>
<a
*ngIf="isStandalone"
class="m-proChannelTopbar__navItem"
[href]="proSettingsHref"
target="root_minds"
i18n
>Settings</a>
<span class="m-proChannelTopbar__subscribe--counter">
{{ subscribersCount | abbr:0 }}
</span>
</button>
<a
*ngIf="!isStandalone"
class="m-proChannelTopbar__navItem"
[routerLink]="proSettingsLink"
i18n
>Settings</a>
</ng-template>
</ng-container>
<div class="m-proChannelTopbar_menu m-dropdown">
......
......@@ -83,7 +83,13 @@ export class ProChannelComponent implements OnInit, AfterViewInit, OnDestroy {
this.listen();
this.onResize();
this.isLoggedIn$ = this.session.loggedinEmitter.subscribe(() => this.detectChanges());
this.isLoggedIn$ = this.session.loggedinEmitter.subscribe(is => {
if (!is && this.channel) {
this.channel.subscribed = false;
}
this.detectChanges();
});
}
ngAfterViewInit() {
......@@ -329,4 +335,16 @@ export class ProChannelComponent implements OnInit, AfterViewInit, OnDestroy {
get donateRouterLink() {
return this.channelService.getRouterLink('donate');
}
get proSettingsLink() {
return ['/pro/settings'];
}
get proSettingsHref() {
return window.Minds.site_url + 'pro/settings';
}
get isStandalone() {
return Boolean(window.Minds.pro);
}
}
......@@ -18,8 +18,25 @@
>{{link.title}}</a>
<ng-container *ngIf="session.getLoggedInUser()">
<span style="position: relative">
<minds-button-user-dropdown [user]="user" *ngIf="session.getLoggedInUser().guid != user.guid"></minds-button-user-dropdown>
</span>
<ng-container *ngIf="isStandalone">
<a
class="m-pro--channel-footer--link"
[href]="viewProfileHref"
target="_blank"
i18n
>@{{currentUsername}}</a>
<a
class="m-pro--channel-footer--link"
(click)="logout()"
i18n
>Logout</a>
</ng-container>
<ng-container *ngIf="!isOwner">
<span style="position: relative">
<minds-button-user-dropdown [user]="user"></minds-button-user-dropdown>
</span>
</ng-container>
</ng-container>
</div>
......@@ -12,6 +12,7 @@
}
a {
cursor: pointer;
text-decoration: none;
padding: 0 16px;
......
......@@ -259,6 +259,10 @@ export class ProChannelFooterComponent {
return domClass;
}
logout() {
this._session.logout();
}
private getSocialProfileMeta(key: string): SocialProfileMeta {
let defaultMeta: SocialProfileMeta = {
key: '', label: '',
......@@ -285,4 +289,20 @@ export class ProChannelFooterComponent {
get session() {
return this._session;
}
get isOwner() {
return this.session.getLoggedInUser() && this.session.getLoggedInUser().guid == this.user.guid;
}
get currentUsername() {
return this.session.getLoggedInUser().username;
}
get viewProfileHref() {
return window.Minds.site_url + this.session.getLoggedInUser().username;
}
get isStandalone() {
return Boolean(window.Minds.pro);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment