import Inventory2OutlinedIcon from '@mui/icons-material/Inventory2Outlined'; import Box from '@mui/material/Box'; import ButtonBase from '@mui/material/ButtonBase'; import Typography from '@mui/material/Typography'; import { Tile, tileBaseSx } from 'dashgui/tiles'; import { formatPrice } from '../../utils/price'; import { articleSku } from '../article/articleRoute'; import ArticlePhoto from '../article/ArticlePhoto'; import { BrandLabel } from '../brand'; export class ArticleTile extends Tile { hasPhoto() { const { article } = this.props; return article?.thumbHash != null || article?.fullHash != null; } renderIcon() { return ; } renderSecondary() { const { article } = this.props; if (!article) return null; const sku = articleSku(article); const brand = article.brand; return ( <> {brand?.name ? ( ) : null} {sku ? ( {sku} ) : null} {article.net != null && ( {formatPrice(article.net)} )} ); } renderExtra() { const childCount = Number(this.props.article?.childCount) || 0; if (childCount <= 0) return null; return ( {childCount} ); } render() { if (!this.hasPhoto()) { return super.render(); } const { article, label, sx, disabled } = this.props; const sku = articleSku(article); return ( {this.renderExtra()} {article?.brand?.name ? ( ) : null} {label ? ( {label} ) : null} {sku ? ( {sku} ) : null} ); } }