Commit 653b8976 authored by Marcelo Rivera's avatar Marcelo Rivera

(fix): a couple of fixes regarding categories component

1 merge request!486WIP: (feat): Minds Pro (development branch) - Release 2
Pipeline #76205540 passed with stages
in 27 minutes and 48 seconds
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnInit } from '@angular/core';
import { ProChannelService } from "../channel.service";
import { Router } from "@angular/router";
import { MindsUser } from "../../../../interfaces/entities";
@Component({
selector: 'm-pro--channel--categories',
......@@ -22,11 +23,11 @@ export class ProCategoriesComponent implements OnInit {
@Input() type: string;
@Input() params: any = {};
get channel() {
get channel(): MindsUser {
return this.channelService.currentChannel;
}
get currentURL() {
get currentURL(): string {
return `pro/${this.channel.username}/${this.type}`
}
......
......@@ -123,17 +123,7 @@
<div class="minds-bg-overlay" (click)="closeMenu()" [hidden]="!isMenuOpen"></div>
</div>
<m-pro--channel--categories *ngIf="showCategories"></m-pro--channel--categories>
<div class="m-proChannel__categories" *ngIf="showCategories">
<div
class="m-proChannel__category"
[class.m-proChannel__selectedCategory]="!!tag.selected"
(click)="selectTag(tag)"
*ngFor="let tag of channel.pro_settings.tag_list"
>
{{tag.label}}
</div>
</div>
<m-pro--channel--categories [type]="type" *ngIf="showCategories"></m-pro--channel--categories>
<div class="m-proChannel__body">
<router-outlet></router-outlet>
......
......@@ -60,6 +60,8 @@ export class ProChannelComponent implements OnInit, OnDestroy {
subscribers_count: number;
type: string = 'articles';
constructor(
protected element: ElementRef,
protected session: Session,
......@@ -84,6 +86,10 @@ export class ProChannelComponent implements OnInit, OnDestroy {
const routes = ['images', 'videos', 'articles', 'feed', 'communities'];
this.showCategories = routes.indexOf(type) !== -1;
if (this.showCategories) {
this.type = type;
}
this.detectChanges();
}
......@@ -116,7 +122,7 @@ export class ProChannelComponent implements OnInit, OnDestroy {
this.childParams$ = this.channelService.childParamsChange.subscribe((params) => {
this.shouldShowCategories(params.type);
});
this.channelSubscription$ = this.channelService.subscriptionChange.subscribe((subscribers_count) => {
this.subscribers_count = subscribers_count;
this.load();
......@@ -178,7 +184,7 @@ export class ProChannelComponent implements OnInit, OnDestroy {
this.channelService.subscribe();
}
unsubscribe(e){
unsubscribe(e) {
this.modalService
.create(ProUnsubscribeModalComponent, this.channel,
{
......
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