Skip to content

Commit

Permalink
- added trade offer received timer
Browse files Browse the repository at this point in the history
- added trade offer received timer
- added trade player name
  • Loading branch information
Kyusung4698 committed Jun 24, 2020
1 parent 0c97013 commit 98387bf
Show file tree
Hide file tree
Showing 16 changed files with 70 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
<div class="message" [class.even]="even" [class.incoming]="message.direction === 'incoming'" [class.toggled]="toggle$ | async"
[class.joined]="message.joined$ | async" (click)="toggle$.next(!toggle$.value)"
<div class="message" [class.even]="even" [class.incoming]="message.direction === 'incoming'"
[class.toggled]="toggle$ | async" [class.joined]="message.joined$ | async" (click)="toggle$.next(!toggle$.value)"
[appAnnotation]="'trade.' + message.direction">
<div class="content">
<div class="action" *ngIf="(toggle$ | async) === false">
<mat-icon (click)="onWait($event)" *ngIf="visible['wait']">pan_tool</mat-icon>
</div>
<ng-container [ngSwitch]="message.type">
<app-trade-message-item *ngSwitchCase="'item'" [message]="message"></app-trade-message-item>
<app-trade-message-bulk *ngSwitchCase="'bulk'" [message]="message"></app-trade-message-bulk>
<app-trade-message-map *ngSwitchCase="'map'" [message]="message"></app-trade-message-map>
<div *ngSwitchDefault>Could not match message type: {{message.type}}</div>
</ng-container>
<div class="title">
<div class="name" [title]="message.name">{{message.name | truncateText: 20}}</div>
<div class="spacer"></div>
<div class="timer">{{message.timeReceived | timer | async}}</div>
</div>
<div>
<ng-container [ngSwitch]="message.type">
<app-trade-message-item *ngSwitchCase="'item'" [message]="message"></app-trade-message-item>
<app-trade-message-bulk *ngSwitchCase="'bulk'" [message]="message"></app-trade-message-bulk>
<app-trade-message-map *ngSwitchCase="'map'" [message]="message"></app-trade-message-map>
<div *ngSwitchDefault>Could not match message type: {{message.type}}</div>
</ng-container>
</div>
</div>
<div class="actions" *ngIf="(toggle$ | async) === true">
<app-trade-message-action action="wait" [visible]="visible" [title]="' @' + message.name"
Expand All @@ -29,6 +36,9 @@
<app-trade-message-action action="invite" [visible]="visible" [title]="' @' + message.name"
(execute)="onActionExecute($event)">
</app-trade-message-action>
<app-trade-message-action action="hideout" [visible]="visible" [title]="' @' + message.name"
(execute)="onActionExecute($event)">
</app-trade-message-action>
<app-trade-message-action action="trade" [visible]="visible" [title]="' @' + message.name"
(execute)="onActionExecute($event)">
</app-trade-message-action>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,20 @@
justify-content: center;
}

.content {
flex-direction: column;
}

.title {
display: flex;
color: $light-dark-grey;
font-size: 12px;
}

.spacer {
flex-grow: 1;
}

.actions {
padding-top: $gutter-half;
}
4 changes: 3 additions & 1 deletion src/app/shared/module/common/common.module.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { NgModule } from '@angular/core';
import { TruncateTextPipe } from './pipe';
import { TimerPipe } from './pipe/timer.pipe';

const PIPES = [
TruncateTextPipe
TruncateTextPipe,
TimerPipe
];

