@@ -16,7 +16,7 @@ import { AllCardsService } from '@firestone-hs/replay-parser';
16
16
changeDetection : ChangeDetectionStrategy . OnPush ,
17
17
} )
18
18
export class CardCostComponent {
19
- _cost : number ;
19
+ _cost : number | undefined ;
20
20
costClass : string | undefined ;
21
21
_cardType : string | null ;
22
22
fontSizeRatio : number ;
@@ -26,20 +26,20 @@ export class CardCostComponent {
26
26
constructor ( private cards : AllCardsService , private cdr : ChangeDetectorRef ) { }
27
27
28
28
@Input ( ) set cardId ( cardId : string ) {
29
- console . debug ( '[card-cost] setting cardId' , cardId ) ;
29
+ // console.debug('[card-cost] setting cardId', cardId);
30
30
this . _cardId = cardId ;
31
31
this . updateCost ( ) ;
32
32
}
33
33
34
34
@Input ( ) set cost ( cost : number ) {
35
- console . debug ( '[card-cost] setting cost' , cost ) ;
35
+ // console.debug('[card-cost] setting cost', cost);
36
36
this . _cost = cost ;
37
37
this . costClass = undefined ;
38
38
this . updateCost ( ) ;
39
39
}
40
40
41
41
@Input ( ) set cardType ( cardType : CardType | undefined ) {
42
- console . debug ( '[card-text] setting cardType' , cardType ) ;
42
+ // console.debug('[card-text] setting cardType', cardType);
43
43
this . _cardType = ! cardType ? null : CardType [ cardType ] ?. toLowerCase ( ) ;
44
44
this . fontSizeRatio = this . _cardType === CardType [ CardType . HERO_POWER ] ?. toLowerCase ( ) ? 0.6 : 0.8 ;
45
45
this . updateCost ( ) ;
@@ -50,15 +50,15 @@ export class CardCostComponent {
50
50
return ;
51
51
}
52
52
const originalCard = this . cards . getCard ( this . _cardId ) ;
53
- const originalCost : number = originalCard . cost ?? 0 ;
53
+ const originalCost : number | undefined = originalCard . cost ;
54
54
55
55
if ( this . _cost == null ) {
56
56
this . _cost = originalCost ;
57
57
}
58
58
59
- if ( this . _cost < originalCost ) {
59
+ if ( ( this . _cost ?? 0 ) < ( originalCost ?? 0 ) ) {
60
60
this . costClass = 'lower-cost' ;
61
- } else if ( this . _cost > originalCost ) {
61
+ } else if ( ( this . _cost ?? 0 ) > ( originalCost ?? 0 ) ) {
62
62
this . costClass = 'higher-cost' ;
63
63
}
64
64
if ( ! ( this . cdr as ViewRef ) . destroyed ) {
0 commit comments