added avatar link in my profile

This commit is contained in:
Nicolas Constant 2019-06-15 14:03:29 -04:00
parent 3c45a3de0b
commit 8f540c48f8
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
3 changed files with 33 additions and 26 deletions

View File

@ -2,7 +2,9 @@
<h3 class="panel__title">Manage Account</h3>
<div class="account__header">
<img class="account__avatar" src="{{account.avatar}}" title="{{ account.info.id }} " />
<a href="{{userAccount.url}}" target="_blank" >
<img class="account__avatar" src="{{account.avatar}}" title="{{ account.info.id }} " />
</a>
<!-- <a href class="account__header--button"><fa-icon [icon]="faUserPlus"></fa-icon></a> -->
<a href class="account__header--button" title="favorites" (click)="loadSubPanel('favorites')"
@ -17,8 +19,7 @@
[ngClass]="{ 'account__header--button--selected': subPanel === 'mentions', 'account__header--button--notification': hasMentions }">
<fa-icon [icon]="faAt"></fa-icon>
</a>
<a href class="account__header--button" title="notifications" (click)="loadSubPanel('notifications')"
[ngClass]="{ 'account__header--button--selected': subPanel === 'notifications',
<a href class="account__header--button" title="notifications" (click)="loadSubPanel('notifications')" [ngClass]="{ 'account__header--button--selected': subPanel === 'notifications',
'account__header--button--notification': hasNotifications }">
<fa-icon [icon]="faBell"></fa-icon>
</a>
@ -27,27 +28,18 @@
<fa-icon [icon]="faUser"></fa-icon>
</a>
</div>
<app-direct-messages class="account__body" *ngIf="subPanel === 'dm'"
[account]="account"
(browseAccountEvent)="browseAccount($event)"
(browseHashtagEvent)="browseHashtag($event)"
<app-direct-messages class="account__body" *ngIf="subPanel === 'dm'" [account]="account"
(browseAccountEvent)="browseAccount($event)" (browseHashtagEvent)="browseHashtag($event)"
(browseThreadEvent)="browseThread($event)"></app-direct-messages>
<app-favorites class="account__body" *ngIf="subPanel === 'favorites'"
[account]="account"
(browseAccountEvent)="browseAccount($event)"
(browseHashtagEvent)="browseHashtag($event)"
<app-favorites class="account__body" *ngIf="subPanel === 'favorites'" [account]="account"
(browseAccountEvent)="browseAccount($event)" (browseHashtagEvent)="browseHashtag($event)"
(browseThreadEvent)="browseThread($event)"></app-favorites>
<app-mentions class="account__body" *ngIf="subPanel === 'mentions'"
[account]="account"
(browseAccountEvent)="browseAccount($event)"
(browseHashtagEvent)="browseHashtag($event)"
<app-mentions class="account__body" *ngIf="subPanel === 'mentions'" [account]="account"
(browseAccountEvent)="browseAccount($event)" (browseHashtagEvent)="browseHashtag($event)"
(browseThreadEvent)="browseThread($event)"></app-mentions>
<app-my-account class="account__body" *ngIf="subPanel === 'account'"
[account]="account"></app-my-account>
<app-notifications class="account__body" *ngIf="subPanel === 'notifications'"
[account]="account"
(browseAccountEvent)="browseAccount($event)"
(browseHashtagEvent)="browseHashtag($event)"
<app-my-account class="account__body" *ngIf="subPanel === 'account'" [account]="account"></app-my-account>
<app-notifications class="account__body" *ngIf="subPanel === 'notifications'" [account]="account"
(browseAccountEvent)="browseAccount($event)" (browseHashtagEvent)="browseHashtag($event)"
(browseThreadEvent)="browseThread($event)"></app-notifications>
</div>

View File

@ -6,6 +6,10 @@ import { Subscription } from 'rxjs';
import { AccountWrapper } from '../../../models/account.models';
import { UserNotificationService, UserNotification } from '../../../services/user-notification.service';
import { OpenThreadEvent } from '../../../services/tools.service';
import { MastodonService } from '../../../services/mastodon.service';
import { Account } from "../../../services/models/mastodon.interfaces";
import { NotificationService } from '../../../services/notification.service';
import { AccountInfo } from '../../../states/accounts.state';
@Component({
@ -25,6 +29,8 @@ export class ManageAccountComponent implements OnInit, OnDestroy {
hasNotifications = false;
hasMentions = false;
userAccount: Account;
@Output() browseAccountEvent = new EventEmitter<string>();
@Output() browseHashtagEvent = new EventEmitter<string>();
@Output() browseThreadEvent = new EventEmitter<OpenThreadEvent>();
@ -33,6 +39,7 @@ export class ManageAccountComponent implements OnInit, OnDestroy {
set account(acc: AccountWrapper) {
this._account = acc;
this.checkNotifications();
this.getUserUrl(acc.info);
}
get account(): AccountWrapper {
return this._account;
@ -42,6 +49,8 @@ export class ManageAccountComponent implements OnInit, OnDestroy {
private _account: AccountWrapper;
constructor(
private readonly mastodonService: MastodonService,
private readonly notificationService: NotificationService,
private readonly userNotificationService: UserNotificationService) { }
ngOnInit() {
@ -52,6 +61,16 @@ export class ManageAccountComponent implements OnInit, OnDestroy {
this.userNotificationServiceSub.unsubscribe();
}
private getUserUrl(account: AccountInfo){
this.mastodonService.retrieveAccountDetails(this.account.info)
.then((acc: Account) => {
this.userAccount = acc;
})
.catch(err => {
this.notificationService.notifyHttpError(err);
});
}
private checkNotifications(){
if(this.userNotificationServiceSub){
this.userNotificationServiceSub.unsubscribe();

View File

@ -5,10 +5,6 @@ export class AccountWrapper {
constructor() {
}
// id: number;
// username: string;
// display_name: string;
info: AccountInfo;
avatar: string;
}