diff --git a/client/src/entities/product/ui/ProductCard.tsx b/client/src/entities/product/ui/ProductCard.tsx index 1d914bc..72c32eb 100644 --- a/client/src/entities/product/ui/ProductCard.tsx +++ b/client/src/entities/product/ui/ProductCard.tsx @@ -18,7 +18,7 @@ import type { Swiper as SwiperType } from 'swiper/types' type Props = { product: Product; mediaHeight?: number; actions?: ReactNode } -const ProductCardInner = ({ product, mediaHeight = 300, actions }: Props) => { +const ProductCardInner = ({ product, mediaHeight = 390, actions }: Props) => { const navigate = useNavigate() const isMobile = useMediaQuery('(max-width:600px)') const swiperRef = useRef(null) @@ -78,7 +78,7 @@ const ProductCardInner = ({ product, mediaHeight = 300, actions }: Props) => { > {imageUrls.length ? ( - + { onSwiper={(s) => { swiperRef.current = s }} - style={{ width: '100%', height: mediaHeight, overflow: 'hidden' }} + style={{ width: '100%', height: '100%', overflow: 'hidden' }} > {imageUrls.map((url) => ( @@ -94,7 +94,7 @@ const ProductCardInner = ({ product, mediaHeight = 300, actions }: Props) => { className="product-card__media" sx={{ width: '100%', - height: mediaHeight, + height: '100%', transition: 'transform 320ms ease', '@media (prefers-reduced-motion: reduce)': { transition: 'none' }, userSelect: 'none', @@ -104,7 +104,7 @@ const ProductCardInner = ({ product, mediaHeight = 300, actions }: Props) => { { (90) useEffect(() => { const t = window.setTimeout(() => { @@ -54,10 +53,6 @@ export function useProductFilters() { setPage(1) } - const handleCardScaleChange = (v: number) => { - if (v === 70 || v === 90 || v === 110 || v === 130) setCardScale(v as 70 | 90 | 110 | 130) - } - const resetFilters = () => { setCategorySlug('') setQInput('') @@ -65,7 +60,6 @@ export function useProductFilters() { setPriceMinRub('') setPriceMaxRub('') setPageSize(12) - setCardScale(90) setMoreOpen(false) } @@ -86,7 +80,6 @@ export function useProductFilters() { pageSize, priceMinRub, priceMaxRub, - cardScale, setPage, setQInput, setMoreOpen, @@ -95,7 +88,6 @@ export function useProductFilters() { handlePageSizeChange, handlePriceMinChange, handlePriceMaxChange, - handleCardScaleChange, resetFilters, toCents, } diff --git a/client/src/pages/home/ui/HomePage.tsx b/client/src/pages/home/ui/HomePage.tsx index 1786265..340f7b4 100644 --- a/client/src/pages/home/ui/HomePage.tsx +++ b/client/src/pages/home/ui/HomePage.tsx @@ -64,7 +64,6 @@ export function HomePage() { const products = productsQuery.data?.items ?? [] const total = productsQuery.data?.total ?? 0 const totalPages = Math.max(1, Math.ceil(total / filters.pageSize)) - const mediaHeight = Math.round(300 * (filters.cardScale / 100)) return ( @@ -100,8 +99,8 @@ export function HomePage() { {productsQuery.isLoading && ( {[1, 2, 3].map((i) => ( - - + + ))} @@ -128,10 +127,9 @@ export function HomePage() { <> {products.map((p) => ( - + 0 ? : undefined} /> diff --git a/client/src/pages/home/ui/ProductFilters.tsx b/client/src/pages/home/ui/ProductFilters.tsx index 70ba964..b0014bc 100644 --- a/client/src/pages/home/ui/ProductFilters.tsx +++ b/client/src/pages/home/ui/ProductFilters.tsx @@ -3,7 +3,6 @@ import Box from '@mui/material/Box' import Button from '@mui/material/Button' import Chip from '@mui/material/Chip' import Collapse from '@mui/material/Collapse' -import Divider from '@mui/material/Divider' import FormControl from '@mui/material/FormControl' import InputAdornment from '@mui/material/InputAdornment' import InputLabel from '@mui/material/InputLabel' @@ -12,9 +11,6 @@ import Paper from '@mui/material/Paper' import Select from '@mui/material/Select' import Stack from '@mui/material/Stack' import TextField from '@mui/material/TextField' -import ToggleButton from '@mui/material/ToggleButton' -import ToggleButtonGroup from '@mui/material/ToggleButtonGroup' -import Typography from '@mui/material/Typography' import { Search, SlidersHorizontal } from 'lucide-react' import type { Category } from '@/entities/product/model/types' import type { UseProductFiltersResult } from '../lib/use-product-filters' @@ -32,7 +28,6 @@ export function ProductFilters({ pageSize, priceMinRub, priceMaxRub, - cardScale, categories, categoriesLoading, setQInput, @@ -42,7 +37,6 @@ export function ProductFilters({ handlePageSizeChange, handlePriceMinChange, handlePriceMaxChange, - handleCardScaleChange, resetFilters, }: Props) { const categoriesForFilter = useMemo(() => { @@ -188,39 +182,6 @@ export function ProductFilters({ - - - - Масштаб карточек - handleCardScaleChange(v)} - sx={{ - alignSelf: { xs: 'flex-start', sm: 'auto' }, - '& .MuiToggleButton-root': { px: 1.5, fontWeight: 600, textTransform: 'none' }, - '& .MuiToggleButton-root.Mui-selected': { - bgcolor: 'primary.main', - color: 'primary.contrastText', - '&:hover': { bgcolor: 'primary.dark' }, - }, - }} - > - S - M - L - XL - - diff --git a/client/src/pages/product/ui/ProductPage.tsx b/client/src/pages/product/ui/ProductPage.tsx index 7025c6c..5c7e01a 100644 --- a/client/src/pages/product/ui/ProductPage.tsx +++ b/client/src/pages/product/ui/ProductPage.tsx @@ -57,7 +57,7 @@ export function ProductPage() { if (productQuery.isLoading) { return ( - + @@ -72,121 +72,128 @@ export function ProductPage() { return ( - - {imageUrls.length > 0 ? ( - - - {imageUrls.map((url, idx) => ( - - { - setViewerIndex(idx) - setViewerOpen(true) - }} - sx={{ - width: '100%', - height: 525, - cursor: 'zoom-in', - userSelect: 'none', - }} - > - + + {imageUrls.length > 0 ? ( + + + {imageUrls.map((url, idx) => ( + + { + setViewerIndex(idx) + setViewerOpen(true) + }} sx={{ width: '100%', height: '100%', - objectFit: 'cover', + cursor: 'zoom-in', + userSelect: 'none', }} - /> - - - ))} - - - ) : ( - - Нет фото - - )} - - - {p.category?.name && } - {p.quantity > 0 && } - {p.quantity === 0 && } + > + + + + ))} + + + ) : ( + + Нет фото + + )} - {(p.materials?.length ?? 0) > 0 && ( - - - Материалы - - - {(p.materials ?? []).map((m) => ( - - ))} - + + + {p.category?.name && } + {p.quantity > 0 && } + {p.quantity === 0 && } - )} - - {p.title} - - - {formatPriceRub(p.priceCents)} - + {(p.materials?.length ?? 0) > 0 && ( + + + Материалы + + + {(p.materials ?? []).map((m) => ( + + ))} + + + )} - {!isAdmin && p.quantity > 0 ? : null} + + {p.title} + + + {formatPriceRub(p.priceCents)} + - {p.description || p.shortDescription ? ( - {p.description} - ) : ( - Описание появится позже. - )} + {!isAdmin && p.quantity > 0 ? : null} - + {p.description || p.shortDescription ? ( + {p.description} + ) : ( + Описание появится позже. + )} + + - - Отзывы - - {p.reviewsSummary && p.reviewsSummary.approvedReviewCount > 0 && ( - - } - emptyIcon={} - /> - - {reviewsCountRu(p.reviewsSummary.approvedReviewCount)} - - - )} + - - + + Отзывы + + {p.reviewsSummary && p.reviewsSummary.approvedReviewCount > 0 && ( + + } + emptyIcon={} + /> + + {reviewsCountRu(p.reviewsSummary.approvedReviewCount)} + + + )} + + setViewerOpen(false)}>