diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-01-30 21:27:43 +0200 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-01-30 21:27:43 +0200 |
| commit | c9ef07bc23e1187ce06471120dc5d3b325e06869 (patch) | |
| tree | 8efa2c0d2d8e2f93a02cfcf55748a324b689017b /src | |
| parent | e6015b5dcdb81e20531641a2f06cc2ef15439ce8 (diff) | |
| download | DevHive-c9ef07bc23e1187ce06471120dc5d3b325e06869.tar DevHive-c9ef07bc23e1187ce06471120dc5d3b325e06869.tar.gz DevHive-c9ef07bc23e1187ce06471120dc5d3b325e06869.zip | |
Implemnted ability to click on user profile in post and get redirected to the author profile
Diffstat (limited to 'src')
3 files changed, 11 insertions, 2 deletions
diff --git a/src/DevHive.Angular/src/app/components/post/post.component.css b/src/DevHive.Angular/src/app/components/post/post.component.css index 5395eb2..c3e3caa 100644 --- a/src/DevHive.Angular/src/app/components/post/post.component.css +++ b/src/DevHive.Angular/src/app/components/post/post.component.css @@ -24,6 +24,10 @@ hr { margin-bottom: .2em; } +.author:hover { + cursor: pointer; +} + .author > img { width: 2.2em; height: 2.2em; diff --git a/src/DevHive.Angular/src/app/components/post/post.component.html b/src/DevHive.Angular/src/app/components/post/post.component.html index 36783e5..8fbda35 100644 --- a/src/DevHive.Angular/src/app/components/post/post.component.html +++ b/src/DevHive.Angular/src/app/components/post/post.component.html @@ -1,6 +1,6 @@ <div class="post rounded-border" *ngIf="loaded"> <div class="content"> - <div class="author"> + <div class="author" (click)="goToAuthorProfile()"> <img class="round-image" [src]="user.imageUrl"> <div class="author-info"> <div class="name"> diff --git a/src/DevHive.Angular/src/app/components/post/post.component.ts b/src/DevHive.Angular/src/app/components/post/post.component.ts index 2f5aa81..7a6b5c0 100644 --- a/src/DevHive.Angular/src/app/components/post/post.component.ts +++ b/src/DevHive.Angular/src/app/components/post/post.component.ts @@ -1,4 +1,5 @@ import { Component, Input, OnInit } from '@angular/core'; +import {Router} from '@angular/router'; import { Guid } from 'guid-typescript'; import {AppConstants} from 'src/app/app-constants.module'; import {FeedService} from 'src/app/services/feed.service'; @@ -20,7 +21,7 @@ export class PostComponent implements OnInit { public loaded = false; @Input() paramId: string; - constructor(private _postService: PostService, private _userService: UserService) + constructor(private _postService: PostService, private _userService: UserService, private _router: Router) {} ngOnInit(): void { @@ -45,4 +46,8 @@ export class PostComponent implements OnInit { } ); } + + goToAuthorProfile(): void { + this._router.navigate(['/profile/' + this.user.userName]); + } } |
