starting wirering opening account from statuses

This commit is contained in:
Nicolas Constant 2018-10-22 01:41:54 -04:00
parent 1152085038
commit b020a9cc2f
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
4 changed files with 18 additions and 9 deletions

View File

@ -1,10 +1,10 @@
<div class="reblog" *ngIf="reblog"> <div class="reblog" *ngIf="reblog">
<a class="reblog__profile-link" href>{{ status.account.display_name }} <img *ngIf="reblog" class="reblog__avatar" <a class="reblog__profile-link" href (click)="openAccount(status.account)">{{ status.account.display_name }} <img *ngIf="reblog" class="reblog__avatar"
src="{{ status.account.avatar }}" /></a> boosted src="{{ status.account.avatar }}" /></a> boosted
</div> </div>
<div class="status"> <div class="status">
<a href class="status__profile-link" title="{{displayedStatus.account.acct}}"> <a href class="status__profile-link" title="{{displayedStatus.account.acct}}" (click)="openAccount(displayedStatus.account)">
<img [class.status__avatar--boosted]="reblog" class="status__avatar" src="{{ displayedStatus.account.avatar }}" /> <img [class.status__avatar--boosted]="reblog" class="status__avatar" src="{{ displayedStatus.account.avatar }}" />
<!-- <img *ngIf="reblog" class="status__avatar--reblog" src="{{ status.account.avatar }}" /> --> <!-- <img *ngIf="reblog" class="status__avatar--reblog" src="{{ status.account.avatar }}" /> -->
<span class="status__name"> <span class="status__name">

View File

@ -1,4 +1,4 @@
import { Component, OnInit, Input, Inject, LOCALE_ID, ElementRef } from "@angular/core"; import { Component, OnInit, Input, Output, Inject, LOCALE_ID, ElementRef, EventEmitter } from "@angular/core";
import { Status } from "../../../services/models/mastodon.interfaces"; import { Status } from "../../../services/models/mastodon.interfaces";
import { formatDate } from '@angular/common'; import { formatDate } from '@angular/common';
import { stateNameErrorMessage } from "@ngxs/store/src/decorators/state"; import { stateNameErrorMessage } from "@ngxs/store/src/decorators/state";
@ -16,6 +16,10 @@ export class StatusComponent implements OnInit {
hasAttachments: boolean; hasAttachments: boolean;
replyingToStatus: boolean; replyingToStatus: boolean;
@Output() browseAccount = new EventEmitter<Account>();
@Output() browseHashtag = new EventEmitter<string>();
@Output() browseThread = new EventEmitter<string>();
private _statusWrapper: StatusWrapper; private _statusWrapper: StatusWrapper;
status: Status; status: Status;
@Input('statusWrapper') @Input('statusWrapper')
@ -51,6 +55,11 @@ export class StatusComponent implements OnInit {
ngOnInit() { ngOnInit() {
} }
openAccount(account: Account): boolean{
this.browseAccount.next(account);
return false;
}
getCompactRelativeTime(d: string): string { getCompactRelativeTime(d: string): string {
const date = (new Date(d)).getTime(); const date = (new Date(d)).getTime();
const now = Date.now(); const now = Date.now();

View File

@ -10,7 +10,7 @@
<div class="stream-toots flexcroll" #statusstream (scroll)="onScroll()"> <div class="stream-toots flexcroll" #statusstream (scroll)="onScroll()">
<!-- data-simplebar --> <!-- data-simplebar -->
<div class="stream-toots__status" *ngFor="let statusWrapper of statuses"> <div class="stream-toots__status" *ngFor="let statusWrapper of statuses">
<app-status [statusWrapper]="statusWrapper"></app-status> <app-status [statusWrapper]="statusWrapper" (browseAccount)="browseAccount($event)"></app-status>
</div> </div>
</div> </div>
</div> </div>

View File

@ -22,7 +22,7 @@ export class StreamComponent implements OnInit {
private bufferWasCleared: boolean; private bufferWasCleared: boolean;
overlayActive: boolean; overlayActive: boolean;
overlayParams: string; overlayAccountToBrowse: Account;
@Input() @Input()
set streamElement(streamElement: StreamElement) { set streamElement(streamElement: StreamElement) {
@ -50,9 +50,9 @@ export class StreamComponent implements OnInit {
ngOnInit() { ngOnInit() {
} }
browseAccount(account: any): void { browseAccount(account: Account): void {
console.warn('browseAccount'); this.overlayAccountToBrowse = account;
console.warn(account); this.overlayActive = true;
} }
browseHashtag(hashtag: any): void { browseHashtag(hashtag: any): void {