@NgModule({
Expand Down
21 changes: 21 additions & 0 deletions src/app/shared/module/common/pipe/timer.pipe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Pipe, PipeTransform } from '@angular/core';
import { Observable, timer } from 'rxjs';
import { map } from 'rxjs/operators';

@Pipe({
name: 'timer',
})
export class TimerPipe implements PipeTransform {
public transform(start: Date): Observable<string> {
return timer(0, 1000).pipe(
map(() => {
const diff = new Date(Date.now() - start.getTime());
const minutes = diff.getMinutes();
const m = '0' + minutes;
const seconds = diff.getSeconds();
const s = '0' + seconds;
return `${m.substr(m.length - 2)}:${s.substr(s.length - 2)}`;
})
);
}
}
2 changes: 1 addition & 1 deletion src/app/shared/module/common/pipe/truncate-text.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Pipe, PipeTransform } from '@angular/core';
name: 'truncateText',
})
export class TruncateTextPipe implements PipeTransform {
public transform(text: string, length: number, separator: string = '...'): any {
public transform(text: string, length: number, separator: string = '...'): string {
if (text.length < length) {
return text;
}
Expand Down
5 changes: 3 additions & 2 deletions src/assets/i18n/english.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"message": "Opens a webpage on hotkey press in the in-game browser.\n\nTry the hotkey below to open poe.ninja.",
"title": "Bookmarks"
},
"changelog-1-0-5": {
"message": "- added support page with discord and GitHub issues\n- added colors for life, mana and energy shield pseudo stats\n- added trade filter setting (Incoming & Outgoing, Incoming)\n- added trade layout setting (Top To Bottom, Bottom To Top)\n- added trade window to be transparent if no active trades and the window is pinned\n- update trade action finished to be always shown even if no trade have been initialized\n- fixed an focus issue occurring when using the trade whisper button\n- fixed an sorting issue at the market result list\n- fixed an issue at the inspect frame not showing dps",
"changelog-1-0-6": {
"message": "- added market search history\n- added trade offer received timer\n- added trade player name\n- added trade go to hideout action\n- added harvest seeds evaluate support\n- fixed an issue at the market which resulted in crashing the app",
"title": "What's new in 1.0.5?"
},
"commands": {
Expand Down Expand Up @@ -428,6 +428,7 @@
"trade": {
"action": {
"finished": "Thanks and Goodbye",
"hideout": "Go to seller hideout",
"interested": "Still interested?",
"invite": "Invite",
"item-gone": "Item gone",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/french.json
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@
"trade": {
"action": {
"finished": "Merci et au revoir",
"hideout": "Accéder à la cachette du vendeur",
"interested": "Toujours intéressé?",
"invite": "Inviter",
"item-gone": "Élément disparu",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/german.json
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@
"trade": {
"action": {
"finished": "Danke und auf Wiedersehen",
"hideout": "Gehe zum Versteck des Verkäufers",
"interested": "Noch interessiert?",
"invite": "Einladen",
"item-gone": "Gegenstand weg",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/korean.json
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@
"trade": {
"action": {
"finished": "감사와 안녕",
"hideout": "판매자 은신처로 이동",
"interested": "여전히 관심이 있습니까?",
"invite": "초대",
"item-gone": "사라진 항목",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/polish.json
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@
"trade": {
"action": {
"finished": "Dzięki i do widzenia",
"hideout": "Idź do kryjówki sprzedawcy",
"interested": "Nadal jesteś zainteresowany?",
"invite": "Zapraszam",
"item-gone": "Element zniknął",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/portuguese.json
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@
"trade": {
"action": {
"finished": "Obrigado e adeus",
"hideout": "Ir para o esconderijo do vendedor",
"interested": "Ainda interessado?",
"invite": "convite",
"item-gone": "Item desaparecido",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/russian.json
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@
"trade": {
"action": {
"finished": "Спасибо и до свидания",
"hideout": "Перейти к укрытию продавца",
"interested": "Все еще заинтересован?",
"invite": "приглашение",
"item-gone": "Предмет пропал",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/simplified-chinese.json
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@
"trade": {
"action": {
"finished": "谢谢,再见",
"hideout": "前往卖家藏身处",
"interested": "还感兴趣吗?",
"invite": "邀请",
"item-gone": "物品不见了",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/spanish.json
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@
"trade": {
"action": {
"finished": "Gracias y adiós",
"hideout": "Ir al escondite del vendedor",
"interested": "¿Aún interesado?",
"invite": "invitación",
"item-gone": "Artículo desaparecido",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/thai.json
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@
"trade": {
"action": {
"finished": "ขอบคุณและลาก่อน",
"hideout": "ไปที่ซ่อนผู้ขาย",
"interested": "ยังสนใจอยู่เหรอ?",
"invite": "เชิญ",
"item-gone": "รายการหายไป",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/traditional-chinese.json
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@
"trade": {
"action": {
"finished": "謝謝,再見",
"hideout": "前往賣家藏身處",
"interested": "還感興趣嗎?",
"invite": "邀請",
"item-gone": "物品不見了",
Expand Down

0 comments on commit 98387bf

Please sign in to comment.