import "@/public/css/specific.css";
import config from "@/utils/config.json";
import { bricksToCurrency } from "@/utils/utilities";
import { userDetails } from "@/utils/types";
import * as apiTypes from "@/utils/api/types";
export function irlBrickPrice() {
try {
const purchaseBtn = document.querySelector('button[onclick^="buy"], button[data-price]')!;
const currency = bricksToCurrency(parseInt(purchaseBtn.getAttribute('data-price')!), "USD");
if (currency) {
const spanTag = document.createElement('span');
spanTag.classList.add('text-muted');
spanTag.style.fontSize = '0.7rem';
spanTag.style.fontWeight = 'lighter';
spanTag.innerText = ` (${currency})`;
purchaseBtn.appendChild(spanTag);
};
} catch(e) {
// The store purchase button has several different ways of being represented, this should
// only happen when the item is already owned
console.warn('[Poly+] Failure to find purchase button on page.');
};
};
export function tryOn(user: userDetails) {
const itemId = window.location.pathname.split('/')[2]
const favoriteBtn = document.querySelector('button[onclick^="toggleFavorite"]')!;
const button = document.createElement('button');
button.classList.add('btn', 'btn-outline-primary', 'btn-sm', 'mt-2');
button.innerHTML = '';
const modal = document.createElement('dialog');
modal.classList.add('polyplus-modal');
Object.assign(modal.style, {
width: '450px',
border: '1px solid #484848',
backgroundColor: '#181818',
borderRadius: '20px',
overflow: 'hidden'
});
modal.innerHTML = `
Sorry! This feature is currently unavailable. Please check back later!