Commit e587a303 authored by Mark Harding's avatar Mark Harding

(feat): adds metrics to posts

No related merge requests found
Pipeline #115209381 failed with stages
in 12 minutes and 27 seconds
......@@ -8,7 +8,7 @@
i {
font-size: 32px;
@include m-theme() {
color: themed($m-textColor--secondary);
color: themed($m-textColor--tertiary);
}
}
}
<m-activity__ownerBlock *ngIf="service.displayOptions.showOwnerBlock">
<ng-container class="m-activityOwnerBlock__right">
<m-activity__metrics></m-activity__metrics>
<m-activity__menu></m-activity__menu>
</ng-container>
</m-activity__ownerBlock>
......
......@@ -20,6 +20,7 @@ import { LegacyModule } from '../../legacy/legacy.module';
import { ActivityMenuComponent } from './menu/menu.component';
import { PostMenuModule } from '../../../common/components/post-menu/post-menu.module';
import { ActivityNsfwConsentComponent } from './nsfw-consent/nsfw-consent.component';
import { ActivityMetricsComponent } from './metrics/metrics.component';
@NgModule({
imports: [
......@@ -43,6 +44,7 @@ import { ActivityNsfwConsentComponent } from './nsfw-consent/nsfw-consent.compon
ActivityToolbarComponent,
ActivityMenuComponent,
ActivityNsfwConsentComponent,
ActivityMetricsComponent,
],
providers: [],
exports: [ActivityComponent],
......
......@@ -33,6 +33,7 @@ export type ActivityEntity = {
ephemeral?: boolean;
nsfw: Array<number>;
paywall: boolean;
impressions: number;
};
@Injectable()
......
<span class="m-activityMetrics__views">{{ views | async }} views</span>
m-activity__metrics > span {
font-size: 14px;
@include m-theme() {
color: themed($m-textColor--tertiary);
}
}
import {
Component,
HostListener,
ViewChild,
Input,
ElementRef,
} from '@angular/core';
import { Observable } from 'rxjs';
import { ActivityService, ActivityEntity } from '../activity.service';
import { map } from 'rxjs/operators';
@Component({
selector: 'm-activity__metrics',
templateUrl: 'metrics.component.html',
})
export class ActivityMetricsComponent {
views: Observable<number> = this.service.entity$.pipe(
map((entity: ActivityEntity) => {
return entity.impressions;
})
);
constructor(public service: ActivityService) {}
}
......@@ -56,7 +56,7 @@
</ng-container>
</div>
<div class=".m-activityOwnerBlock__right">
<div class="m-activityOwnerBlock__right">
<ng-content select=".m-activityOwnerBlock__right"></ng-content>
</div>
......
......@@ -32,6 +32,12 @@ m-activity__ownerBlock {
}
}
.m-activityOwnerBlock__right {
display: inline-flex;
align-items: center;
flex-direction: row;
}
.m-activityOwnerBlock__displayName {
display: block;
font-size: 16px;
......
Please register or to comment