'use client'; import styles from '@/components/shop/Shop.module.css'; import { FC, useEffect, useRef, useState } from 'react'; import ModalExchangeContainer from '@/components/ui/modal-exchange/ModalExchangeContainer'; import { ToastContainer } from 'react-toastify'; import 'react-toastify/dist/ReactToastify.css'; import ShopItem from '@/components/shop/ShopItem'; import { IHandleOpen } from '@/components/shop/ShopContainer'; import { useShopItemsStore } from '@/store/shopItems.state'; import { usePlayerStore } from '@/store/player.state'; import { toFixed } from '@/utils/FormatNumber'; interface IShop { isOpen: boolean; handleClose: () => void; handleOpen: (data: IHandleOpen) => void; } const Shop: FC = ({ isOpen, handleOpen, handleClose }) => { const shopBlockRef = useRef(null); const [isOverflow, setIsOverflow] = useState(false); const { shopItems } = useShopItemsStore(); const { player } = usePlayerStore(); useEffect(() => { const checkOverflow = () => { if (shopBlockRef.current) { setIsOverflow( shopBlockRef.current.scrollHeight > shopBlockRef.current.clientHeight, ); } }; checkOverflow(); window.addEventListener('resize', checkOverflow); return () => window.removeEventListener('resize', checkOverflow); }, []); return (
Магазин
Товары Все
{shopItems && shopItems.map(shopItem => ( ))}
Улучшения
Уже скоро...
); }; export default Shop;