Commit 1a2794da authored by Mark Harding's avatar Mark Harding

(fix): linting

1 merge request!770WIP: #2546 Pro UI unified tiles
Pipeline #119606564 failed with stages
in 12 minutes and 1 second
......@@ -38,7 +38,7 @@ export class MindsRichEmbed {
private cd: ChangeDetectorRef,
protected featureService: FeaturesService,
private mediaProxy: MediaProxyService,
private configs: ConfigsService,
private configs: ConfigsService
) {}
set _src(value: any) {
......@@ -154,8 +154,7 @@ export class MindsRichEmbed {
// Minds blog
const siteUrl = this.configs.get('site_url');
if (url.indexOf(siteUrl) === 0)
this.mediaSource = 'minds';
if (url.indexOf(siteUrl) === 0) this.mediaSource = 'minds';
// YouTube
let youtube = /^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/i;
......
......@@ -49,14 +49,15 @@ m-activity__content {
&.m-activityContent__message--short {
line-height: 34px;
font-size: 28px;
}
}
}
}
.m-activity--noOwnerBlock .m-activityContent__message {
padding-top: 16px;
}
.m-activityContent__message, .m-activityContent__mediaDescription {
.m-activityContent__message,
.m-activityContent__mediaDescription {
@include m-theme() {
color: themed($m-textColor--primary);
}
......
......@@ -85,9 +85,13 @@ export class ActivityContentComponent {
if (this.mediaDescription) return '';
// No message if the same as blog title
if (this.entity.perma_url && (!this.entity.message || this.entity.title === this.entity.message)) return '';
if (
this.entity.perma_url &&
(!this.entity.message || this.entity.title === this.entity.message)
)
return '';
return (this.entity.message || this.entity.title);
return this.entity.message || this.entity.title;
}
get isRichEmbed(): boolean {
......@@ -96,7 +100,7 @@ export class ActivityContentComponent {
get mediaDescription(): string {
return this.isImage || this.isVideo
? (this.entity.message || this.entity.title)
? this.entity.message || this.entity.title
: '';
}
......@@ -111,7 +115,9 @@ export class ActivityContentComponent {
get isImage(): boolean {
return (
this.entity.custom_type == 'batch' ||
(this.entity.thumbnail_src && !this.entity.perma_url && this.entity.custom_type !== 'video')
(this.entity.thumbnail_src &&
!this.entity.perma_url &&
this.entity.custom_type !== 'video')
);
}
......@@ -142,7 +148,7 @@ export class ActivityContentComponent {
get videoHeight(): string {
if (!this.mediaEl) return '';
const height = this.mediaEl.nativeElement.clientWidth / (16/9);
const height = this.mediaEl.nativeElement.clientWidth / (16 / 9);
return `${height}px`;
}
......
<span class="m-activityMetrics__views" *ngIf="views$ | async as views">{{ views | number }} views</span>
<span class="m-activityMetrics__views" *ngIf="views$ | async as views"
>{{ views | number }} views</span
>
......@@ -39,7 +39,8 @@ m-activity__toolbar {
minds-button-comment {
cursor: pointer;
.selected i.material-icons, .selected .minds-counter {
.selected i.material-icons,
.selected .minds-counter {
@include m-theme() {
color: themed($m-grey-500);
}
......
......@@ -27,8 +27,8 @@ export class ActivityToolbarComponent {
}
toggleComments(): void {
this.service.displayOptions.showComments = !this.service.displayOptions.showComments;
this.service.displayOptions.showComments = !this.service.displayOptions
.showComments;
this.service.displayOptions.showOnlyCommentsInput = false;
}
}
<div class="m-feedGrid__column" *ngFor="let entities of columns">
<ng-container *ngFor="let entity$ of entities; let i = index">
<m-newsfeed__entity [entity]="entity" *ngIf="entity$ | async as entity" [displayOptions]="{ showComments: false, v2: true }" [slot]="i"></m-newsfeed__entity>
</ng-container>
<ng-container *ngFor="let entity$ of entities; let i = index">
<m-newsfeed__entity
[entity]="entity"
*ngIf="entity$ | async as entity"
[displayOptions]="{ showComments: false, v2: true }"
[slot]="i"
></m-newsfeed__entity>
</ng-container>
</div>
m-feedGrid {
display: flex;
flex-direction: row;
list-style: none;
padding: 0;
display: flex;
flex-direction: row;
list-style: none;
padding: 0;
}
.m-feedGrid__column {
flex: 1;
margin-right: $minds-margin *2;
margin-right: $minds-margin * 2;
&:last-of-type() {
margin-right: 0;
......@@ -15,6 +15,6 @@ m-feedGrid {
> m-newsfeed__entity {
display: block;
margin-bottom: $minds-margin *2;
margin-bottom: $minds-margin * 2;
}
}
import { Component, Input, Inject, PLATFORM_ID, ChangeDetectorRef } from '@angular/core';
import {
Component,
Input,
Inject,
PLATFORM_ID,
ChangeDetectorRef,
} from '@angular/core';
import { isPlatformServer } from '@angular/common';
import { Observable, Subject, combineLatest, Subscription, fromEvent } from 'rxjs';
import {
Observable,
Subject,
combineLatest,
Subscription,
fromEvent,
} from 'rxjs';
import { map, debounceTime } from 'rxjs/operators';
import isMobile from '../../../helpers/is-mobile';
......@@ -11,7 +23,6 @@ const MIN_COLUMN_SIZE: number = 300;
templateUrl: './feed-grid.component.html',
})
export class FeedGridComponent {
@Input() maxColumns = 3;
columnCount$: Subject<number> = new Subject();
@Input('entities') entities$;
......@@ -21,17 +32,19 @@ export class FeedGridComponent {
columnsSubscription: Subscription;
windowResizeSubscription: Subscription;
constructor(@Inject(PLATFORM_ID) private platformId: Object, private cd: ChangeDetectorRef) {}
constructor(
@Inject(PLATFORM_ID) private platformId: Object,
private cd: ChangeDetectorRef
) {}
ngOnInit() {
this.columns$ = combineLatest(this.entities$, this.columnCount$)
.pipe(
map(([ entities, columnCount]: [[any],number]) => {
this.columns$ = combineLatest(this.entities$, this.columnCount$).pipe(
map(([entities, columnCount]: [[any], number]) => {
let cols = [];
for (let i = 0; i < columnCount; ++i) {
cols.push([]);
}
let currentCol = -1;
for (let entity of entities) {
++currentCol;
......@@ -51,9 +64,9 @@ export class FeedGridComponent {
this.windowResizeSubscription = fromEvent(window, 'resize')
.pipe(debounceTime(300))
.subscribe((event) => {
.subscribe(event => {
this.calculateColumnCount();
});
});
this.calculateColumnCount();
}
......@@ -61,16 +74,18 @@ export class FeedGridComponent {
ngOnDestroy() {
this.columnsSubscription.unsubscribe();
this.windowResizeSubscription.unsubscribe();
}
}
calculateColumnCount(): void {
if (isPlatformServer(this.platformId)) {
this.columnCount$.next(isMobile() ? 1 : this.maxColumns);
this.columnCount$.next(isMobile() ? 1 : this.maxColumns);
} else {
let columns: number = this.maxColumns;
const maxCanFit: number = Math.max(1, Math.round(window.innerWidth / (MIN_COLUMN_SIZE * 1.25)));
const maxCanFit: number = Math.max(
1,
Math.round(window.innerWidth / (MIN_COLUMN_SIZE * 1.25))
);
this.columnCount$.next(Math.min(maxCanFit, this.maxColumns));
}
}
}
......@@ -7,18 +7,22 @@
</ng-container>
<ng-container *ngSwitchDefault>
<m-activity [entity]="entity" [displayOptions]="displayOptions" *ngIf="displayOptions.v2 === true; else v1">
<m-activity
[entity]="entity"
[displayOptions]="displayOptions"
*ngIf="displayOptions.v2 === true; else v1"
>
</m-activity>
<ng-template #v1>
<minds-activity
[object]="entity"
[boostToggle]="entity.boostToggle"
(delete)="delete(entity)"
[showRatingToggle]="true"
[slot]="slot"
class="mdl-card m-border item"
[attr.data-minds-activity-guid]="entity.guid"
></minds-activity>
<minds-activity
[object]="entity"
[boostToggle]="entity.boostToggle"
(delete)="delete(entity)"
[showRatingToggle]="true"
[slot]="slot"
class="mdl-card m-border item"
[attr.data-minds-activity-guid]="entity.guid"
></minds-activity>
</ng-template>
</ng-container>
</ng-container>
<div class="m-proChannelList__content">
<m-feedGrid [maxColumns]="3" [entities]="entities$">
</m-feedGrid>
<m-feedGrid [maxColumns]="3" [entities]="entities$"> </m-feedGrid>
<infinite-scroll
*ngIf="canAutoScroll"
......
......@@ -26,7 +26,8 @@ import { OverlayModalService } from '../../../../services/ux/overlay-modal';
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [FeedsService],
})
export class ProChannelContentListComponent implements OnInit, OnDestroy, OnChanges {
export class ProChannelContentListComponent
implements OnInit, OnDestroy, OnChanges {
@Input() canAutoScroll = true;
@Input() category: string;
@Input() limit: number = 12;
......@@ -56,8 +57,7 @@ export class ProChannelContentListComponent implements OnInit, OnDestroy, OnChan
this.load(true);
}
ngOnDestroy() {
}
ngOnDestroy() {}
async load(refresh: boolean = false) {
if (refresh) {
......@@ -76,7 +76,7 @@ export class ProChannelContentListComponent implements OnInit, OnDestroy, OnChan
params.query = this.query;
params.sync = 1;
}
params.force_public = 1;
let url = `api/v2/pro/content/${this.channelService.currentChannel.guid}/${this.type}`;
......
<div *ngFor="let category of categories$ | async">
<h2 i18n>
<a [routerLink]="getCategoryRoute(category.tag?.tag)">{{
category.tag?.label
}}</a>
</h2>
<h2 i18n>
<a [routerLink]="getCategoryRoute(category.tag?.tag)">{{
category.tag?.label
}}</a>
</h2>
<m-feedGrid [entities]="category.entities$" [maxColumns]="3"></m-feedGrid>
<m-feedGrid [entities]="category.entities$" [maxColumns]="3"></m-feedGrid>
</div>
......@@ -12,7 +12,6 @@ import { Client } from '../../../../../services/api/client';
templateUrl: './category-content.component.html',
})
export class ProChannelHomeCategoryContent {
categories$: BehaviorSubject<any> = new BehaviorSubject(null);
constructor(
......@@ -20,8 +19,7 @@ export class ProChannelHomeCategoryContent {
private feedsService: FeedsService,
protected channelService: ProChannelService,
protected client: Client
) {
}
) {}
ngOnInit() {
this.load();
......@@ -46,7 +44,7 @@ export class ProChannelHomeCategoryContent {
return entry;
});
this.categories$.next(categories);
}
}
getCategoryRoute(tag) {
if (!this.channelService.currentChannel || !tag) {
......@@ -55,5 +53,4 @@ export class ProChannelHomeCategoryContent {
return this.channelService.getRouterLink('all', { hashtag: tag });
}
}
......@@ -14,7 +14,7 @@
type="activities"
[limit]="12"
[canAutoScroll]="false"
>
>
</m-proChannel__contentList>
</div>
</div>
......
......@@ -11,7 +11,8 @@ m-proChannel__home {
margin-bottom: 0;
}
> h2, > m-proChannelHome__categoryContent > div > h2 {
> h2,
> m-proChannelHome__categoryContent > div > h2 {
margin: 0 0 24px;
padding: 0;
text-align: center;
......@@ -37,7 +38,7 @@ m-proChannel__home {
.m-proChannelHome__categoryContent {
width: 100%;
margin: 0 auto;
@media screen and (max-width: $max-mobile) {
width: 100%;
}
......@@ -49,7 +50,6 @@ m-proChannel__home {
}
.m-proChannelHome__featuredContent {
&.m-proChannelHome__featuredContent--prominent {
*:nth-child(1) {
grid-column: span 2;
......
......@@ -39,8 +39,7 @@ export class ProChannelListComponent implements OnInit, OnDestroy {
protected router: Router,
protected cd: ChangeDetectorRef,
protected injector: Injector
) {
}
) {}
ngOnInit() {
this.params$ = this.route.params.subscribe(params => {
......@@ -123,9 +122,7 @@ export class ProChannelListComponent implements OnInit, OnDestroy {
}
get shouldShowCategories() {
return (
this.paramsType !== 'groups' && !this.query
);
return this.paramsType !== 'groups' && !this.query;
}
detectChanges() {
......
......@@ -4,5 +4,5 @@
fixedHeight: false,
showComments: false,
showOwnerBlock: true
}"
}"
></m-activity>
Please register or to comment