ывав
This commit is contained in:
@@ -11,6 +11,7 @@ import { AppHeader } from '@/app/layout/AppHeader'
|
||||
import vkLogoSrc from '@/shared/assets/vk-logo.svg'
|
||||
import { STORE_EMAIL, STORE_NAME, STORE_PHONE, VK_URL } from '@/shared/config'
|
||||
import { CookieConsentBanner } from '@/shared/ui/CookieConsentBanner'
|
||||
import { DemoBanner } from '@/shared/ui/DemoBanner'
|
||||
import { ScrollOnNavigate } from '@/shared/ui/ScrollOnNavigate'
|
||||
import { ScrollToTop } from '@/shared/ui/ScrollToTop'
|
||||
|
||||
@@ -22,6 +23,7 @@ export function MainLayout({ children }: PropsWithChildren) {
|
||||
<ScrollOnNavigate />
|
||||
<ScrollToTop />
|
||||
<AppHeader />
|
||||
<DemoBanner />
|
||||
|
||||
<Box component="main" sx={{ flex: 1, py: { xs: 3, md: 5 } }}>
|
||||
<Container maxWidth="xl" sx={{ px: { xs: 2, sm: 3, md: 4 } }}>
|
||||
@@ -42,7 +44,12 @@ export function MainLayout({ children }: PropsWithChildren) {
|
||||
<Container maxWidth="xl" sx={{ px: { xs: 2, sm: 3, md: 4 } }}>
|
||||
<Grid container spacing={5}>
|
||||
<Grid size={{ xs: 12, sm: 6, md: 3 }}>
|
||||
<Typography variant="subtitle1" component="h4" gutterBottom sx={{ fontWeight: 700, letterSpacing: '-0.5px' }}>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
component="h4"
|
||||
gutterBottom
|
||||
sx={{ fontWeight: 700, letterSpacing: '-0.5px' }}
|
||||
>
|
||||
{STORE_NAME}
|
||||
</Typography>
|
||||
<Typography variant="body2" color="text.secondary" sx={{ mt: 1, maxWidth: 260 }}>
|
||||
@@ -50,7 +57,12 @@ export function MainLayout({ children }: PropsWithChildren) {
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid size={{ xs: 12, sm: 6, md: 3 }}>
|
||||
<Typography variant="subtitle1" component="h4" gutterBottom sx={{ fontWeight: 600, letterSpacing: '-0.25px' }}>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
component="h4"
|
||||
gutterBottom
|
||||
sx={{ fontWeight: 600, letterSpacing: '-0.25px' }}
|
||||
>
|
||||
Покупателям
|
||||
</Typography>
|
||||
<Stack spacing={1.5}>
|
||||
@@ -66,7 +78,12 @@ export function MainLayout({ children }: PropsWithChildren) {
|
||||
</Stack>
|
||||
</Grid>
|
||||
<Grid size={{ xs: 12, sm: 6, md: 3 }}>
|
||||
<Typography variant="subtitle1" component="h4" gutterBottom sx={{ fontWeight: 600, letterSpacing: '-0.25px' }}>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
component="h4"
|
||||
gutterBottom
|
||||
sx={{ fontWeight: 600, letterSpacing: '-0.25px' }}
|
||||
>
|
||||
Контакты
|
||||
</Typography>
|
||||
<Stack spacing={1}>
|
||||
@@ -95,7 +112,12 @@ export function MainLayout({ children }: PropsWithChildren) {
|
||||
</Stack>
|
||||
</Grid>
|
||||
<Grid size={{ xs: 12, sm: 6, md: 3 }}>
|
||||
<Typography variant="subtitle1" component="h4" gutterBottom sx={{ fontWeight: 600, letterSpacing: '-0.25px' }}>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
component="h4"
|
||||
gutterBottom
|
||||
sx={{ fontWeight: 600, letterSpacing: '-0.25px' }}
|
||||
>
|
||||
Юридическая информация
|
||||
</Typography>
|
||||
<Stack spacing={1.5}>
|
||||
|
||||
@@ -78,7 +78,10 @@ const ProductCardInner = ({ product, mediaHeight = 390, actions }: Props) => {
|
||||
>
|
||||
<Box sx={{ position: 'relative' }}>
|
||||
{imageUrls.length ? (
|
||||
<Box onMouseMove={!isMobile ? onMouseMove : undefined} sx={{ width: '100%', aspectRatio: '3/4', maxHeight: mediaHeight, overflow: 'hidden' }}>
|
||||
<Box
|
||||
onMouseMove={!isMobile ? onMouseMove : undefined}
|
||||
sx={{ width: '100%', aspectRatio: '3/4', maxHeight: mediaHeight, overflow: 'hidden' }}
|
||||
>
|
||||
<Swiper
|
||||
slidesPerView={1}
|
||||
spaceBetween={16}
|
||||
|
||||
@@ -32,7 +32,12 @@ describe('AddToCartButton', () => {
|
||||
fireEvent.click(screen.getByRole('button', { name: /в корзину/i }))
|
||||
|
||||
await vi.waitFor(() => {
|
||||
expect(spy).toHaveBeenCalledWith({ type: 'success', message: 'Товар добавлен в корзину', actionLabel: 'Перейти в корзину', actionPath: '/cart' })
|
||||
expect(spy).toHaveBeenCalledWith({
|
||||
type: 'success',
|
||||
message: 'Товар добавлен в корзину',
|
||||
actionLabel: 'Перейти в корзину',
|
||||
actionPath: '/cart',
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -38,7 +38,12 @@ describe('ToggleCartIcon', () => {
|
||||
fireEvent.click(screen.getByRole('button', { name: /в корзину/i }))
|
||||
|
||||
await vi.waitFor(() => {
|
||||
expect(spy).toHaveBeenCalledWith({ type: 'success', message: 'Товар добавлен в корзину', actionLabel: 'Перейти в корзину', actionPath: '/cart' })
|
||||
expect(spy).toHaveBeenCalledWith({
|
||||
type: 'success',
|
||||
message: 'Товар добавлен в корзину',
|
||||
actionLabel: 'Перейти в корзину',
|
||||
actionPath: '/cart',
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import { DELIVERY_CARRIER_OPTIONS, type DeliveryCarrierCode } from '@/shared/con
|
||||
import { formatPriceRub } from '@/shared/lib/format-price'
|
||||
import { getApiErrorMessage } from '@/shared/lib/get-api-error-message'
|
||||
import { $user } from '@/shared/model/auth'
|
||||
import { IS_DEMO_MODE } from '@/shared/config'
|
||||
|
||||
export function CheckoutPage() {
|
||||
const user = useUnit($user)
|
||||
@@ -81,6 +82,11 @@ export function CheckoutPage() {
|
||||
|
||||
return (
|
||||
<Box>
|
||||
{IS_DEMO_MODE && (
|
||||
<Alert severity="warning" sx={{ mb: 2 }}>
|
||||
Оформление заказа недоступно в демо-режиме. Заказ не будет создан.
|
||||
</Alert>
|
||||
)}
|
||||
<Typography variant="h4" gutterBottom>
|
||||
Оформление заказа
|
||||
</Typography>
|
||||
|
||||
@@ -181,7 +181,6 @@ export function ProductFilters({
|
||||
</Select>
|
||||
</FormControl>
|
||||
</Stack>
|
||||
|
||||
</Paper>
|
||||
</Collapse>
|
||||
</Stack>
|
||||
|
||||
@@ -21,5 +21,7 @@ export const VK_URL = import.meta.env.VITE_VK_URL ?? 'https://vk.com/club1583958
|
||||
export const STORE_OP_NAME = 'Комарова Лариса Николаевна'
|
||||
export const STORE_OP_TYPE = 'Самозанятый'
|
||||
export const STORE_OP_INN = '591878584346'
|
||||
export const STORE_OP_ADDR =
|
||||
'618900, Россия, Пермский край, Лысьвенский муниципальный округ, Лысьва, улица Мира, 34'
|
||||
export const STORE_OP_ADDR = '618900, Россия, Пермский край, Лысьвенский муниципальный округ, Лысьва, улица Мира, 34'
|
||||
|
||||
/** Демо-режим: баннеры «скоро открытие», предупреждения в чекауте. Включается через VITE_DEMO_MODE=true. */
|
||||
export const IS_DEMO_MODE = import.meta.env.VITE_DEMO_MODE === 'true'
|
||||
|
||||
@@ -48,7 +48,12 @@ describe('useMutationWithToast', () => {
|
||||
})
|
||||
|
||||
it('calls user-provided onSuccess callback', async () => {
|
||||
const onSuccess: (data: { ok: boolean }, variables: void, onMutateResult: unknown, mutationContext: unknown) => void = vi.fn()
|
||||
const onSuccess: (
|
||||
data: { ok: boolean },
|
||||
variables: void,
|
||||
onMutateResult: unknown,
|
||||
mutationContext: unknown,
|
||||
) => void = vi.fn()
|
||||
const mutationFn = (): Promise<{ ok: boolean }> => Promise.resolve({ ok: true })
|
||||
const { result } = renderHook(() => useMutationWithToast({ mutationFn, onSuccess, successMessage: 'OK' }), {
|
||||
wrapper: createWrapper(),
|
||||
|
||||
@@ -3,12 +3,12 @@ import { useLocation } from 'react-router-dom'
|
||||
|
||||
const BASE_TITLE = 'Любимый Креатив — Изделия ручной работы'
|
||||
|
||||
let currentTitle: string = BASE_TITLE
|
||||
let didPageTitleSet = false
|
||||
|
||||
export function usePageTitle(title: string | null) {
|
||||
useEffect(() => {
|
||||
currentTitle = title ? `${title} — Любимый Креатив` : BASE_TITLE
|
||||
document.title = currentTitle
|
||||
didPageTitleSet = true
|
||||
document.title = title ? `${title} — Любимый Креатив` : BASE_TITLE
|
||||
}, [title])
|
||||
}
|
||||
|
||||
@@ -16,7 +16,9 @@ export function usePageTitleReset() {
|
||||
const location = useLocation()
|
||||
|
||||
useEffect(() => {
|
||||
document.title = BASE_TITLE
|
||||
currentTitle = BASE_TITLE
|
||||
if (!didPageTitleSet) {
|
||||
document.title = BASE_TITLE
|
||||
}
|
||||
didPageTitleSet = false
|
||||
}, [location.pathname])
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import Alert from '@mui/material/Alert'
|
||||
import Box from '@mui/material/Box'
|
||||
import { IS_DEMO_MODE } from '@/shared/config'
|
||||
|
||||
export function DemoBanner() {
|
||||
if (!IS_DEMO_MODE) return null
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<Alert
|
||||
severity="warning"
|
||||
variant="filled"
|
||||
sx={{
|
||||
borderRadius: 0,
|
||||
justifyContent: 'center',
|
||||
'& .MuiAlert-message': { textAlign: 'center' },
|
||||
}}
|
||||
>
|
||||
Сайт работает в демо-режиме. Заказы не оформляются. Скоро открытие!
|
||||
</Alert>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
Vendored
+1
@@ -7,6 +7,7 @@ interface ImportMetaEnv {
|
||||
readonly VITE_STORE_EMAIL?: string
|
||||
readonly VITE_STORE_PHONE?: string
|
||||
readonly VITE_STORE_SOCIAL_NOTE?: string
|
||||
readonly VITE_DEMO_MODE?: string
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
|
||||
@@ -32,7 +32,9 @@ export function ReviewsBlock() {
|
||||
return (
|
||||
<Paper variant="outlined" sx={{ p: { xs: 2, sm: 3 }, borderRadius: 2, bgcolor: 'background.paper' }}>
|
||||
<Stack spacing={0.75} sx={{ mb: 2 }}>
|
||||
<Typography variant="h5" component="h3">Отзывы</Typography>
|
||||
<Typography variant="h5" component="h3">
|
||||
Отзывы
|
||||
</Typography>
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
Последние отзывы о товарах
|
||||
</Typography>
|
||||
|
||||
Reference in New Issue
Block a user