Skip to content

Commit 5e66fa4

Browse files
authored
Add Doppler Phase to Search Link (#355)
* add phase to search link * fix: itemInfo typing * chore: run format
1 parent 8d592e6 commit 5e66fa4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/lib/components/inventory/list_item_modal.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ import {listItemModalStyles} from './list_item_modal_styles';
1111
import {CSFError, CSFErrorCode} from '../../utils/errors';
1212
import {FetchCSFloatMe} from '../../bridge/handlers/fetch_csfloat_me';
1313
import {STEAL_ICON, CHEAP_ICON, RECOMMENDED_ICON, EXPENSIVE_ICON} from '../../utils/icons';
14+
import {getDopplerPhase, hasDopplerPhase} from '../../utils/dopplers';
1415

1516
@CustomElement()
1617
export class ListItemModal extends FloatElement {
1718
@property()
18-
itemInfo!: ItemInfo;
19+
itemInfo: ItemInfo | undefined;
1920

2021
@property()
2122
asset!: InventoryAsset;
@@ -84,7 +85,14 @@ export class ListItemModal extends FloatElement {
8485
private readonly MAX_DESCRIPTION_LENGTH = 32;
8586

8687
get searchUrl(): string {
87-
return `https://csfloat.com/search?market_hash_name=${encodeURIComponent(this.asset.description.market_hash_name)}`;
88+
let extendedMHN = this.asset.description.market_hash_name;
89+
90+
const paintindex = this.itemInfo?.paintindex;
91+
if (paintindex && hasDopplerPhase(paintindex)) {
92+
extendedMHN += ` [${getDopplerPhase(paintindex)}]`;
93+
}
94+
95+
return `https://csfloat.com/search?market_hash_name=${encodeURIComponent(extendedMHN)}`;
8896
}
8997

9098
static styles = [...listItemModalStyles];

0 commit comments

Comments
 (0)