base commit
This commit is contained in:
@@ -19,12 +19,16 @@ import ToggleButton from '@mui/material/ToggleButton'
|
||||
import ToggleButtonGroup from '@mui/material/ToggleButtonGroup'
|
||||
import Typography from '@mui/material/Typography'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { useUnit } from 'effector-react'
|
||||
import { fetchCategories, fetchPublicProducts } from '@/entities/product/api/product-api'
|
||||
import { ProductCard } from '@/entities/product/ui/ProductCard'
|
||||
import { ToggleCartIcon } from '@/features/cart/toggle-cart-icon'
|
||||
import { $user } from '@/shared/model/auth'
|
||||
import { ReviewsBlock } from '@/widgets/reviews-block'
|
||||
|
||||
export function HomePage() {
|
||||
const user = useUnit($user)
|
||||
const isAdmin = Boolean(user?.isAdmin)
|
||||
const [categorySlug, setCategorySlug] = useState<string>('')
|
||||
const [availability, setAvailability] = useState<'all' | 'in_stock' | 'made_to_order'>('all')
|
||||
const [qInput, setQInput] = useState('')
|
||||
@@ -367,10 +371,12 @@ export function HomePage() {
|
||||
product={p}
|
||||
mediaHeight={mediaHeight}
|
||||
actions={
|
||||
<ToggleCartIcon
|
||||
productId={p.id}
|
||||
disabledReason={p.inStock && p.quantity === 0 ? 'Нет в наличии' : null}
|
||||
/>
|
||||
!isAdmin ? (
|
||||
<ToggleCartIcon
|
||||
productId={p.id}
|
||||
disabledReason={p.inStock && p.quantity === 0 ? 'Нет в наличии' : null}
|
||||
/>
|
||||
) : undefined
|
||||
}
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
Reference in New Issue
Block a user