// src/renderer/components/ShopItem.tsx import React, { useState } from 'react'; import { Card, CardMedia, CardContent, Box, Typography, Button, IconButton, } from '@mui/material'; import CoinsDisplay from './CoinsDisplay'; import { CapePreview } from './CapePreview'; import VisibilityIcon from '@mui/icons-material/Visibility'; import CapePreviewModal from './PlayerPreviewModal'; export type ShopItemType = 'case' | 'cape'; export interface ShopItemProps { type: ShopItemType; id: string; name: string; description?: string; imageUrl?: string; price?: number; itemsCount?: number; isOpening?: boolean; playerSkinUrl?: string; disabled?: boolean; onClick: () => void; } export default function ShopItem({ type, name, description, imageUrl, price, itemsCount, isOpening, disabled, playerSkinUrl, onClick, }: ShopItemProps) { const buttonText = type === 'case' ? (isOpening ? 'Открываем...' : 'Открыть кейс') : 'Купить'; const [previewOpen, setPreviewOpen] = useState(false); return ( {/* Градиентный свет сверху */} {imageUrl && ( {type === 'case' ? ( ) : ( )} {/* Кнопка предпросмотра плаща */} {type === 'cape' && ( { e.stopPropagation(); setPreviewOpen(true); }} sx={{ position: 'absolute', top: 10, right: 10, color: 'white', background: 'linear-gradient(71deg, #F27121 0%, #E940CD 70%, #8A2387 100%)', '&:hover': { transform: 'scale(1.05)', }, transition: 'all 0.5s ease' }} > )} )} {name} {description && ( {description} )} {typeof price === 'number' && ( Цена )} {type === 'case' && typeof itemsCount === 'number' && ( Предметов в кейсе: {itemsCount} )} {/* Кнопка как в Registration */} {type === 'cape' && imageUrl && ( setPreviewOpen(false)} capeUrl={imageUrl} skinUrl={playerSkinUrl} /> )} ); }