Add profile picture in feed

master
Max 5 years ago
parent 9ccb389762
commit c065446515

@ -21,6 +21,9 @@
<mat-card class="post" *ngFor = "let post of childPostList" [class.selected]="post === selectedPost" tabindex="0">
<mat-card-header>
<div mat-card-avatar>
<img class="profile-picture" [src]="post.author.profilePicture"/>
</div>
<div id="button-box">
<button mat-icon-button [matMenuTriggerFor]="menu" id="menu-button" *ngIf="post.deletable">
<mat-icon>more_vert</mat-icon>

@ -8,7 +8,7 @@
outline: none
user-select: none
::ng-deep .mat-card-header-text
margin: 0px
margin-top: 10px
.mat-card-subtitle
display: contents
a:hover
@ -31,4 +31,13 @@
.span
margin-left: 32px
$mat-card-header-size: 100px !default
.profile-picture
height: $mat-card-header-size
width: $mat-card-header-size
border-radius: 50%
flex-shrink: 0
background-size: cover
transition-duration: 0.5s
z-index: 10
object-fit: cover

@ -2,10 +2,12 @@ export class Author {
id: number;
name: string;
handle: string;
profilePicture: string;
constructor(pId: number, pName: string, pHandle: string) {
constructor(pId: number, pName: string, pHandle: string, pic: string) {
this.id = pId;
this.name = pName;
this.handle = pHandle;
this.profilePicture = pic;
}
}

@ -45,6 +45,7 @@ export class FeedService {
author{
name,
handle,
profilePicture,
id},
createdAt}
}`, variables: {
@ -80,6 +81,7 @@ export class FeedService {
author{
name,
handle,
profilePicture,
id},
createdAt}
}`, variables: {
@ -214,6 +216,7 @@ export class FeedService {
author{
name,
handle,
profilePicture,
id},
createdAt}
}`, variables: {
@ -232,7 +235,13 @@ export class FeedService {
const downvotes: number = post.downvotes;
const userVote: string = post.userVote;
const deletable: boolean = post.deletable;
const author = new Author(post.author.id, post.author.name, post.author.handle);
let profilePicture: string;
if (post.author.profilePicture) {
profilePicture = environment.greenvironmentUrl + post.author.profilePicture;
} else {
profilePicture = 'assets/images/account_circle-24px.svg';
}
const author = new Author(post.author.id, post.author.name, post.author.handle, profilePicture);
const temp = new Date(Number(post.createdAt));
const date = temp.toLocaleString('en-GB');
let activity: Activity;
@ -258,7 +267,13 @@ export class FeedService {
const downvotes: number = post.downvotes;
const userVote: string = post.userVote;
const deletable: boolean = post.deletable;
const author = new Author(post.author.id, post.author.name, post.author.handle);
let profilePicture: string;
if (post.author.profilePicture) {
profilePicture = environment.greenvironmentUrl + post.author.profilePicture;
} else {
profilePicture = 'assets/images/account_circle-24px.svg';
}
const author = new Author(post.author.id, post.author.name, post.author.handle, profilePicture);
const temp = new Date(Number(post.createdAt));
const date = temp.toLocaleString('en-GB');
let activity: Activity;

@ -59,6 +59,7 @@ export class ProfileService {
author{
name,
handle,
profilePicture
id},
createdAt
}
@ -97,7 +98,13 @@ export class ProfileService {
const downvotes: number = post.downvotes;
const userVote: string = post.userVote;
const deletable: boolean = post.deletable;
const author = new Author(post.author.id, post.author.name, post.author.handle);
let profilePicture: string;
if (post.author.profilePicture) {
profilePicture = environment.greenvironmentUrl + post.author.profilePicture;
} else {
profilePicture = 'assets/images/account_circle-24px.svg';
}
const author = new Author(post.author.id, post.author.name, post.author.handle, profilePicture);
const ptemp = new Date(Number(post.createdAt));
const pdate = ptemp.toLocaleString('en-GB');
let activity: Activity;

Loading…
Cancel
Save