From f15f331de5e04a42f23cf9bd695968320b6bdb2c Mon Sep 17 00:00:00 2001 From: Kirill Date: Thu, 28 May 2026 12:10:24 +0500 Subject: [PATCH] =?UTF-8?q?=D1=8B=D0=B2=D0=B0=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/package-lock.json | 81 ++++++++++--------- client/src/app/layout/MainLayout.tsx | 30 ++++++- .../src/entities/product/ui/ProductCard.tsx | 5 +- .../ui/__tests__/AddToCartButton.test.tsx | 7 +- .../ui/__tests__/ToggleCartIcon.test.tsx | 7 +- client/src/pages/checkout/ui/CheckoutPage.tsx | 6 ++ client/src/pages/home/ui/ProductFilters.tsx | 1 - client/src/shared/config/index.ts | 6 +- .../use-mutation-with-toast.test.tsx | 7 +- client/src/shared/lib/use-page-title.ts | 12 +-- client/src/shared/ui/DemoBanner.tsx | 23 ++++++ client/src/vite-env.d.ts | 1 + .../widgets/reviews-block/ui/ReviewsBlock.tsx | 4 +- 13 files changed, 136 insertions(+), 54 deletions(-) create mode 100644 client/src/shared/ui/DemoBanner.tsx diff --git a/client/package-lock.json b/client/package-lock.json index 225fc6a..b6eb005 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -131,7 +131,6 @@ "integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@babel/code-frame": "^7.29.7", "@babel/generator": "^7.29.7", @@ -473,7 +472,6 @@ } ], "license": "MIT", - "peer": true, "engines": { "node": ">=18" }, @@ -497,7 +495,6 @@ } ], "license": "MIT", - "peer": true, "engines": { "node": ">=18" } @@ -567,7 +564,6 @@ "resolved": "https://registry.npmjs.org/@dicebear/core/-/core-9.4.2.tgz", "integrity": "sha512-MF0042+Z3s8PGZKZLySfhft28bUa3B1iq0e5NSjCvY8gfMi5aIH/iRJGRJa1N9Jz1BNkxYb4yvJ/N9KO8Z6Y+w==", "license": "MIT", - "peer": true, "dependencies": { "@types/json-schema": "^7.0.15" }, @@ -707,6 +703,29 @@ "@dicebear/core": "^9.0.0" } }, + "node_modules/@emnapi/core": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz", + "integrity": "sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "1.2.1", + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.10.0.tgz", + "integrity": "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, "node_modules/@emnapi/wasi-threads": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz", @@ -776,7 +795,6 @@ "resolved": "https://registry.npmjs.org/@emotion/react/-/react-11.14.0.tgz", "integrity": "sha512-O000MLDBDdk/EohJPFUqvnp4qnHeYkVP5B0xEG0D/L7cOKP9kefu2DXn8dj74cQfsEzUqh+sr1RzFqiL1o+PpA==", "license": "MIT", - "peer": true, "dependencies": { "@babel/runtime": "^7.18.3", "@emotion/babel-plugin": "^11.13.5", @@ -820,7 +838,6 @@ "resolved": "https://registry.npmjs.org/@emotion/styled/-/styled-11.14.1.tgz", "integrity": "sha512-qEEJt42DuToa3gurlH4Qqc1kVpNq8wO8cJtDzU46TjlzWjDlsVyevtYCRijVq3SrHsROS+gVQ8Fnea108GnKzw==", "license": "MIT", - "peer": true, "dependencies": { "@babel/runtime": "^7.18.3", "@emotion/babel-plugin": "^11.13.5", @@ -1475,6 +1492,17 @@ "@floating-ui/utils": "^0.2.11" } }, + "node_modules/@floating-ui/dom": { + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.7.6.tgz", + "integrity": "sha512-9gZSAI5XM36880PPMm//9dfiEngYoC6Am2izES1FF406YFsjvyBMmeJ2g4SAju3xWwtuynNRFL2s9hgxpLI5SQ==", + "license": "MIT", + "optional": true, + "dependencies": { + "@floating-ui/core": "^1.7.5", + "@floating-ui/utils": "^0.2.11" + } + }, "node_modules/@floating-ui/utils": { "version": "0.2.11", "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.11.tgz", @@ -1739,7 +1767,6 @@ "resolved": "https://registry.npmjs.org/@mui/material/-/material-9.0.1.tgz", "integrity": "sha512-voyCpeUxcSWLN7KPZuq0pGCIt726T9K6kiVM3XUcywZDAlZSarLHaUxJVQpospbjjOzN53hwyjo8s6KoWl6utw==", "license": "MIT", - "peer": true, "dependencies": { "@babel/runtime": "^7.29.2", "@mui/core-downloads-tracker": "^9.0.1", @@ -2709,7 +2736,6 @@ "resolved": "https://registry.npmjs.org/@tiptap/core/-/core-3.23.6.tgz", "integrity": "sha512-MRB3pHz4Oxqmcawh0cQ5iOGdY5xtNYp/1CoK7hdTLzw5K0C6/gTC2VvanB1R4INaB6EpBkxG/GiWkVirDRnuXw==", "license": "MIT", - "peer": true, "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" @@ -2932,7 +2958,6 @@ "resolved": "https://registry.npmjs.org/@tiptap/extension-list/-/extension-list-3.23.6.tgz", "integrity": "sha512-z6vj9+Qht2sjdQkyyHcUpsC/yCIZqTrQiyHDhs/HGKrfvoANyAZGpqdNeKf1wSyjIso+27tQuIH5NDfk8ygyNw==", "license": "MIT", - "peer": true, "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" @@ -3051,7 +3076,6 @@ "resolved": "https://registry.npmjs.org/@tiptap/extensions/-/extensions-3.23.6.tgz", "integrity": "sha512-X09/Db1teB+ifXzDGVVFmOeQRx7wTAayE9/280spxpsHkHZvJ5bHRvWIzUzviMIjbBz+NPDIKYPK7gMfh9iaig==", "license": "MIT", - "peer": true, "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" @@ -3066,7 +3090,6 @@ "resolved": "https://registry.npmjs.org/@tiptap/pm/-/pm-3.23.6.tgz", "integrity": "sha512-in5CaMaWlJcH2A1q6GJKFtrodE8WLS3M9tIi/f89jPmIVHJShpodC0KZDNyJkrVBQomYk0DEh86Utm6ASXzQww==", "license": "MIT", - "peer": true, "dependencies": { "prosemirror-changeset": "^2.3.0", "prosemirror-commands": "^1.6.2", @@ -3165,7 +3188,8 @@ "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", "integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/@types/chai": { "version": "5.2.3", @@ -3210,7 +3234,6 @@ "integrity": "sha512-GUUEShf+PBCGW2KaXwcIt3Yk+e3pkKwWKb9GSyM9WQVE+ep2jzmHdGsHzu4wgcZy5fN9FBdVzjpBQsYlpfpgLA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "undici-types": "~7.16.0" } @@ -3232,7 +3255,6 @@ "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.15.tgz", "integrity": "sha512-eRwcGNHve+E8qtEQSSRl6urh+rFop4v8gm6O8rGv25CodbvFdLjA1vVQ1KkiFE0w0UPOnb8tDiFKL5lp0rtY5Q==", "license": "MIT", - "peer": true, "dependencies": { "csstype": "^3.2.2" } @@ -3242,7 +3264,6 @@ "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.3.tgz", "integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==", "license": "MIT", - "peer": true, "peerDependencies": { "@types/react": "^19.2.0" } @@ -3316,7 +3337,6 @@ "integrity": "sha512-fcqpj/MyK4sxDPcbe7STNPbpQL4RLZOPWuaTmwZYuc+hJKzRf58yRxfhqGpc6PIq9ZyfSBpfHgmUHmHs0KwHwg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.60.0", "@typescript-eslint/types": "8.60.0", @@ -3505,7 +3525,6 @@ "integrity": "sha512-HtXuPfrHTyBDkameWpl+vJb1Uevu2tznAyahM1Oc4AENidCLTPiZDWIo4GfcxNdC/RcfGcadzzkqbRG87dUrQA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.9.1", "@typescript-eslint/scope-manager": "8.60.0", @@ -4048,7 +4067,6 @@ "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==", "dev": true, "license": "MIT", - "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -4101,6 +4119,7 @@ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=8" } @@ -4454,7 +4473,6 @@ } ], "license": "MIT", - "peer": true, "dependencies": { "baseline-browser-mapping": "^2.10.12", "caniuse-lite": "^1.0.30001782", @@ -4964,7 +4982,8 @@ "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz", "integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/dom-helpers": { "version": "5.2.1", @@ -5011,7 +5030,6 @@ } ], "license": "MIT", - "peer": true, "engines": { "node": ">=11.0.0" } @@ -5265,7 +5283,6 @@ "dev": true, "hasInstallScript": true, "license": "MIT", - "peer": true, "bin": { "esbuild": "bin/esbuild" }, @@ -5329,7 +5346,6 @@ "integrity": "sha512-XoMjdBOwe/esVgEvLmNsD3IRHkm7fbKIUGvrleloJXUZgDHig2IPWNniv+GwjyJXzuNqVjlr5+4yVUZjycJwfQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -5390,7 +5406,6 @@ "integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==", "dev": true, "license": "MIT", - "peer": true, "bin": { "eslint-config-prettier": "bin/cli.js" }, @@ -5538,7 +5553,6 @@ "integrity": "sha512-rM9K8UBHcWKpzQzStn1YRN2T5NvdeIfSVoKu/lKF41znQXHAUcBbYXe5wd6GNjZjTrP7viQ49n1D83x/2gYgIw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@package-json/types": "^0.0.12", "@typescript-eslint/types": "^8.56.0", @@ -7594,6 +7608,7 @@ "integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==", "dev": true, "license": "MIT", + "peer": true, "bin": { "lz-string": "bin/bin.js" } @@ -7613,7 +7628,6 @@ "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-5.24.0.tgz", "integrity": "sha512-ALyFxgtd5R+65UqZ/++lOqwWcC0SNho9c27fYSyLmG7AfnAul2o46F05aDJGPbFU57wos9dgcIySHs0Xe6ia3A==", "license": "BSD-3-Clause", - "peer": true, "dependencies": { "@mapbox/jsonlint-lines-primitives": "^2.0.2", "@mapbox/point-geometry": "^1.1.0", @@ -8194,7 +8208,6 @@ "integrity": "sha512-7igPTM53cGHMW8xWuVTydi2KO233VFiTNyF5hLJqpilHfmn8C8gPf+PS7dUT64YcXFbiMGZxS9pCSxL/Dxm/Jw==", "dev": true, "license": "MIT", - "peer": true, "bin": { "prettier": "bin/prettier.cjs" }, @@ -8224,6 +8237,7 @@ "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "ansi-regex": "^5.0.1", "ansi-styles": "^5.0.0", @@ -8239,6 +8253,7 @@ "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=10" }, @@ -8251,7 +8266,8 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", "dev": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/prop-types": { "version": "15.8.1", @@ -8435,7 +8451,6 @@ "resolved": "https://registry.npmjs.org/react/-/react-19.2.6.tgz", "integrity": "sha512-sfWGGfavi0xr8Pg0sVsyHMAOziVYKgPLNrS7ig+ivMNb3wbCBw3KxtflsGBAwD3gYQlE/AEZsTLgToRrSCjb0Q==", "license": "MIT", - "peer": true, "engines": { "node": ">=0.10.0" } @@ -8445,7 +8460,6 @@ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.6.tgz", "integrity": "sha512-0prMI+hvBbPjsWnxDLxlCGyM8PN6UuWjEUCYmZhO67xIV9Xasa/r/vDnq+Xyq4Lo27g8QSbO5YzARu0D1Sps3g==", "license": "MIT", - "peer": true, "dependencies": { "scheduler": "^0.27.0" }, @@ -9477,7 +9491,6 @@ "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=12" }, @@ -9698,7 +9711,6 @@ "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==", "dev": true, "license": "Apache-2.0", - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -9895,7 +9907,6 @@ "integrity": "sha512-s4BJJ+5y1pYL6Otw51FHhVJQhPnuRinKig64g/1+EUNaJsd3gCKdD31IPFvswUgW9/60QT9oFHbZHbQK5imcxw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "lightningcss": "^1.32.0", "picomatch": "^4.0.4", @@ -10015,7 +10026,6 @@ "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=12" }, @@ -10235,7 +10245,6 @@ "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=12" }, @@ -10249,7 +10258,6 @@ "integrity": "sha512-/4XH147Ui7OGTjg3HbdWe5arnZQSbfuRzdr9Ec7TQi5I7R+ir0Rlc9GIvD4v0XZurELqA035KVXJXpR61xhiTA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "esbuild": "^0.27.0", "fdir": "^6.5.0", @@ -10590,7 +10598,6 @@ "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==", "dev": true, "license": "MIT", - "peer": true, "funding": { "url": "https://github.com/sponsors/colinhacks" } diff --git a/client/src/app/layout/MainLayout.tsx b/client/src/app/layout/MainLayout.tsx index 13d1881..3faa34b 100644 --- a/client/src/app/layout/MainLayout.tsx +++ b/client/src/app/layout/MainLayout.tsx @@ -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) { + @@ -42,7 +44,12 @@ export function MainLayout({ children }: PropsWithChildren) { - + {STORE_NAME} @@ -50,7 +57,12 @@ export function MainLayout({ children }: PropsWithChildren) { - + Покупателям @@ -66,7 +78,12 @@ export function MainLayout({ children }: PropsWithChildren) { - + Контакты @@ -95,7 +112,12 @@ export function MainLayout({ children }: PropsWithChildren) { - + Юридическая информация diff --git a/client/src/entities/product/ui/ProductCard.tsx b/client/src/entities/product/ui/ProductCard.tsx index 72c32eb..265397b 100644 --- a/client/src/entities/product/ui/ProductCard.tsx +++ b/client/src/entities/product/ui/ProductCard.tsx @@ -78,7 +78,10 @@ const ProductCardInner = ({ product, mediaHeight = 390, actions }: Props) => { > {imageUrls.length ? ( - + { 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', + }) }) }) }) diff --git a/client/src/features/cart/toggle-cart-icon/ui/__tests__/ToggleCartIcon.test.tsx b/client/src/features/cart/toggle-cart-icon/ui/__tests__/ToggleCartIcon.test.tsx index aa4205c..0a4b908 100644 --- a/client/src/features/cart/toggle-cart-icon/ui/__tests__/ToggleCartIcon.test.tsx +++ b/client/src/features/cart/toggle-cart-icon/ui/__tests__/ToggleCartIcon.test.tsx @@ -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', + }) }) }) diff --git a/client/src/pages/checkout/ui/CheckoutPage.tsx b/client/src/pages/checkout/ui/CheckoutPage.tsx index 03eb7ab..c31b31d 100644 --- a/client/src/pages/checkout/ui/CheckoutPage.tsx +++ b/client/src/pages/checkout/ui/CheckoutPage.tsx @@ -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 ( + {IS_DEMO_MODE && ( + + Оформление заказа недоступно в демо-режиме. Заказ не будет создан. + + )} Оформление заказа diff --git a/client/src/pages/home/ui/ProductFilters.tsx b/client/src/pages/home/ui/ProductFilters.tsx index b0014bc..0bae600 100644 --- a/client/src/pages/home/ui/ProductFilters.tsx +++ b/client/src/pages/home/ui/ProductFilters.tsx @@ -181,7 +181,6 @@ export function ProductFilters({ - diff --git a/client/src/shared/config/index.ts b/client/src/shared/config/index.ts index 95c402a..1c35776 100644 --- a/client/src/shared/config/index.ts +++ b/client/src/shared/config/index.ts @@ -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' diff --git a/client/src/shared/lib/__tests__/use-mutation-with-toast.test.tsx b/client/src/shared/lib/__tests__/use-mutation-with-toast.test.tsx index 7cddc99..ee29139 100644 --- a/client/src/shared/lib/__tests__/use-mutation-with-toast.test.tsx +++ b/client/src/shared/lib/__tests__/use-mutation-with-toast.test.tsx @@ -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(), diff --git a/client/src/shared/lib/use-page-title.ts b/client/src/shared/lib/use-page-title.ts index e968072..6f0b251 100644 --- a/client/src/shared/lib/use-page-title.ts +++ b/client/src/shared/lib/use-page-title.ts @@ -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]) } diff --git a/client/src/shared/ui/DemoBanner.tsx b/client/src/shared/ui/DemoBanner.tsx new file mode 100644 index 0000000..72e8509 --- /dev/null +++ b/client/src/shared/ui/DemoBanner.tsx @@ -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 ( + + + Сайт работает в демо-режиме. Заказы не оформляются. Скоро открытие! + + + ) +} diff --git a/client/src/vite-env.d.ts b/client/src/vite-env.d.ts index 327f37b..693e4a3 100644 --- a/client/src/vite-env.d.ts +++ b/client/src/vite-env.d.ts @@ -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 { diff --git a/client/src/widgets/reviews-block/ui/ReviewsBlock.tsx b/client/src/widgets/reviews-block/ui/ReviewsBlock.tsx index 0311e36..a26f5e4 100644 --- a/client/src/widgets/reviews-block/ui/ReviewsBlock.tsx +++ b/client/src/widgets/reviews-block/ui/ReviewsBlock.tsx @@ -32,7 +32,9 @@ export function ReviewsBlock() { return ( - Отзывы + + Отзывы + Последние отзывы о товарах