-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ab47ac8
commit 15f81d0
Showing
38 changed files
with
353 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './roman'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* https://github.com/joshleaves/roman-numerals/ */ | ||
export class Roman { | ||
public static toArabic(input: string): number { | ||
const roman = input.toUpperCase().match(/^(M{0,3})(CM|DC{0,3}|CD|C{0,3})(XC|LX{0,3}|XL|X{0,3})(IX|VI{0,3}|IV|I{0,3})$/); | ||
if (!roman) { | ||
throw new Error('toArabic expects a valid roman number'); | ||
} | ||
|
||
let arabic = 0; | ||
arabic += roman[1].length * 1000; | ||
if (roman[2] === 'CM') { | ||
arabic += 900; | ||
} else if (roman[2] === 'CD') { | ||
arabic += 400; | ||
} else { | ||
arabic += roman[2].length * 100 + (roman[2][0] === 'D' ? 400 : 0); | ||
} | ||
if (roman[3] === 'XC') { | ||
arabic += 90; | ||
} else if (roman[3] === 'XL') { | ||
arabic += 40; | ||
} else { | ||
arabic += roman[3].length * 10 + (roman[3][0] === 'L' ? 40 : 0); | ||
} | ||
if (roman[4] === 'IX') { | ||
arabic += 9; | ||
} else if (roman[4] === 'IV') { | ||
arabic += 4; | ||
} else { | ||
arabic += roman[4].length * 1 + (roman[4][0] === 'V' ? 4 : 0); | ||
} | ||
return arabic; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
src/app/modules/trade/component/trade-message-bulk/trade-message-bulk.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 10 additions & 4 deletions
14
src/app/modules/trade/component/trade-message-item/trade-message-item.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
<div class="item" [class.reverse]="message.direction === 'outgoing'"> | ||
<div class="name" [title]="message.itemName">{{message.itemName | truncateText: 20}}</div> | ||
<div class="name" [title]="message.itemName">{{message.itemName | truncateText: 18}}</div> | ||
<app-trade-message-direction></app-trade-message-direction> | ||
<div class="price" *ngIf="message.price && message.currencyType"> | ||
<app-trade-static-frame [count]="message.price" [id]="message.currencyType" [reverse]="message.direction === 'outgoing'" [medium]="true"> | ||
</app-trade-static-frame> | ||
<div class="price"> | ||
<ng-container *ngIf="message.price && message.currencyType; else empty"> | ||
<app-trade-static-frame [count]="message.price" [id]="message.currencyType" | ||
[reverse]="message.direction === 'outgoing'" [medium]="true"> | ||
</app-trade-static-frame> | ||
</ng-container> | ||
<ng-template #empty> | ||
{{'trade.no-price' | translate}} | ||
</ng-template> | ||
</div> | ||
</div> |
4 changes: 2 additions & 2 deletions
4
src/app/modules/trade/component/trade-message-map/trade-message-map.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<div class="item"> | ||
<app-trade-message-map-tier [list]="message.maps1" [left]="true"></app-trade-message-map-tier> | ||
<app-trade-message-map-tier [list]="maps1" [left]="true"></app-trade-message-map-tier> | ||
<app-trade-message-direction></app-trade-message-direction> | ||
<app-trade-message-map-tier [list]="message.maps2"></app-trade-message-map-tier> | ||
<app-trade-message-map-tier [list]="maps2"></app-trade-message-map-tier> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.