/* Graphictoria 5 (https://gtoria.net) Copyright © XlXi 2022 */ import { Component, createRef } from 'react'; import classNames from 'classnames/bind'; import axios from 'axios'; import Twemoji from 'react-twemoji'; import { buildGenericApiUrl } from '../util/HTTP.js'; import Loader from './Loader'; axios.defaults.withCredentials = true; const shopCategories = { 'Clothing': [ { label: 'Hats', assetTypeId: 8 }, { label: 'Shirts', assetTypeId: 11 }, { label: 'T-Shirts', assetTypeId: 2 }, { label: 'Pants', assetTypeId: 12 }, { label: 'Package', assetTypeId: 32 } ], 'Body Parts': [ { label: 'Heads', assetTypeId: 17 }, { label: 'Faces', assetTypeId: 18 }, { label: 'Packages', assetTypeId: 32 } ], 'Gear': [ { label: 'Building', assetTypeId: 19, gearGenreId: 7 }, { label: 'Explosive', assetTypeId: 19, gearGenreId: 2 }, { label: 'Melee', assetTypeId: 19, gearGenreId: 0 }, { label: 'Musical', assetTypeId: 19, gearGenreId: 5 }, { label: 'Navigation', assetTypeId: 19, gearGenreId: 4 }, { label: 'Power Up', assetTypeId: 19, gearGenreId: 3 }, { label: 'Ranged', assetTypeId: 19, gearGenreId: 1 }, { label: 'Social', assetTypeId: 19, gearGenreId: 6 }, { label: 'Transport', assetTypeId: 19, gearGenreId: 8 } ] }; function makeCategoryId(originalName, category) { return `shop-${originalName.toLowerCase().replaceAll(' ', '-')}-${category}`; } class ShopCategoryButton extends Component { constructor(props) { super(props); this.handleClick = this.handleClick.bind(this); } componentDidMount() { if (this.props.id === 'all') { let assetTypes = []; Object.keys(shopCategories).map((categoryName) => { let categoryAssetTypeIds = this.props.getCategoryAssetTypeIds(categoryName); switch(typeof(categoryAssetTypeIds.assetTypeId)) { case 'number': assetTypes[categoryAssetTypeIds.assetTypeId] = true; break; case 'object': categoryAssetTypeIds.assetTypeId.map((assetTypeId) => { assetTypes[assetTypeId] = true; }); break; } }); this.data = {assetTypeId: Object.keys(assetTypes)}; } else if (this.props.id.startsWith('shop-all')) { this.data = this.props.getCategoryAssetTypeIds(this.props.categoryName); } else { this.data = this.props.getCategoryAssetTypeByLabel(this.props.categoryName, this.props.label); } if (this.props.id == 'shop-hats-clothing-type') this.props.navigateCategory(this.props.id, this.data); } handleClick() { this.props.navigateCategory(this.props.id, this.data); } render() { return ( { this.props.label } ); } } class ShopCategories extends Component { constructor(props) { super(props); } render() { return (
Nothing found.
:{ Name }
{ /* TODO: XlXi: price */ }Todo123