Add profile pictures in search, social and group page
parent
1baa7b6230
commit
41c03cdb05
@ -0,0 +1,12 @@
|
|||||||
|
<mat-card class="card" *ngFor = "let user of userList" [class.selected]="user === selectedUser" tabindex="0">
|
||||||
|
<mat-card-header>
|
||||||
|
<div mat-card-avatar>
|
||||||
|
<img class="profile-picture" [src]="user.profilePicture"/>
|
||||||
|
</div>
|
||||||
|
<mat-card-title class="pointer" (click)="showUserProfile(user)">{{user.username}}</mat-card-title>
|
||||||
|
<mat-card-subtitle class="pointer" (click)="showUserProfile(user)">{{user.handle}}</mat-card-subtitle>
|
||||||
|
<div class="icon-box">
|
||||||
|
<button mat-icon-button class="request-button" (click)="sendFriendRequest(user)" [disabled]="!user.allowedToSendRequest"><mat-icon>person_add</mat-icon></button>
|
||||||
|
</div>
|
||||||
|
</mat-card-header>
|
||||||
|
</mat-card>
|
@ -0,0 +1,40 @@
|
|||||||
|
@import '../../../styles/mixins.sass'
|
||||||
|
@import '../../../styles/vars.sass'
|
||||||
|
|
||||||
|
.card
|
||||||
|
box-sizing: border-box
|
||||||
|
width: 100%
|
||||||
|
margin-top: 0.5em
|
||||||
|
outline: none
|
||||||
|
user-select: none
|
||||||
|
::ng-deep .mat-card-header-text
|
||||||
|
width: 1000%
|
||||||
|
margin: 0
|
||||||
|
margin-left: 24px
|
||||||
|
.mat-card-subtitle
|
||||||
|
margin: 0
|
||||||
|
word-break: break-all
|
||||||
|
.mat-card-title
|
||||||
|
margin: 0
|
||||||
|
word-break: break-all
|
||||||
|
.request-button
|
||||||
|
margin-top: 0.5em
|
||||||
|
margin-bottom: 0.5em
|
||||||
|
|
||||||
|
.pointer:hover
|
||||||
|
cursor: pointer
|
||||||
|
|
||||||
|
.icon-box
|
||||||
|
text-align: right
|
||||||
|
width: 100%
|
||||||
|
|
||||||
|
$mat-card-header-size: 54px !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
|
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { UserlistComponent } from './userlist.component';
|
||||||
|
|
||||||
|
describe('UserlistComponent', () => {
|
||||||
|
let component: UserlistComponent;
|
||||||
|
let fixture: ComponentFixture<UserlistComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ UserlistComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(UserlistComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,29 @@
|
|||||||
|
import { Component, OnInit, Input } from '@angular/core';
|
||||||
|
import { User } from 'src/app/models/user';
|
||||||
|
import { RequestService } from 'src/app/services/request/request.service';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'user-list',
|
||||||
|
templateUrl: './userlist.component.html',
|
||||||
|
styleUrls: ['./userlist.component.sass']
|
||||||
|
})
|
||||||
|
export class UserlistComponent implements OnInit {
|
||||||
|
|
||||||
|
@Input() userList: Array<User>;
|
||||||
|
selectedUser: User;
|
||||||
|
|
||||||
|
constructor(private requestService: RequestService, private router: Router) { }
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public sendFriendRequest(user: User) {
|
||||||
|
user.allowedToSendRequest = false;
|
||||||
|
this.requestService.sendFriendRequest(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public showUserProfile(user: User) {
|
||||||
|
this.router.navigate(['profile/' + user.userID]);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue