import { ItemPriceData } from "./priceService";
import { formatPrice } from "./utils/formatting";
import { $T } from "./utils/localization";
export function createPriceRow(qualityName: string, data: ItemPriceData, keyPrice: ItemPriceData, locale: string, wikiPage: string = null): HTMLTableRowElement {
const priceRow = document.createElement("tr");
const priceLabel = document.createElement("td");
priceLabel.className = "infobox-label";
const priceLabelLink = document.createElement("a");
if (wikiPage == null) {
wikiPage = `https://wiki.teamfortress.com/wiki/${qualityName}`
}
priceLabelLink.href = locale === 'en' ? wikiPage : `${wikiPage}/${locale}`
priceLabelLink.innerText = $T(qualityName)
priceLabel.appendChild(priceLabelLink);
priceLabel.innerHTML += ':'
priceRow.appendChild(priceLabel);
const priceData = document.createElement("td");
const priceLink = document.createElement("span");
const priceString = data ? formatPrice(data.keys, data.metal, keyPrice.metal, locale).trim() : $T('Data unavailable')
priceLink.innerHTML = priceString // + `
$${data.scmPrice}`
priceData.appendChild(priceLink);
priceRow.appendChild(priceData);
return priceRow;
}
export function createStoreButton(storeName: string, url: URL) {
const button = document.createElement("tr")
var source = `