From c9ef07bc23e1187ce06471120dc5d3b325e06869 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sat, 30 Jan 2021 21:27:43 +0200 Subject: Implemnted ability to click on user profile in post and get redirected to the author profile --- src/DevHive.Angular/src/app/components/post/post.component.css | 4 ++++ src/DevHive.Angular/src/app/components/post/post.component.html | 2 +- src/DevHive.Angular/src/app/components/post/post.component.ts | 7 ++++++- 3 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src/DevHive.Angular') 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 @@
-
+
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]); + } } -- cgit v1.2.3