From 425451c75612b2504dfc3e1f37b46cc2c782246a Mon Sep 17 00:00:00 2001 From: Yulia Avramenko Date: Fri, 2 Feb 2024 12:53:45 +0300 Subject: [PATCH 1/9] #140-api-inserted-to-BlogBlock --- .../StoreProvider/config/StateSchema.ts | 2 ++ .../providers/StoreProvider/config/store.ts | 4 ++- src/entities/BlogCard/BlogCard.module.scss | 16 +++++---- src/entities/BlogCard/BlogCard.stories.tsx | 11 +++---- src/entities/BlogCard/BlogCard.tsx | 33 ++++++++++++++----- src/entities/NewsCard/NewsCard.module.scss | 1 + src/entities/NewsCard/NewsCard.tsx | 4 +-- src/shared/api/types.ts | 3 +- src/shared/constants/constants.ts | 8 +++++ .../BlogBlock/model/selectors/selectiors.ts | 6 ++++ .../BlogBlock/model/services/getBlogPosts.ts | 23 +++++++++++++ .../BlogBlock/model/slice/blogPostsSlice.ts | 29 ++++++++++++++++ src/widgets/BlogBlock/model/types/types.ts | 32 ++++++++++++++++++ .../BlogBlock/ui/BlogBlock.stories.tsx | 3 +- src/widgets/BlogBlock/ui/BlogBlock.tsx | 18 +++++++--- .../NewsBlock/model/selectors/selectors.ts | 1 + .../NewsBlock/model/services/getShopNews.ts | 3 +- .../NewsBlock/model/slice/shopNewsSlice.ts | 3 +- 18 files changed, 167 insertions(+), 33 deletions(-) create mode 100644 src/widgets/BlogBlock/model/selectors/selectiors.ts create mode 100644 src/widgets/BlogBlock/model/services/getBlogPosts.ts create mode 100644 src/widgets/BlogBlock/model/slice/blogPostsSlice.ts create mode 100644 src/widgets/BlogBlock/model/types/types.ts diff --git a/src/app/providers/StoreProvider/config/StateSchema.ts b/src/app/providers/StoreProvider/config/StateSchema.ts index 825738f8..d64c1785 100644 --- a/src/app/providers/StoreProvider/config/StateSchema.ts +++ b/src/app/providers/StoreProvider/config/StateSchema.ts @@ -5,6 +5,7 @@ import { BrandSchema } from '@/widgets/BrandBlock/types/types' import { ApiInstance } from '@/shared/api/api' import { ShopNewsSchema } from '@/widgets/NewsBlock/model/types/types' import { StoreReviewsSchema } from '@/widgets/ReviewsBlock/model/types/types' +import { IBlogPostsSchema } from '@/widgets/BlogBlock/model/types/types' export interface StateSchema { login: LoginSchema @@ -13,6 +14,7 @@ export interface StateSchema { brand: BrandSchema searchResult: SearchResultSchema shopNews: ShopNewsSchema + blogPosts: IBlogPostsSchema } export interface ThunkExtraArg { diff --git a/src/app/providers/StoreProvider/config/store.ts b/src/app/providers/StoreProvider/config/store.ts index cfa74dde..89bc795e 100644 --- a/src/app/providers/StoreProvider/config/store.ts +++ b/src/app/providers/StoreProvider/config/store.ts @@ -7,6 +7,7 @@ import brandSlice from '@/widgets/BrandBlock/slice/brandSlice' import searchProductSlice from '@/features/SearchProduct/slice/searchProductSlice' import { storeReviewsReducer } from '@/widgets/ReviewsBlock/model/slice/reviewsSlice' import { shopNewsReducer } from '@/widgets/NewsBlock/model/slice/shopNewsSlice' +import { blogPostsReducer } from '@/widgets/BlogBlock/model/slice/blogPostsSlice' export type RootState = StateSchema @@ -16,7 +17,8 @@ const rootReducer: ReducersMapObject = { brand: brandSlice, searchResult: searchProductSlice, storeReviews: storeReviewsReducer, - shopNews: shopNewsReducer + shopNews: shopNewsReducer, + blogPosts: blogPostsReducer } export function createReduxStore(initialState: RootState) { diff --git a/src/entities/BlogCard/BlogCard.module.scss b/src/entities/BlogCard/BlogCard.module.scss index 5ee6b802..a6175bb4 100644 --- a/src/entities/BlogCard/BlogCard.module.scss +++ b/src/entities/BlogCard/BlogCard.module.scss @@ -1,6 +1,7 @@ @use '@/app/styles/index' as var; .card { + max-width: 340px; min-width: 340px; position: relative; transition: transform 0.3s ease-in-out; @@ -14,12 +15,6 @@ transition: transform 0.3s ease-in-out; } - img { - border-radius: 6px; - transition: transform 0.3s ease-in-out; - scroll-snap-align: start; - } - .heading { font-size: #{'min(max(14px, 1.2vw), 16px)'}; @@ -32,5 +27,14 @@ span { color: var.$body-color-light-grey; } + + .img { + height: 462px; + width: 100%; + border-radius: 6px; + transition: transform 0.3s ease-in-out; + scroll-snap-align: start; + object-fit: cover; + } } \ No newline at end of file diff --git a/src/entities/BlogCard/BlogCard.stories.tsx b/src/entities/BlogCard/BlogCard.stories.tsx index 52f4421e..d571daec 100644 --- a/src/entities/BlogCard/BlogCard.stories.tsx +++ b/src/entities/BlogCard/BlogCard.stories.tsx @@ -16,12 +16,9 @@ type Story = StoryObj export const Default: Story = { args: { - card: { - id: 1, - src: Img1, - alt: 'Покупай и не жди. До -50% на весь электротранспорт!', - title: 'Покупай и не жди. До -50% на весь электротранспорт!', - date: '8 Мая, 2022' - } + id: 1, + image: Img1, + title: 'Покупай и не жди. До -50% на весь электротранспорт!', + date: '2022-07-8' } } diff --git a/src/entities/BlogCard/BlogCard.tsx b/src/entities/BlogCard/BlogCard.tsx index f4f64202..c189ae9b 100644 --- a/src/entities/BlogCard/BlogCard.tsx +++ b/src/entities/BlogCard/BlogCard.tsx @@ -1,26 +1,41 @@ -import { FC } from 'react' -import { TCard } from '@/models/CardModel' +import { FC, useMemo } from 'react' import styles from './BlogCard.module.scss' import Link from '@/shared/ui/Link/Link' import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' +import NoImage from '@/assets/icons/image-not-found-icon.svg' -export type Props = { - card: TCard +type Props = { + id: number + image: string + title: string + date: string } /** * Карточка из блока блог - * @param {TCard} card - параметры карточки из блога + * @param {Props} card - параметры карточки из блога */ -const BlogCard: FC = ({ card }) => { +const BlogCard: FC = ({ image, date, title }) => { + const newDate = useMemo(() => { + const _parsedDate = new Date(date) + const year = _parsedDate.getFullYear() + const formatter = new Intl.DateTimeFormat('ru', { month: 'long', day: 'numeric' }).format(_parsedDate) + + return `${formatter}, ${year}` + }, [date]) + return ( - {card.alt} + {image ? ( + {'новость'} + ) : ( + + )} - {card.title} + {title} - {card.date} + {newDate} ) } diff --git a/src/entities/NewsCard/NewsCard.module.scss b/src/entities/NewsCard/NewsCard.module.scss index 8f3ed61f..52fad4c9 100644 --- a/src/entities/NewsCard/NewsCard.module.scss +++ b/src/entities/NewsCard/NewsCard.module.scss @@ -48,5 +48,6 @@ border-radius: 6px; transition: transform 0.3s ease-in-out; scroll-snap-align: start; + object-fit: cover; } } \ No newline at end of file diff --git a/src/entities/NewsCard/NewsCard.tsx b/src/entities/NewsCard/NewsCard.tsx index 5a581025..7c403a95 100644 --- a/src/entities/NewsCard/NewsCard.tsx +++ b/src/entities/NewsCard/NewsCard.tsx @@ -4,7 +4,7 @@ import Link from '@/shared/ui/Link/Link' import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' import NoImage from '@/assets/icons/image-not-found-icon.svg' -export type Props = { +type Props = { id: number image: string date: string @@ -13,7 +13,7 @@ export type Props = { /** * Карточка из блока группы новостей - * @param {TCard} card - параметры карточки из группы новостей + * @param {Props} card - параметры карточки из группы новостей */ const NewsCard: FC = ({ image, date, title }) => { diff --git a/src/shared/api/types.ts b/src/shared/api/types.ts index 7ec8a5dc..4e9fc3cb 100644 --- a/src/shared/api/types.ts +++ b/src/shared/api/types.ts @@ -5,7 +5,8 @@ export enum ApiRoutes { SEARCH = 'search', STORE_REVIEWS = 'store-reviews', CATEGORIES = 'catalogue/category', - SHOP_NEWS = 'shopnews' + SHOP_NEWS = 'shopnews', + BLOG_POSTS = 'shopblog/posts' } export enum ApiErrorTypes { diff --git a/src/shared/constants/constants.ts b/src/shared/constants/constants.ts index ff3f1a8a..82b96e43 100644 --- a/src/shared/constants/constants.ts +++ b/src/shared/constants/constants.ts @@ -31,3 +31,11 @@ export const MAX_PRODUCTS_NUMBER: number = 99 //for BrandBlock component export const BRANDS_FOR_MAIN_NUMBER: number = 6 + +// Actions +export const ACTION_GET_SHOP_NEWS = 'get-shop-news' +export const ACTION_GET_BLOG_POSTS = 'get-blog-posts' + +// Reducers +export const REDUCER_SHOP_NEWS = 'shopNews' +export const REDUCER_BLOG_POSTS = 'shopBlogPosts' diff --git a/src/widgets/BlogBlock/model/selectors/selectiors.ts b/src/widgets/BlogBlock/model/selectors/selectiors.ts new file mode 100644 index 00000000..20da3eba --- /dev/null +++ b/src/widgets/BlogBlock/model/selectors/selectiors.ts @@ -0,0 +1,6 @@ +import { StateSchema } from '@/app/providers/StoreProvider' + +export const getBlogPostsSelector = (state: StateSchema) => { + //console.log('Selector BlogPosts', state.blogPosts.posts) + return state.blogPosts.posts +} diff --git a/src/widgets/BlogBlock/model/services/getBlogPosts.ts b/src/widgets/BlogBlock/model/services/getBlogPosts.ts new file mode 100644 index 00000000..cb844975 --- /dev/null +++ b/src/widgets/BlogBlock/model/services/getBlogPosts.ts @@ -0,0 +1,23 @@ +import { createAsyncThunk } from '@reduxjs/toolkit' +import { ThunkConfig } from '@/app/providers/StoreProvider/config/StateSchema' +import { ApiError, ApiErrorTypes, ApiRoutes } from '@/shared/api/types' +import { apiErrorIdentify } from '@/shared/api/apiErrorIdentify' +import { IBlogPostData } from '../types/types' +import { ACTION_GET_BLOG_POSTS } from '@/shared/constants/constants' + +// export const getStoreReviews = createAsyncThunk>( +export const getBlogPosts = createAsyncThunk>( + //void1- выходные данные, void2- входные данные , thunkConfig- тип store + ACTION_GET_BLOG_POSTS, // action type, первый аргумент + async (_, thunkAPI) => { + // второй аргумент- асинхронная функция , кот вызовет dispatch в компоненте + const { rejectWithValue, extra } = thunkAPI + try { + const { data } = await extra.api.get(ApiRoutes.BLOG_POSTS) + + return data.results + } catch (error) { + return rejectWithValue(apiErrorIdentify(error, ApiErrorTypes.DATA_EMPTY_ERROR)) + } + } +) diff --git a/src/widgets/BlogBlock/model/slice/blogPostsSlice.ts b/src/widgets/BlogBlock/model/slice/blogPostsSlice.ts new file mode 100644 index 00000000..c60a5848 --- /dev/null +++ b/src/widgets/BlogBlock/model/slice/blogPostsSlice.ts @@ -0,0 +1,29 @@ +import { createSlice } from '@reduxjs/toolkit' +import { IBlogPostsSchema } from '../types/types' +import { getBlogPosts } from '../services/getBlogPosts' +import { REDUCER_BLOG_POSTS } from '@/shared/constants/constants' + +const initialState: IBlogPostsSchema = { + isLoading: false, + posts: [] +} + +export const blogPostsSlice = createSlice({ + name: REDUCER_BLOG_POSTS, + initialState, + reducers: {}, + extraReducers: builder => { + builder + .addCase(getBlogPosts.pending, state => { + state.isLoading = true + }) + .addCase(getBlogPosts.fulfilled, (state, { payload }) => { + state.isLoading = false + state.posts = payload + }) + .addCase(getBlogPosts.rejected, state => { + state.isLoading = false + }) + } +}) +export const { actions: blogPostsActions, reducer: blogPostsReducer } = blogPostsSlice diff --git a/src/widgets/BlogBlock/model/types/types.ts b/src/widgets/BlogBlock/model/types/types.ts new file mode 100644 index 00000000..baf4e95a --- /dev/null +++ b/src/widgets/BlogBlock/model/types/types.ts @@ -0,0 +1,32 @@ +export interface IPaginatedResponse { + count: number + previous: string + next: string + results: T[] +} +export interface IBlogTagData { + name: string +} +export interface TBlogCategoryLight { + title: string + slug: string +} +export interface IBlogPostData { + id: number + title: string + text: string + pub_date: string + author: string + image: string + category: TBlogCategoryLight + tags: IBlogTagData[] + views: number + slug: string + meta_title: string + meta_description: string +} + +export interface IBlogPostsSchema { + isLoading: boolean + posts: IBlogPostData[] +} diff --git a/src/widgets/BlogBlock/ui/BlogBlock.stories.tsx b/src/widgets/BlogBlock/ui/BlogBlock.stories.tsx index 1c9ee805..dae2de1e 100644 --- a/src/widgets/BlogBlock/ui/BlogBlock.stories.tsx +++ b/src/widgets/BlogBlock/ui/BlogBlock.stories.tsx @@ -1,6 +1,7 @@ import type { Meta, StoryObj } from '@storybook/react' -import styles from './BlogBlock.module.scss' import { FC } from 'react' +import styles from './BlogBlock.module.scss' + import BlogBlock from './BlogBlock' const StorybookWrapper: FC = () => { diff --git a/src/widgets/BlogBlock/ui/BlogBlock.tsx b/src/widgets/BlogBlock/ui/BlogBlock.tsx index a7188d5e..63d4c6d6 100644 --- a/src/widgets/BlogBlock/ui/BlogBlock.tsx +++ b/src/widgets/BlogBlock/ui/BlogBlock.tsx @@ -1,10 +1,13 @@ -import { FC } from 'react' +import { FC, useEffect } from 'react' +import { getBlogPosts } from '../model/services/getBlogPosts' +import { useAppDispatch } from '@/shared/libs/hooks/store' +import { getBlogPostsSelector } from '../model/selectors/selectiors' +import { useSelector } from 'react-redux' import IconLink from '@/assets/icons/IconLink' import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' import Link from '@/shared/ui/Link/Link' import styles from './BlogBlock.module.scss' import Scroll from '@/shared/ui/Scroll/Scroll' -import { blogData } from '@/mockData/blogData' import BlogCard from '@/entities/BlogCard/BlogCard' /** @@ -12,6 +15,13 @@ import BlogCard from '@/entities/BlogCard/BlogCard' */ const BlogBlock: FC = () => { + const dispatch = useAppDispatch() + const posts = useSelector(getBlogPostsSelector) + + useEffect(() => { + dispatch(getBlogPosts()) + }, []) + return (
@@ -22,8 +32,8 @@ const BlogBlock: FC = () => {
- {blogData.map(item => ( - + {posts.map(item => ( + ))}
diff --git a/src/widgets/NewsBlock/model/selectors/selectors.ts b/src/widgets/NewsBlock/model/selectors/selectors.ts index bcd58e38..c7bc5c60 100644 --- a/src/widgets/NewsBlock/model/selectors/selectors.ts +++ b/src/widgets/NewsBlock/model/selectors/selectors.ts @@ -1,5 +1,6 @@ import { StateSchema } from '@/app/providers/StoreProvider' export const getShopNewsSelector = (state: StateSchema) => { + // console.log('Selector ShopNews', state.shopNews.news) return state.shopNews.news } diff --git a/src/widgets/NewsBlock/model/services/getShopNews.ts b/src/widgets/NewsBlock/model/services/getShopNews.ts index 101275d7..25843a43 100644 --- a/src/widgets/NewsBlock/model/services/getShopNews.ts +++ b/src/widgets/NewsBlock/model/services/getShopNews.ts @@ -3,11 +3,12 @@ import { ThunkConfig } from '@/app/providers/StoreProvider/config/StateSchema' import { ApiError, ApiErrorTypes, ApiRoutes } from '@/shared/api/types' import { apiErrorIdentify } from '@/shared/api/apiErrorIdentify' import { ShopNewsData } from '../types/types' +import { ACTION_GET_SHOP_NEWS } from '@/shared/constants/constants' // export const getStoreReviews = createAsyncThunk>( export const getShopNews = createAsyncThunk>( //void1- выходные данные, void2- входные данные , thunkConfig- тип store - 'shop-news', // action type, первый аргумент + ACTION_GET_SHOP_NEWS, // action type, первый аргумент async (_, thunkAPI) => { // второй аргумент- асинхронная функция , кот вызовет dispatch в компоненте const { rejectWithValue, extra } = thunkAPI diff --git a/src/widgets/NewsBlock/model/slice/shopNewsSlice.ts b/src/widgets/NewsBlock/model/slice/shopNewsSlice.ts index 02751137..d5969d09 100644 --- a/src/widgets/NewsBlock/model/slice/shopNewsSlice.ts +++ b/src/widgets/NewsBlock/model/slice/shopNewsSlice.ts @@ -1,6 +1,7 @@ import { createSlice } from '@reduxjs/toolkit' import { getShopNews } from '../services/getShopNews' import { ShopNewsSchema } from '../types/types' +import { REDUCER_SHOP_NEWS } from '@/shared/constants/constants' const initialState: ShopNewsSchema = { isLoading: false, @@ -8,7 +9,7 @@ const initialState: ShopNewsSchema = { } export const shopNewsSlice = createSlice({ - name: 'shopNews', + name: REDUCER_SHOP_NEWS, initialState, reducers: {}, extraReducers: builder => { From 7aee7ab9e702db6e0d7979a8e19078a4eb4c2b64 Mon Sep 17 00:00:00 2001 From: Artur Khelshtein Date: Mon, 5 Feb 2024 12:53:59 +0300 Subject: [PATCH 2/9] =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D1=83=D1=87=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20=D0=BE=D1=81=D0=BD=D0=BE=D0=B2=D0=BD=D1=8B=D0=B5=20?= =?UTF-8?q?=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D0=B5=20=D0=B2=20footer=20=D1=87?= =?UTF-8?q?=D0=B5=D1=80=D0=B5=D0=B7=20Api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StoreProvider/config/StateSchema.ts | 2 + .../providers/StoreProvider/config/store.ts | 6 ++- src/pages/RootPage/RootPage.tsx | 8 ++-- .../header.tsx => widgets/Header/Header.tsx} | 39 +++++++++------- .../Header}/header.module.scss | 0 .../Header/model/selectors/selectors.tsx | 3 ++ .../model/services/getCoreBaseHeader.tsx | 29 ++++++++++++ .../Header/model/slice/headerSlice.tsx | 45 +++++++++++++++++++ src/widgets/Header/model/types/types.tsx | 21 +++++++++ 9 files changed, 134 insertions(+), 19 deletions(-) rename src/{components/header/header.tsx => widgets/Header/Header.tsx} (91%) rename src/{components/header => widgets/Header}/header.module.scss (100%) create mode 100644 src/widgets/Header/model/selectors/selectors.tsx create mode 100644 src/widgets/Header/model/services/getCoreBaseHeader.tsx create mode 100644 src/widgets/Header/model/slice/headerSlice.tsx create mode 100644 src/widgets/Header/model/types/types.tsx diff --git a/src/app/providers/StoreProvider/config/StateSchema.ts b/src/app/providers/StoreProvider/config/StateSchema.ts index fb954d60..4935fa02 100644 --- a/src/app/providers/StoreProvider/config/StateSchema.ts +++ b/src/app/providers/StoreProvider/config/StateSchema.ts @@ -6,12 +6,14 @@ import { ApiInstance } from '@/shared/api/api' import { ShopNewsSchema } from '@/widgets/NewsBlock/model/types/types' import { StoreReviewsSchema } from '@/widgets/ReviewsBlock/model/types/types' import { CoreBaseFooterSchema } from '@/widgets/Footer/model/types/types' +import { CoreBaseHeaderSchema } from '@/widgets/Header/model/types/types' export interface StateSchema { login: LoginSchema storeReviews: StoreReviewsSchema category: CategorySchema coreBaseFooter: CoreBaseFooterSchema + coreBaseHeader: CoreBaseHeaderSchema brand: BrandSchema searchResult: SearchResultSchema shopNews: ShopNewsSchema diff --git a/src/app/providers/StoreProvider/config/store.ts b/src/app/providers/StoreProvider/config/store.ts index 8074f338..15f452ce 100644 --- a/src/app/providers/StoreProvider/config/store.ts +++ b/src/app/providers/StoreProvider/config/store.ts @@ -1,6 +1,6 @@ import { configureStore, ReducersMapObject } from '@reduxjs/toolkit' + import { loginReducer } from '@/features/login/model/slice/loginSlice' -import { StateSchema, ThunkExtraArg } from './StateSchema' import { $api } from '@/shared/api/api' import categorySlice from '@/entities/Category/slice/categorySlice' import brandSlice from '@/widgets/BrandBlock/slice/brandSlice' @@ -8,12 +8,16 @@ import searchProductSlice from '@/features/SearchProduct/slice/searchProductSlic import { storeReviewsReducer } from '@/widgets/ReviewsBlock/model/slice/reviewsSlice' import footerSlice from '@/widgets/Footer/model/slice/footerSlice' import { shopNewsReducer } from '@/widgets/NewsBlock/model/slice/shopNewsSlice' +import headerSlice from '@/widgets/Header/model/slice/headerSlice' + +import { StateSchema, ThunkExtraArg } from './StateSchema' export type RootState = StateSchema const rootReducer: ReducersMapObject = { login: loginReducer, category: categorySlice, + coreBaseHeader: headerSlice, coreBaseFooter: footerSlice, brand: brandSlice, searchResult: searchProductSlice, diff --git a/src/pages/RootPage/RootPage.tsx b/src/pages/RootPage/RootPage.tsx index 7f16f267..3da8245d 100644 --- a/src/pages/RootPage/RootPage.tsx +++ b/src/pages/RootPage/RootPage.tsx @@ -1,9 +1,11 @@ import { Outlet } from 'react-router' -import Header from '@/components/header/header' + +import Contact from '@/features/Contacts/Contacts' +import { messengerArray } from '@/shared/model/types/messengerArray' import Footer from '@/widgets/Footer/Footer' +import Header from '@/widgets/Header/Header' + import styles from './root.module.scss' -import Contact from '../../features/Contacts/Contacts' -import { messengerArray } from '@/shared/model/types/messengerArray' const RootPage = () => { return ( diff --git a/src/components/header/header.tsx b/src/widgets/Header/Header.tsx similarity index 91% rename from src/components/header/header.tsx rename to src/widgets/Header/Header.tsx index 6fcef70a..10d0dace 100644 --- a/src/components/header/header.tsx +++ b/src/widgets/Header/Header.tsx @@ -1,30 +1,35 @@ -import { coreBaseData } from '@/mockData/coreBaseData' -import { useEffect, useMemo } from 'react' import classNames from 'classnames' -import Logo from '../../shared/ui/logo/Logo' +import { useEffect, useMemo } from 'react' +import { useDispatch, useSelector } from 'react-redux' + +import { AppDispatch } from '@/app/providers/StoreProvider/config/store' import ArrowIcon from '@/assets/icons/arrow.svg' +import IconCategories from '@/assets/icons/IconCategories.svg' import LightningIcon from '@/assets/images/header/lightning.svg' -import ContextMenuElement from '../ContextMenuElement/ContextMenuElement' -import HeaderAccount from '../HeaderAccount/HeaderAccount' -import { PHONE_NUMBER } from '@/shared/constants/constants' +import CatalogLink from '@/components/CatalogLink/CatalogLink' +import ContextMenuElement from '@/components/ContextMenuElement/ContextMenuElement' +import HeaderAccount from '@/components/HeaderAccount/HeaderAccount' +import { selectCategories, selectDisplayedCategories } from '@/entities/Category/selectors/categorySelectors' +import { fetchCategories } from '@/entities/Category/slice/categorySlice' +import SearchProduct from '@/features/SearchProduct' +import { linkItems } from '@/mockData/catalogListData' +// import { coreBaseData } from '@/mockData/coreBaseData' import { headerAccountData } from '@/mockData/headerAccountData' -import CatalogLink from '../CatalogLink/CatalogLink' import { Routes } from '@/shared/config/routerConfig/routes' +import { PHONE_NUMBER } from '@/shared/constants/constants' import Link from '@/shared/ui/Link/Link' -import IconCategories from '@/assets/icons/IconCategories.svg' -import SearchProduct from '@/features/SearchProduct' -import { linkItems } from '@/mockData/catalogListData' -import styles from './header.module.scss' -import { useDispatch, useSelector } from 'react-redux' -import { fetchCategories } from '@/entities/Category/slice/categorySlice' -import { AppDispatch } from '@/app/providers/StoreProvider/config/store' -import { selectCategories, selectDisplayedCategories } from '@/entities/Category/selectors/categorySelectors' +import Logo from '@/shared/ui/logo/Logo' import CatalogNodeItem from '@/widgets/CatalogNodeItem/CatalogNodeItem' import NavigationLink from '@/widgets/NavigationLink/NavigationLink' +import styles from './header.module.scss' +import { getCoreBaseHeaderSelector } from './model/selectors/selectors' +import { getCoreBaseHeader } from './model/services/getCoreBaseHeader' + function Header() { const dispatch = useDispatch() const categories = useSelector(selectCategories) + const coreBaseData = useSelector(getCoreBaseHeaderSelector) const displayedCategories = useSelector(selectDisplayedCategories) const aboutUsNode = useMemo( @@ -108,6 +113,10 @@ function Header() { [categories] ) + useEffect(() => { + dispatch(getCoreBaseHeader()) + }, []) + useEffect(() => { dispatch(fetchCategories()) }, [dispatch]) diff --git a/src/components/header/header.module.scss b/src/widgets/Header/header.module.scss similarity index 100% rename from src/components/header/header.module.scss rename to src/widgets/Header/header.module.scss diff --git a/src/widgets/Header/model/selectors/selectors.tsx b/src/widgets/Header/model/selectors/selectors.tsx new file mode 100644 index 00000000..72f8aac3 --- /dev/null +++ b/src/widgets/Header/model/selectors/selectors.tsx @@ -0,0 +1,3 @@ +import { StateSchema } from '@/app/providers/StoreProvider' + +export const getCoreBaseHeaderSelector = (state: StateSchema) => state.coreBaseHeader diff --git a/src/widgets/Header/model/services/getCoreBaseHeader.tsx b/src/widgets/Header/model/services/getCoreBaseHeader.tsx new file mode 100644 index 00000000..3ebef049 --- /dev/null +++ b/src/widgets/Header/model/services/getCoreBaseHeader.tsx @@ -0,0 +1,29 @@ +import { createAsyncThunk } from '@reduxjs/toolkit' + +import { ThunkConfig } from '@/app/providers/StoreProvider/config/StateSchema' +import { apiErrorIdentify } from '@/shared/api/apiErrorIdentify' +import { ApiError, ApiErrorTypes, ApiRoutes } from '@/shared/api/types' + +import { CoreBaseHeaderData } from '../types/types' + +/** + * ассинхронный запрос Api через thunk Redux toolkit + * - формат ожидаемого ответа + * - формат запроса (описан в config StoreProvider) + * - формат ошибки API запроса (описан в типах API) + * первый аргумент - thunkConfig ID action type (отображается в dev tools) + * второй аргумент - асинхронная функция, которая вызовет dispatch в компоненте + */ + +export const getCoreBaseHeader = createAsyncThunk>( + 'core/base_header', + async (_, thunkAPI) => { + const { rejectWithValue, extra } = thunkAPI + try { + const response = await extra.api.get(`api/${ApiRoutes.CORE_BASE}`) + return response.data.header as CoreBaseHeaderData + } catch (error) { + return rejectWithValue(apiErrorIdentify(error, ApiErrorTypes.DATA_EMPTY_ERROR)) + } + } +) diff --git a/src/widgets/Header/model/slice/headerSlice.tsx b/src/widgets/Header/model/slice/headerSlice.tsx new file mode 100644 index 00000000..750e1e95 --- /dev/null +++ b/src/widgets/Header/model/slice/headerSlice.tsx @@ -0,0 +1,45 @@ +import { createSlice } from '@reduxjs/toolkit' + +import { rejectedPayloadHandle } from '@/shared/api/rejectedPayloadHandle' + +import { getCoreBaseHeader } from '../services/getCoreBaseHeader' +import { CoreBaseHeaderSchema } from '../types/types' + +const initialState: CoreBaseHeaderSchema = { + isLoading: false, + header: { + main_logo: { + image: '', + url: '', + title: '' + }, + support: { + callback: '', + phone_number: '' + } + }, + error: undefined +} + +const footerSlice = createSlice({ + name: 'header', + initialState, + reducers: {}, + extraReducers: builder => { + builder + .addCase(getCoreBaseHeader.pending, state => { + state.isLoading = true + state.error = undefined + }) + .addCase(getCoreBaseHeader.fulfilled, (state, { payload }) => { + state.isLoading = false + state.header = payload + }) + .addCase(getCoreBaseHeader.rejected, (state, { payload }) => { + state.isLoading = false + state.error = rejectedPayloadHandle(payload) + }) + } +}) + +export default footerSlice.reducer diff --git a/src/widgets/Header/model/types/types.tsx b/src/widgets/Header/model/types/types.tsx new file mode 100644 index 00000000..8ecb945e --- /dev/null +++ b/src/widgets/Header/model/types/types.tsx @@ -0,0 +1,21 @@ +interface Logo { + image: string + url: string + title: string +} + +interface Support { + callback: string + phone_number: string +} + +export interface CoreBaseHeaderData { + main_logo: Logo + support: Support +} + +export interface CoreBaseHeaderSchema { + isLoading: boolean + header: CoreBaseHeaderData + error?: string | string[] +} From 670e8d0c885a96b87a434b438c2716e2b16a3f81 Mon Sep 17 00:00:00 2001 From: Artur Khelshtein Date: Mon, 5 Feb 2024 12:55:22 +0300 Subject: [PATCH 3/9] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D0=B8=D0=BC=D0=B5=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=B8=D0=BD=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20=D0=B4=D0=BB=D1=8F=20=D0=B8=D1=81=D0=BA=D0=BB?= =?UTF-8?q?=D1=8E=D1=87=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=81=D0=BE=D0=B2=D0=BF?= =?UTF-8?q?=D0=B0=D0=B4=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BD=D0=B0=D0=B8=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B9=20=D1=81=20hea?= =?UTF-8?q?der?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widgets/Footer/Footer.tsx | 4 ++-- .../services/{getCoreBase.tsx => getCoreBaseFooter.tsx} | 4 ++-- src/widgets/Footer/model/slice/footerSlice.ts | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) rename src/widgets/Footer/model/services/{getCoreBase.tsx => getCoreBaseFooter.tsx} (84%) diff --git a/src/widgets/Footer/Footer.tsx b/src/widgets/Footer/Footer.tsx index 43103958..ed29973e 100644 --- a/src/widgets/Footer/Footer.tsx +++ b/src/widgets/Footer/Footer.tsx @@ -13,7 +13,7 @@ import Paragraph from '@/shared/ui/Paragraph/Paragraph' import styles from './footer.module.scss' import { getCoreBaseFooterSelector } from './model/selectors/selectors' -import { getCoreBase } from './model/services/getCoreBase' +import { getCoreBaseFooter } from './model/services/getCoreBaseFooter' function Footer() { const dispatch = useDispatch() @@ -26,7 +26,7 @@ function Footer() { } useEffect(() => { - dispatch(getCoreBase()) + dispatch(getCoreBaseFooter()) }, []) const onSubmitHandler = () => {} diff --git a/src/widgets/Footer/model/services/getCoreBase.tsx b/src/widgets/Footer/model/services/getCoreBaseFooter.tsx similarity index 84% rename from src/widgets/Footer/model/services/getCoreBase.tsx rename to src/widgets/Footer/model/services/getCoreBaseFooter.tsx index cd45b6fd..e500f43f 100644 --- a/src/widgets/Footer/model/services/getCoreBase.tsx +++ b/src/widgets/Footer/model/services/getCoreBaseFooter.tsx @@ -6,9 +6,9 @@ import { ApiError, ApiErrorTypes, ApiRoutes } from '@/shared/api/types' import { CoreBaseFooterData } from '../types/types' -export const getCoreBase = createAsyncThunk>( +export const getCoreBaseFooter = createAsyncThunk>( //void1- выходные данные, void2- входные данные , thunkConfig- тип store - 'core/base', // action type, первый аргумент + 'core/base_footer', // action type, первый аргумент async (_, thunkAPI) => { // второй аргумент- асинхронная функция , кот вызовет dispatch в компоненте const { rejectWithValue, extra } = thunkAPI diff --git a/src/widgets/Footer/model/slice/footerSlice.ts b/src/widgets/Footer/model/slice/footerSlice.ts index 64c9fb12..8027e05e 100644 --- a/src/widgets/Footer/model/slice/footerSlice.ts +++ b/src/widgets/Footer/model/slice/footerSlice.ts @@ -2,7 +2,7 @@ import { createSlice } from '@reduxjs/toolkit' import { rejectedPayloadHandle } from '@/shared/api/rejectedPayloadHandle' -import { getCoreBase } from '../services/getCoreBase' +import { getCoreBaseFooter } from '../services/getCoreBaseFooter' import { CoreBaseFooterSchema } from '../types/types' const initialState: CoreBaseFooterSchema = { @@ -31,15 +31,15 @@ const footerSlice = createSlice({ reducers: {}, extraReducers: builder => { builder - .addCase(getCoreBase.pending, state => { + .addCase(getCoreBaseFooter.pending, state => { state.isLoading = true state.error = undefined }) - .addCase(getCoreBase.fulfilled, (state, { payload }) => { + .addCase(getCoreBaseFooter.fulfilled, (state, { payload }) => { state.isLoading = false state.footer = payload }) - .addCase(getCoreBase.rejected, (state, { payload }) => { + .addCase(getCoreBaseFooter.rejected, (state, { payload }) => { state.isLoading = false state.error = rejectedPayloadHandle(payload) }) From 4b123a7791881e7baea0493f52ad94a99a644464 Mon Sep 17 00:00:00 2001 From: Artur Khelshtein Date: Mon, 5 Feb 2024 13:44:25 +0300 Subject: [PATCH 4/9] =?UTF-8?q?=D0=BF=D0=BE=D0=B4=D0=B2=D0=B8=D0=BD=D1=83?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BF=D0=BE=20FSD=20=D0=B2=D1=81=D0=B5=20=D1=81?= =?UTF-8?q?=D1=81=D1=8B=D0=BB=D0=BA=D0=B8=20=D0=B2=20header?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SearchResult/SearchResult.module.scss | 0 .../SearchResult/SearchResult.stories.tsx | 4 +++- .../SearchResult/SearchResult.tsx | 8 +++++--- .../SearchResult/icons}/search-icon.svg | 0 src/features/SearchProduct/ui/SearchProduct.tsx | 10 ++++++---- src/{assets => shared}/icons/IconCategories.svg | 0 src/{assets => shared}/icons/arrow.svg | 0 .../footer => widgets/Footer/icons}/icon-subsc.svg | 0 .../images/footer => widgets/Footer/icons}/io.svg | 0 .../footer => widgets/Footer/icons}/mastercard.svg | 0 .../images/footer => widgets/Footer/icons}/mir.svg | 0 .../images/footer => widgets/Footer/icons}/visa.svg | 0 .../footer => widgets/Footer/icons}/webmoney.svg | 0 src/widgets/Header/Header.tsx | 6 +++--- .../header => widgets/Header/icons}/all-categories.svg | 0 .../header => widgets/Header/icons}/arrow_down.svg | 0 .../images/header => widgets/Header/icons}/catalog.svg | 0 .../header => widgets/Header/icons}/icon-catalog.svg | 0 .../header => widgets/Header/icons}/lightning.svg | 0 19 files changed, 17 insertions(+), 11 deletions(-) rename src/{widgets => entities}/SearchResult/SearchResult.module.scss (100%) rename src/{widgets => entities}/SearchResult/SearchResult.stories.tsx (99%) rename src/{widgets => entities}/SearchResult/SearchResult.tsx (97%) rename src/{assets/images/search => entities/SearchResult/icons}/search-icon.svg (100%) rename src/{assets => shared}/icons/IconCategories.svg (100%) rename src/{assets => shared}/icons/arrow.svg (100%) rename src/{shared/images/footer => widgets/Footer/icons}/icon-subsc.svg (100%) rename src/{shared/images/footer => widgets/Footer/icons}/io.svg (100%) rename src/{shared/images/footer => widgets/Footer/icons}/mastercard.svg (100%) rename src/{shared/images/footer => widgets/Footer/icons}/mir.svg (100%) rename src/{shared/images/footer => widgets/Footer/icons}/visa.svg (100%) rename src/{shared/images/footer => widgets/Footer/icons}/webmoney.svg (100%) rename src/{assets/images/header => widgets/Header/icons}/all-categories.svg (100%) rename src/{assets/images/header => widgets/Header/icons}/arrow_down.svg (100%) rename src/{assets/images/header => widgets/Header/icons}/catalog.svg (100%) rename src/{assets/images/header => widgets/Header/icons}/icon-catalog.svg (100%) rename src/{assets/images/header => widgets/Header/icons}/lightning.svg (100%) diff --git a/src/widgets/SearchResult/SearchResult.module.scss b/src/entities/SearchResult/SearchResult.module.scss similarity index 100% rename from src/widgets/SearchResult/SearchResult.module.scss rename to src/entities/SearchResult/SearchResult.module.scss diff --git a/src/widgets/SearchResult/SearchResult.stories.tsx b/src/entities/SearchResult/SearchResult.stories.tsx similarity index 99% rename from src/widgets/SearchResult/SearchResult.stories.tsx rename to src/entities/SearchResult/SearchResult.stories.tsx index 716aaec1..781edd54 100644 --- a/src/widgets/SearchResult/SearchResult.stories.tsx +++ b/src/entities/SearchResult/SearchResult.stories.tsx @@ -1,7 +1,9 @@ import { Meta, Story } from '@storybook/react' -import SearchResult from './SearchResult' + import { searchResponseData } from '@/mockData/searchData' +import SearchResult from './SearchResult' + export default { title: 'Widgets/SearchResult', component: SearchResult diff --git a/src/widgets/SearchResult/SearchResult.tsx b/src/entities/SearchResult/SearchResult.tsx similarity index 97% rename from src/widgets/SearchResult/SearchResult.tsx rename to src/entities/SearchResult/SearchResult.tsx index d5163210..f6a14a02 100644 --- a/src/widgets/SearchResult/SearchResult.tsx +++ b/src/entities/SearchResult/SearchResult.tsx @@ -1,11 +1,13 @@ import { forwardRef } from 'react' + import SearchItem from '@/entities/SearchItem/SearchItem' +import { TCategory } from '@/models/CategoryModel' +import { Routes } from '@/shared/config/routerConfig/routes' import { SEARCH_CATEGORY, SEARCH_PRODUCT } from '@/shared/constants/constants' import type { TProduct } from '@/shared/model/types/common' -import { TCategory } from '@/models/CategoryModel' -import SearchIcon from '@/assets/images/search/search-icon.svg' import Link from '@/shared/ui/Link/Link' -import { Routes } from '@/shared/config/routerConfig/routes' + +import SearchIcon from './icons/search-icon.svg' import styles from './SearchResult.module.scss' type TProps = { diff --git a/src/assets/images/search/search-icon.svg b/src/entities/SearchResult/icons/search-icon.svg similarity index 100% rename from src/assets/images/search/search-icon.svg rename to src/entities/SearchResult/icons/search-icon.svg diff --git a/src/features/SearchProduct/ui/SearchProduct.tsx b/src/features/SearchProduct/ui/SearchProduct.tsx index bad5ff08..3cde85d7 100644 --- a/src/features/SearchProduct/ui/SearchProduct.tsx +++ b/src/features/SearchProduct/ui/SearchProduct.tsx @@ -1,12 +1,14 @@ import { useRef, useEffect, useState } from 'react' +import { useNavigate } from 'react-router-dom' + +import SearchResult from '@/entities/SearchResult/SearchResult' import { searchResponseData } from '@/mockData/searchData' +import { Routes } from '@/shared/config/routerConfig/routes' import { TResultData } from '@/shared/model/types/common' -import SearchResult from '@/widgets/SearchResult/SearchResult' -import { Input, InputSize, InputTheme } from '@/shared/ui/Input/Input' import { Button, ButtonDesign, ButtonSize, ButtonTheme } from '@/shared/ui/Button/Button' +import { Input, InputSize, InputTheme } from '@/shared/ui/Input/Input' + import styles from './SearchProduct.module.scss' -import { Routes } from '@/shared/config/routerConfig/routes' -import { useNavigate } from 'react-router-dom' // @TODO: Перевести форму на Formik + Yup // https://github.com/Studio-Yandex-Practicum/maxboom_frontend/issues/92 diff --git a/src/assets/icons/IconCategories.svg b/src/shared/icons/IconCategories.svg similarity index 100% rename from src/assets/icons/IconCategories.svg rename to src/shared/icons/IconCategories.svg diff --git a/src/assets/icons/arrow.svg b/src/shared/icons/arrow.svg similarity index 100% rename from src/assets/icons/arrow.svg rename to src/shared/icons/arrow.svg diff --git a/src/shared/images/footer/icon-subsc.svg b/src/widgets/Footer/icons/icon-subsc.svg similarity index 100% rename from src/shared/images/footer/icon-subsc.svg rename to src/widgets/Footer/icons/icon-subsc.svg diff --git a/src/shared/images/footer/io.svg b/src/widgets/Footer/icons/io.svg similarity index 100% rename from src/shared/images/footer/io.svg rename to src/widgets/Footer/icons/io.svg diff --git a/src/shared/images/footer/mastercard.svg b/src/widgets/Footer/icons/mastercard.svg similarity index 100% rename from src/shared/images/footer/mastercard.svg rename to src/widgets/Footer/icons/mastercard.svg diff --git a/src/shared/images/footer/mir.svg b/src/widgets/Footer/icons/mir.svg similarity index 100% rename from src/shared/images/footer/mir.svg rename to src/widgets/Footer/icons/mir.svg diff --git a/src/shared/images/footer/visa.svg b/src/widgets/Footer/icons/visa.svg similarity index 100% rename from src/shared/images/footer/visa.svg rename to src/widgets/Footer/icons/visa.svg diff --git a/src/shared/images/footer/webmoney.svg b/src/widgets/Footer/icons/webmoney.svg similarity index 100% rename from src/shared/images/footer/webmoney.svg rename to src/widgets/Footer/icons/webmoney.svg diff --git a/src/widgets/Header/Header.tsx b/src/widgets/Header/Header.tsx index 10d0dace..5014a453 100644 --- a/src/widgets/Header/Header.tsx +++ b/src/widgets/Header/Header.tsx @@ -3,9 +3,6 @@ import { useEffect, useMemo } from 'react' import { useDispatch, useSelector } from 'react-redux' import { AppDispatch } from '@/app/providers/StoreProvider/config/store' -import ArrowIcon from '@/assets/icons/arrow.svg' -import IconCategories from '@/assets/icons/IconCategories.svg' -import LightningIcon from '@/assets/images/header/lightning.svg' import CatalogLink from '@/components/CatalogLink/CatalogLink' import ContextMenuElement from '@/components/ContextMenuElement/ContextMenuElement' import HeaderAccount from '@/components/HeaderAccount/HeaderAccount' @@ -17,12 +14,15 @@ import { linkItems } from '@/mockData/catalogListData' import { headerAccountData } from '@/mockData/headerAccountData' import { Routes } from '@/shared/config/routerConfig/routes' import { PHONE_NUMBER } from '@/shared/constants/constants' +import ArrowIcon from '@/shared/icons/arrow.svg' +import IconCategories from '@/shared/icons/IconCategories.svg' import Link from '@/shared/ui/Link/Link' import Logo from '@/shared/ui/logo/Logo' import CatalogNodeItem from '@/widgets/CatalogNodeItem/CatalogNodeItem' import NavigationLink from '@/widgets/NavigationLink/NavigationLink' import styles from './header.module.scss' +import LightningIcon from './icons/lightning.svg' import { getCoreBaseHeaderSelector } from './model/selectors/selectors' import { getCoreBaseHeader } from './model/services/getCoreBaseHeader' diff --git a/src/assets/images/header/all-categories.svg b/src/widgets/Header/icons/all-categories.svg similarity index 100% rename from src/assets/images/header/all-categories.svg rename to src/widgets/Header/icons/all-categories.svg diff --git a/src/assets/images/header/arrow_down.svg b/src/widgets/Header/icons/arrow_down.svg similarity index 100% rename from src/assets/images/header/arrow_down.svg rename to src/widgets/Header/icons/arrow_down.svg diff --git a/src/assets/images/header/catalog.svg b/src/widgets/Header/icons/catalog.svg similarity index 100% rename from src/assets/images/header/catalog.svg rename to src/widgets/Header/icons/catalog.svg diff --git a/src/assets/images/header/icon-catalog.svg b/src/widgets/Header/icons/icon-catalog.svg similarity index 100% rename from src/assets/images/header/icon-catalog.svg rename to src/widgets/Header/icons/icon-catalog.svg diff --git a/src/assets/images/header/lightning.svg b/src/widgets/Header/icons/lightning.svg similarity index 100% rename from src/assets/images/header/lightning.svg rename to src/widgets/Header/icons/lightning.svg From 4e9e0d9e876c03ac7d38b6ec4c817d1a8725431b Mon Sep 17 00:00:00 2001 From: Yulia Avramenko Date: Mon, 5 Feb 2024 14:30:52 +0300 Subject: [PATCH 5/9] #140-bug-fix --- .../model/selectors/{selectiors.ts => selectors.ts} | 1 - src/widgets/BlogBlock/model/slice/blogPostsSlice.ts | 10 ++++++++-- src/widgets/BlogBlock/model/types/types.ts | 1 + src/widgets/BlogBlock/ui/BlogBlock.tsx | 2 +- src/widgets/NewsBlock/model/selectors/selectors.ts | 1 - 5 files changed, 10 insertions(+), 5 deletions(-) rename src/widgets/BlogBlock/model/selectors/{selectiors.ts => selectors.ts} (71%) diff --git a/src/widgets/BlogBlock/model/selectors/selectiors.ts b/src/widgets/BlogBlock/model/selectors/selectors.ts similarity index 71% rename from src/widgets/BlogBlock/model/selectors/selectiors.ts rename to src/widgets/BlogBlock/model/selectors/selectors.ts index 20da3eba..fd018a25 100644 --- a/src/widgets/BlogBlock/model/selectors/selectiors.ts +++ b/src/widgets/BlogBlock/model/selectors/selectors.ts @@ -1,6 +1,5 @@ import { StateSchema } from '@/app/providers/StoreProvider' export const getBlogPostsSelector = (state: StateSchema) => { - //console.log('Selector BlogPosts', state.blogPosts.posts) return state.blogPosts.posts } diff --git a/src/widgets/BlogBlock/model/slice/blogPostsSlice.ts b/src/widgets/BlogBlock/model/slice/blogPostsSlice.ts index c60a5848..954ead65 100644 --- a/src/widgets/BlogBlock/model/slice/blogPostsSlice.ts +++ b/src/widgets/BlogBlock/model/slice/blogPostsSlice.ts @@ -2,6 +2,7 @@ import { createSlice } from '@reduxjs/toolkit' import { IBlogPostsSchema } from '../types/types' import { getBlogPosts } from '../services/getBlogPosts' import { REDUCER_BLOG_POSTS } from '@/shared/constants/constants' +import { rejectedPayloadHandle } from '@/shared/api/rejectedPayloadHandle' const initialState: IBlogPostsSchema = { isLoading: false, @@ -11,7 +12,11 @@ const initialState: IBlogPostsSchema = { export const blogPostsSlice = createSlice({ name: REDUCER_BLOG_POSTS, initialState, - reducers: {}, + reducers: { + errorReset: state => { + state.error = undefined + } + }, extraReducers: builder => { builder .addCase(getBlogPosts.pending, state => { @@ -21,8 +26,9 @@ export const blogPostsSlice = createSlice({ state.isLoading = false state.posts = payload }) - .addCase(getBlogPosts.rejected, state => { + .addCase(getBlogPosts.rejected, (state, { payload }) => { state.isLoading = false + state.error = rejectedPayloadHandle(payload) }) } }) diff --git a/src/widgets/BlogBlock/model/types/types.ts b/src/widgets/BlogBlock/model/types/types.ts index baf4e95a..54cd5c9c 100644 --- a/src/widgets/BlogBlock/model/types/types.ts +++ b/src/widgets/BlogBlock/model/types/types.ts @@ -29,4 +29,5 @@ export interface IBlogPostData { export interface IBlogPostsSchema { isLoading: boolean posts: IBlogPostData[] + error?: string | string[] } diff --git a/src/widgets/BlogBlock/ui/BlogBlock.tsx b/src/widgets/BlogBlock/ui/BlogBlock.tsx index 63d4c6d6..238f1e42 100644 --- a/src/widgets/BlogBlock/ui/BlogBlock.tsx +++ b/src/widgets/BlogBlock/ui/BlogBlock.tsx @@ -1,7 +1,7 @@ import { FC, useEffect } from 'react' import { getBlogPosts } from '../model/services/getBlogPosts' import { useAppDispatch } from '@/shared/libs/hooks/store' -import { getBlogPostsSelector } from '../model/selectors/selectiors' +import { getBlogPostsSelector } from '../model/selectors/selectors' import { useSelector } from 'react-redux' import IconLink from '@/assets/icons/IconLink' import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' diff --git a/src/widgets/NewsBlock/model/selectors/selectors.ts b/src/widgets/NewsBlock/model/selectors/selectors.ts index c7bc5c60..bcd58e38 100644 --- a/src/widgets/NewsBlock/model/selectors/selectors.ts +++ b/src/widgets/NewsBlock/model/selectors/selectors.ts @@ -1,6 +1,5 @@ import { StateSchema } from '@/app/providers/StoreProvider' export const getShopNewsSelector = (state: StateSchema) => { - // console.log('Selector ShopNews', state.shopNews.news) return state.shopNews.news } From be613adf77397fdd4c71bd5f266f265fd023ad2f Mon Sep 17 00:00:00 2001 From: Artur Khelshtein Date: Mon, 5 Feb 2024 20:50:00 +0300 Subject: [PATCH 6/9] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB=D0=BE=20=D0=B8?= =?UTF-8?q?=D0=BC=D0=BF=D0=BE=D1=80=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.json | 36 +- package-lock.json | 370 +++++++++++++++++- package.json | 1 + src/app/App.tsx | 10 +- .../StoreProvider/ui/StoreProvider.tsx | 3 +- src/app/router/AppRouter/ui/AppRouter.tsx | 15 +- src/assets/icons/IconLike.tsx | 1 + src/assets/icons/IconLink.tsx | 8 +- src/assets/icons/IconStar.tsx | 9 +- src/components/Arrows/Arrows.tsx | 4 +- src/components/ArticleBlock/ArticleBlock.tsx | 5 +- .../BlogCategories/BlogCategories.tsx | 4 +- .../BlogItemForContainer.tsx | 8 +- src/components/BlogMain/BlogMain.tsx | 21 +- src/components/BlogMainItem/BlogMainItem.tsx | 8 +- src/components/BlogTags/BlogTags.tsx | 4 +- .../CardForContainer/CardForContainer.tsx | 4 +- src/components/CardPreview/CardPreview.tsx | 7 +- .../CardPreviewFooter/CardPreviewFooter.tsx | 4 +- .../CardPreviewHeader/CardPreviewHeader.tsx | 6 +- src/components/CatalogLink/CatalogLink.tsx | 4 +- src/components/CategoryList/CategoryList.tsx | 2 + .../ContainerCards/ContainerCards.tsx | 7 +- .../ContextMenuElement/ContextMenuElement.tsx | 2 + src/components/Dots/Dots.tsx | 1 + src/components/Dropdown/Dropdown.tsx | 1 + .../HeaderAccount/HeaderAccount.tsx | 18 +- src/components/PageControls/PageControls.tsx | 6 +- .../PageDescription/PageDescription.tsx | 3 +- src/components/Pagination/Pagination.tsx | 8 +- .../ProductAvailability.tsx | 1 + src/components/ProductCard/ProductCard.tsx | 16 +- src/components/Slider/Slider.tsx | 11 +- src/components/SliderBlock/SliderBlock.tsx | 3 +- src/components/Subscribe/Subscribe.tsx | 4 +- .../WidgetButtonsFunctions.tsx | 8 +- .../WidgetButtonsPurchase.tsx | 2 + .../WrapperForMainContent.tsx | 1 + src/components/header/header.tsx | 33 +- .../ui/AdvantageCard/AdvantageCard.tsx | 2 + src/entities/BlogCard/BlogCard.stories.tsx | 4 +- src/entities/BlogCard/BlogCard.tsx | 8 +- src/entities/BrandCard/BrandCard.stories.tsx | 4 +- src/entities/BrandCard/BrandCard.tsx | 6 +- .../ui/CardReview/CardReview.stories.tsx | 1 + .../CardReview/ui/CardReview/CardReview.tsx | 6 +- src/entities/Category/slice/categorySlice.ts | 6 +- src/entities/ContactCard/ContactCard.tsx | 4 +- src/entities/NewsCard/NewsCard.stories.tsx | 1 + src/entities/NewsCard/NewsCard.tsx | 8 +- src/entities/Payments/Payments.tsx | 2 + .../ProductEntity/ProductEntity.stories.tsx | 4 +- .../ui/ProductEntity/ProductEntity.tsx | 6 +- .../SearchItem/SearchItem.stories.tsx | 4 +- src/entities/SearchItem/SearchItem.tsx | 2 + src/entities/StoryCard/StoryCard.stories.tsx | 4 +- src/entities/StoryCard/StoryCard.tsx | 4 +- .../CallBack/ui/CallBack/CallBack.tsx | 14 +- .../CartCouponApply.stories.tsx | 1 + .../ui/CartCouponApply/CartCouponApply.tsx | 6 +- .../CartEdit/ui/CartEdit/CartEdit.stories.tsx | 6 +- .../CartEdit/ui/CartEdit/CartEdit.tsx | 10 +- src/features/Contacts/Contacts.tsx | 10 +- .../QuickPurchaseForm/QuickPurchaseForm.tsx | 14 +- .../SearchProduct/slice/searchProductSlice.ts | 8 +- .../ui/SearchProduct.stories.tsx | 1 + .../SearchProduct/ui/SearchProduct.tsx | 10 +- src/features/SubscribeForm/SubscribeForm.tsx | 6 +- .../loginByUsername/loginByUsername.ts | 6 +- .../login/model/services/logout/logout.ts | 3 +- src/features/login/model/slice/loginSlice.ts | 6 +- src/features/login/ui/LoginForm/LoginForm.tsx | 19 +- src/index.tsx | 4 +- src/mockData/advantagesData.ts | 2 +- src/mockData/blogPageData.ts | 2 +- src/mockData/brandData.ts | 2 +- src/mockData/searchData.ts | 2 +- src/mockData/storiesData.ts | 2 +- src/pages/BlogPage/BlogPage.tsx | 2 +- src/pages/CartPage/CartPage.tsx | 18 +- src/pages/ComparePage/ComparePage.tsx | 1 + src/pages/FavoritesPage/FavoritesPage.tsx | 1 + src/pages/LoginPage/LoginPage.tsx | 6 +- src/pages/MainPage/MainPage.tsx | 16 +- src/pages/ProductsPage/ProductsPage.tsx | 10 +- src/pages/RootPage/RootPage.tsx | 7 +- .../SearchResultsPage/SearchResultsPage.tsx | 12 +- src/shared/api/apiErrorIdentify.ts | 1 + src/shared/libs/hooks/store.ts | 1 + src/shared/model/types/messengerArray.tsx | 6 +- src/shared/ui/Button/Button.stories.tsx | 2 + src/shared/ui/Button/Button.tsx | 19 +- .../ui/ButtonDots/ButtonDots.stories.tsx | 1 + src/shared/ui/ButtonDots/ButtonDots.tsx | 1 + src/shared/ui/Carousel/Carousel.stories.tsx | 6 +- src/shared/ui/Carousel/Carousel.tsx | 4 +- .../ui/CategoryCard/ui/CategoryCard.tsx | 5 +- src/shared/ui/Heading/Heading.tsx | 3 +- src/shared/ui/Input/Input.tsx | 3 +- src/shared/ui/Label/Label.stories.tsx | 1 + src/shared/ui/Label/Label.tsx | 1 + src/shared/ui/Link/Link.stories.tsx | 2 + src/shared/ui/Link/Link.tsx | 3 +- src/shared/ui/Modal/Modal.tsx | 3 +- src/shared/ui/Paragraph/Paragraph.stories.tsx | 1 + src/shared/ui/Paragraph/Paragraph.tsx | 3 +- src/shared/ui/Scroll/Scroll.stories.tsx | 1 + src/shared/ui/Scroll/Scroll.tsx | 1 + src/shared/ui/Span/Span.stories.tsx | 1 + src/shared/ui/Span/Span.tsx | 1 + src/shared/ui/Spinner/Spinner.stories.tsx | 1 + src/shared/ui/Subheading/Subheading.tsx | 1 + src/shared/ui/Textarea/Textarea.stories.tsx | 1 + src/shared/ui/Textarea/Textarea.tsx | 3 +- src/shared/ui/logo/Logo.tsx | 4 +- src/ui/img/index.tsx | 1 + .../Advantages/ui/Advantages/Advantages.tsx | 4 +- .../BlogBlock/model/services/getBlogPosts.ts | 6 +- .../BlogBlock/model/slice/blogPostsSlice.ts | 8 +- .../BlogBlock/ui/BlogBlock.stories.tsx | 2 +- src/widgets/BlogBlock/ui/BlogBlock.tsx | 13 +- src/widgets/BrandBlock/slice/brandSlice.ts | 6 +- .../ui/BrandBlock/BrandBlock.stories.tsx | 4 +- .../BrandBlock/ui/BrandBlock/BrandBlock.tsx | 15 +- .../CatalogNodeItem.stories.tsx | 1 + .../CatalogNodeItem/CatalogNodeItem.tsx | 1 + src/widgets/CategoryGrid/CategoryGrid.tsx | 5 +- .../ui/MakeOrder/MakeOrder.stories.tsx | 1 + .../MakeOrder/ui/MakeOrder/MakeOrder.tsx | 4 +- .../NavigationLink/NavigationLink.stories.tsx | 1 + src/widgets/NavigationLink/NavigationLink.tsx | 1 + .../NewsBlock/model/services/getShopNews.ts | 6 +- .../NewsBlock/model/slice/shopNewsSlice.ts | 4 +- .../NewsBlock/ui/NewsBlock.stories.tsx | 3 +- src/widgets/NewsBlock/ui/NewsBlock.tsx | 13 +- .../model/services/getStoreReviews.ts | 4 +- .../ReviewsBlock/model/slice/reviewsSlice.ts | 3 +- .../ui/ReviewsBlock/ReviewsBlock.stories.tsx | 4 +- .../ui/ReviewsBlock/ReviewsBlock.tsx | 15 +- .../SearchResult/SearchResult.stories.tsx | 4 +- src/widgets/SearchResult/SearchResult.tsx | 8 +- .../StoriesBlock/ui/StoriesBlock.stories.tsx | 5 +- src/widgets/StoriesBlock/ui/StoriesBlock.tsx | 8 +- 143 files changed, 899 insertions(+), 273 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 52f117a9..983897fc 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -23,7 +23,39 @@ }, "plugins": [ "@typescript-eslint", - "react" + "react", + "import" ], - "rules": {} + "rules": { + "import/order": [ + "error", + { + "groups": [ + "builtin", + "external", + "parent", + "sibling", + "index", + "object" + ], + "pathGroups": [ + { + "pattern": "react*", + "group": "external", + "position": "before" + }, + { + "pattern": "@/**/**", + "group": "parent", + "position": "before" + } + ], + "newlines-between": "always", + "alphabetize": { + "order": "asc", + "caseInsensitive": true + } + } + ] + } } diff --git a/package-lock.json b/package-lock.json index 267237b8..7e7ba1f5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -48,6 +48,7 @@ "dotenv": "16.3.1", "eslint": "8.47.0", "eslint-config-prettier": "9.0.0", + "eslint-plugin-import": "^2.29.1", "eslint-plugin-react": "7.33.2", "eslint-plugin-storybook": "^0.6.15", "html-webpack-plugin": "5.5.3", @@ -7615,6 +7616,12 @@ "integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==", "dev": true }, + "node_modules/@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "dev": true + }, "node_modules/@types/lodash": { "version": "4.14.200", "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.200.tgz", @@ -8664,6 +8671,25 @@ "node": ">=8" } }, + "node_modules/array.prototype.findlastindex": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.3.tgz", + "integrity": "sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0", + "get-intrinsic": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/array.prototype.flat": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz", @@ -10907,6 +10933,104 @@ "eslint": ">=7.0.0" } }, + "node_modules/eslint-import-resolver-node": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", + "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", + "dev": true, + "dependencies": { + "debug": "^3.2.7", + "is-core-module": "^2.13.0", + "resolve": "^1.22.4" + } + }, + "node_modules/eslint-import-resolver-node/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-module-utils": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz", + "integrity": "sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==", + "dev": true, + "dependencies": { + "debug": "^3.2.7" + }, + "engines": { + "node": ">=4" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, + "node_modules/eslint-module-utils/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-import": { + "version": "2.29.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz", + "integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==", + "dev": true, + "dependencies": { + "array-includes": "^3.1.7", + "array.prototype.findlastindex": "^1.2.3", + "array.prototype.flat": "^1.3.2", + "array.prototype.flatmap": "^1.3.2", + "debug": "^3.2.7", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.9", + "eslint-module-utils": "^2.8.0", + "hasown": "^2.0.0", + "is-core-module": "^2.13.1", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.fromentries": "^2.0.7", + "object.groupby": "^1.0.1", + "object.values": "^1.1.7", + "semver": "^6.3.1", + "tsconfig-paths": "^3.15.0" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" + } + }, + "node_modules/eslint-plugin-import/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-import/node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/eslint-plugin-react": { "version": "7.33.2", "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.33.2.tgz", @@ -12149,10 +12273,13 @@ } }, "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/function.prototype.name": { "version": "1.1.6", @@ -12589,6 +12716,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/hasown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", + "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/he": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", @@ -13259,12 +13398,12 @@ } }, "node_modules/is-core-module": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz", - "integrity": "sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==", + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", "dev": true, "dependencies": { - "has": "^1.0.3" + "hasown": "^2.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -15492,6 +15631,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/object.groupby": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.1.tgz", + "integrity": "sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1" + } + }, "node_modules/object.hasown": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/object.hasown/-/object.hasown-1.1.3.tgz", @@ -18203,6 +18354,15 @@ "node": ">=8" } }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/strip-final-newline": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", @@ -19181,6 +19341,30 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, + "node_modules/tsconfig-paths": { + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", + "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", + "dev": true, + "dependencies": { + "@types/json5": "^0.0.29", + "json5": "^1.0.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + } + }, + "node_modules/tsconfig-paths/node_modules/json5": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "dev": true, + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, "node_modules/tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", @@ -25494,6 +25678,12 @@ "integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==", "dev": true }, + "@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "dev": true + }, "@types/lodash": { "version": "4.14.200", "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.200.tgz", @@ -26330,6 +26520,19 @@ "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", "dev": true }, + "array.prototype.findlastindex": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.3.tgz", + "integrity": "sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0", + "get-intrinsic": "^1.2.1" + } + }, "array.prototype.flat": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz", @@ -28125,6 +28328,93 @@ "dev": true, "requires": {} }, + "eslint-import-resolver-node": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", + "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", + "dev": true, + "requires": { + "debug": "^3.2.7", + "is-core-module": "^2.13.0", + "resolve": "^1.22.4" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "eslint-module-utils": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz", + "integrity": "sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==", + "dev": true, + "requires": { + "debug": "^3.2.7" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "eslint-plugin-import": { + "version": "2.29.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz", + "integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==", + "dev": true, + "requires": { + "array-includes": "^3.1.7", + "array.prototype.findlastindex": "^1.2.3", + "array.prototype.flat": "^1.3.2", + "array.prototype.flatmap": "^1.3.2", + "debug": "^3.2.7", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.9", + "eslint-module-utils": "^2.8.0", + "hasown": "^2.0.0", + "is-core-module": "^2.13.1", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.fromentries": "^2.0.7", + "object.groupby": "^1.0.1", + "object.values": "^1.1.7", + "semver": "^6.3.1", + "tsconfig-paths": "^3.15.0" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + } + } + }, "eslint-plugin-react": { "version": "7.33.2", "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.33.2.tgz", @@ -28994,9 +29284,9 @@ "optional": true }, "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", "dev": true }, "function.prototype.name": { @@ -29308,6 +29598,15 @@ "has-symbols": "^1.0.2" } }, + "hasown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", + "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "dev": true, + "requires": { + "function-bind": "^1.1.2" + } + }, "he": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", @@ -29790,12 +30089,12 @@ "dev": true }, "is-core-module": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz", - "integrity": "sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==", + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", "dev": true, "requires": { - "has": "^1.0.3" + "hasown": "^2.0.0" } }, "is-date-object": { @@ -31412,6 +31711,18 @@ "es-abstract": "^1.22.1" } }, + "object.groupby": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.1.tgz", + "integrity": "sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1" + } + }, "object.hasown": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/object.hasown/-/object.hasown-1.1.3.tgz", @@ -33392,6 +33703,12 @@ "ansi-regex": "^5.0.1" } }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true + }, "strip-final-newline": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", @@ -34127,6 +34444,29 @@ } } }, + "tsconfig-paths": { + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", + "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", + "dev": true, + "requires": { + "@types/json5": "^0.0.29", + "json5": "^1.0.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + }, + "dependencies": { + "json5": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + } + } + }, "tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", diff --git a/package.json b/package.json index 710c27d2..27e246a6 100644 --- a/package.json +++ b/package.json @@ -70,6 +70,7 @@ "dotenv": "16.3.1", "eslint": "8.47.0", "eslint-config-prettier": "9.0.0", + "eslint-plugin-import": "^2.29.1", "eslint-plugin-react": "7.33.2", "eslint-plugin-storybook": "^0.6.15", "html-webpack-plugin": "5.5.3", diff --git a/src/app/App.tsx b/src/app/App.tsx index 359ab20e..89f712ad 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -1,10 +1,12 @@ -import { RouterProvider } from 'react-router-dom' -import { router } from './router/AppRouter' import { useEffect } from 'react' +import { RouterProvider } from 'react-router-dom' + import { loginActions } from '@/features/login/model/slice/loginSlice' -import { useAppDispatch } from '@/shared/libs/hooks/store' -import { tokenFromStorageGet } from '@/shared/libs/helpers/localStorageHandler' import { $api } from '@/shared/api/api' +import { tokenFromStorageGet } from '@/shared/libs/helpers/localStorageHandler' +import { useAppDispatch } from '@/shared/libs/hooks/store' + +import { router } from './router/AppRouter' function App() { const dispatch = useAppDispatch() diff --git a/src/app/providers/StoreProvider/ui/StoreProvider.tsx b/src/app/providers/StoreProvider/ui/StoreProvider.tsx index 99a44f0f..57ab18e6 100644 --- a/src/app/providers/StoreProvider/ui/StoreProvider.tsx +++ b/src/app/providers/StoreProvider/ui/StoreProvider.tsx @@ -1,6 +1,7 @@ +import { DeepPartial } from '@reduxjs/toolkit' import { ReactNode } from 'react' import { Provider } from 'react-redux' -import { DeepPartial } from '@reduxjs/toolkit' + import { StateSchema } from '../config/StateSchema' import { createReduxStore } from '../config/store' diff --git a/src/app/router/AppRouter/ui/AppRouter.tsx b/src/app/router/AppRouter/ui/AppRouter.tsx index 28420af7..7c67e54b 100644 --- a/src/app/router/AppRouter/ui/AppRouter.tsx +++ b/src/app/router/AppRouter/ui/AppRouter.tsx @@ -1,15 +1,16 @@ import { createBrowserRouter } from 'react-router-dom' -import { Routes } from '@/shared/config/routerConfig/routes' -import MainPage from '@/pages/MainPage/MainPage' -import { ProductsPage } from '@/pages/ProductsPage/ProductsPage' + import BlogPage from '@/pages/BlogPage/BlogPage' -import RootPage from '@/pages/RootPage/RootPage' -import ErrorPage from '@/pages/ErrorPage/ErrorPage' -import LoginPage from '@/pages/LoginPage/LoginPage' +import CartPage from '@/pages/CartPage/CartPage' import ComparePage from '@/pages/ComparePage/ComparePage' +import ErrorPage from '@/pages/ErrorPage/ErrorPage' import FavoritesPage from '@/pages/FavoritesPage/FavoritesPage' -import CartPage from '@/pages/CartPage/CartPage' +import LoginPage from '@/pages/LoginPage/LoginPage' +import MainPage from '@/pages/MainPage/MainPage' +import { ProductsPage } from '@/pages/ProductsPage/ProductsPage' +import RootPage from '@/pages/RootPage/RootPage' import SearchResultsPage from '@/pages/SearchResultsPage/SearchResultsPage' +import { Routes } from '@/shared/config/routerConfig/routes' export const AppRouter = createBrowserRouter([ { diff --git a/src/assets/icons/IconLike.tsx b/src/assets/icons/IconLike.tsx index 5b08e702..106ca290 100644 --- a/src/assets/icons/IconLike.tsx +++ b/src/assets/icons/IconLike.tsx @@ -1,4 +1,5 @@ import { FC, useMemo } from 'react' + import type { TProps } from '../../models/SvgModel' /** diff --git a/src/assets/icons/IconLink.tsx b/src/assets/icons/IconLink.tsx index cc75bc96..c28dea52 100644 --- a/src/assets/icons/IconLink.tsx +++ b/src/assets/icons/IconLink.tsx @@ -1,4 +1,5 @@ import { FC, useMemo } from 'react' + import type { TProps } from '@/models/SvgModel' /** @@ -13,7 +14,12 @@ const IconLink: FC = props => { }, [styles]) return ( - + diff --git a/src/assets/icons/IconStar.tsx b/src/assets/icons/IconStar.tsx index 5a0c69fc..d7722521 100644 --- a/src/assets/icons/IconStar.tsx +++ b/src/assets/icons/IconStar.tsx @@ -1,4 +1,5 @@ import { FC, useMemo } from 'react' + import type { TProps } from '@/models/SvgModel' /** @@ -13,7 +14,13 @@ const IconStar: FC = props => { }, [styles]) return ( - + void type: 'prev' | 'next' diff --git a/src/components/ArticleBlock/ArticleBlock.tsx b/src/components/ArticleBlock/ArticleBlock.tsx index 2de4fc25..63a930f4 100644 --- a/src/components/ArticleBlock/ArticleBlock.tsx +++ b/src/components/ArticleBlock/ArticleBlock.tsx @@ -1,8 +1,9 @@ +import ArrowReadNext from '@/assets/icons/ArrowReadNext.svg' import description from '@/assets/images/articleBlock/description.png' import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' -import Paragraph from '@/shared/ui/Paragraph/Paragraph' -import ArrowReadNext from '@/assets/icons/ArrowReadNext.svg' import Link from '@/shared/ui/Link/Link' +import Paragraph from '@/shared/ui/Paragraph/Paragraph' + import styles from './articleBlock.module.scss' function ArticleBlock() { diff --git a/src/components/BlogCategories/BlogCategories.tsx b/src/components/BlogCategories/BlogCategories.tsx index 6c7f77dc..1828388d 100644 --- a/src/components/BlogCategories/BlogCategories.tsx +++ b/src/components/BlogCategories/BlogCategories.tsx @@ -1,8 +1,10 @@ -import styles from './blog-categories.module.scss' import { FC, useMemo } from 'react' + import type { PropsCategories } from '@/models/PropsBlog' import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' +import styles from './blog-categories.module.scss' + const BlogCategories: FC = props => { const { cards, filterItems } = props diff --git a/src/components/BlogItemForContainer/BlogItemForContainer.tsx b/src/components/BlogItemForContainer/BlogItemForContainer.tsx index 0287f80c..4bd1ef8e 100644 --- a/src/components/BlogItemForContainer/BlogItemForContainer.tsx +++ b/src/components/BlogItemForContainer/BlogItemForContainer.tsx @@ -1,12 +1,14 @@ import { FC, useMemo } from 'react' + +import CommentIcon from '@/assets/images/blogMainItem/icon-comments.svg' +import ViewIcon from '@/assets/images/blogMainItem/icon-views.svg' import type { TBlogItem } from '@/models/BlogItemModel' import { TEXT_PROMO } from '@/shared/constants/constants' -import styles from './blog-item-for-container.module.scss' -import ViewIcon from '@/assets/images/blogMainItem/icon-views.svg' -import CommentIcon from '@/assets/images/blogMainItem/icon-comments.svg' import { fromSS } from '@/shared/constants/constants' import Link from '@/shared/ui/Link/Link' +import styles from './blog-item-for-container.module.scss' + export type Props = { card: TBlogItem } diff --git a/src/components/BlogMain/BlogMain.tsx b/src/components/BlogMain/BlogMain.tsx index 76f8bfc4..4dc261f4 100644 --- a/src/components/BlogMain/BlogMain.tsx +++ b/src/components/BlogMain/BlogMain.tsx @@ -1,13 +1,16 @@ import { FC, useState } from 'react' -import BlogItemForContainer from '../BlogItemForContainer/BlogItemForContainer' + import type { PropsBlog } from '@/models/PropsBlog' -import BlogTags from '../BlogTags/BlogTags' +import Heading from '@/shared/ui/Heading/Heading' +import Subheading from '@/shared/ui/Subheading/Subheading' + import BlogCategories from '../BlogCategories/BlogCategories' -import WrapperForMainContent from '../WrapperForMainContent/WrapperForMainContent' +import BlogItemForContainer from '../BlogItemForContainer/BlogItemForContainer' import BlogMainItem from '../BlogMainItem/BlogMainItem' +import BlogTags from '../BlogTags/BlogTags' import { Pagination } from '../Pagination/Pagination' -import Heading from '@/shared/ui/Heading/Heading' -import Subheading from '@/shared/ui/Subheading/Subheading' +import WrapperForMainContent from '../WrapperForMainContent/WrapperForMainContent' + import styles from './blog-main.module.scss' const BlogMain: FC = props => { @@ -57,9 +60,11 @@ const BlogMain: FC = props => {
    - {items.slice(currentPage == 1 ? 0 : itemNumber * (currentPage - 1), itemNumber * currentPage).map(item => ( - - ))} + {items + .slice(currentPage == 1 ? 0 : itemNumber * (currentPage - 1), itemNumber * currentPage) + .map(item => ( + + ))}
diff --git a/src/components/BlogMainItem/BlogMainItem.tsx b/src/components/BlogMainItem/BlogMainItem.tsx index 95c5c88a..5c41b00f 100644 --- a/src/components/BlogMainItem/BlogMainItem.tsx +++ b/src/components/BlogMainItem/BlogMainItem.tsx @@ -1,12 +1,14 @@ -import { blogMainItemData } from '@/mockData/blogMainItemData' import { useEffect, useMemo } from 'react' -import ViewIcon from '@/assets/images/blogMainItem/icon-views.svg' + import CommentIcon from '@/assets/images/blogMainItem/icon-comments.svg' import DotIcon from '@/assets/images/blogMainItem/icon-dot.svg' +import ViewIcon from '@/assets/images/blogMainItem/icon-views.svg' +import { blogMainItemData } from '@/mockData/blogMainItemData' import { fromSS } from '@/shared/constants/constants' -import styles from './blog-main-item.module.scss' import Link from '@/shared/ui/Link/Link' +import styles from './blog-main-item.module.scss' + function BlogMainItem() { const mainItem = blogMainItemData const tags = useMemo( diff --git a/src/components/BlogTags/BlogTags.tsx b/src/components/BlogTags/BlogTags.tsx index c54d9878..a5b8e422 100644 --- a/src/components/BlogTags/BlogTags.tsx +++ b/src/components/BlogTags/BlogTags.tsx @@ -1,7 +1,9 @@ import { FC, useMemo } from 'react' -import styles from './blog-tags.module.scss' + import type { PropsTags } from '@/models/PropsBlog' +import styles from './blog-tags.module.scss' + const BlogTags: FC = props => { const { cards, filterItems } = props const tags = useMemo( diff --git a/src/components/CardForContainer/CardForContainer.tsx b/src/components/CardForContainer/CardForContainer.tsx index 015b76a3..f8202230 100644 --- a/src/components/CardForContainer/CardForContainer.tsx +++ b/src/components/CardForContainer/CardForContainer.tsx @@ -1,9 +1,11 @@ import { FC } from 'react' + import { TCard } from '@/models/CardModel' import { TEXT_PROMO } from '@/shared/constants/constants' -import styles from './card-for-container.module.scss' import Link from '@/shared/ui/Link/Link' +import styles from './card-for-container.module.scss' + export type Props = { card: TCard } diff --git a/src/components/CardPreview/CardPreview.tsx b/src/components/CardPreview/CardPreview.tsx index 0a43987c..e3c632d6 100644 --- a/src/components/CardPreview/CardPreview.tsx +++ b/src/components/CardPreview/CardPreview.tsx @@ -1,10 +1,13 @@ import { FC, lazy, useState, Suspense } from 'react' -import Modal from '@/shared/ui/Modal/Modal' + import { Button, ButtonSize, ButtonTheme } from '@/shared/ui/Button/Button' +import Modal from '@/shared/ui/Modal/Modal' +import Spinner from '@/shared/ui/Spinner/Spinner' + import { CardPreviewFooter } from '../CardPreviewFooter/CardPreviewFooter' import { CardPreviewHeader } from '../CardPreviewHeader/CardPreviewHeader' import { ProductAvailability } from '../ProductAvailability/ProductAvailability' -import Spinner from '@/shared/ui/Spinner/Spinner' + import styles from './CardPreview.module.scss' const LazyQuickPurchaseForm = lazy(() => import('@/features/QuickPurchase/index')) diff --git a/src/components/CardPreviewFooter/CardPreviewFooter.tsx b/src/components/CardPreviewFooter/CardPreviewFooter.tsx index 4f1eb697..e7820749 100644 --- a/src/components/CardPreviewFooter/CardPreviewFooter.tsx +++ b/src/components/CardPreviewFooter/CardPreviewFooter.tsx @@ -1,7 +1,9 @@ import { FC } from 'react' -import styles from './CardPreviewFooter.module.scss' + import { Button, ButtonSize, ButtonTheme } from '@/shared/ui/Button/Button' +import styles from './CardPreviewFooter.module.scss' + interface TCardPreview { handleRedirect: VoidFunction } diff --git a/src/components/CardPreviewHeader/CardPreviewHeader.tsx b/src/components/CardPreviewHeader/CardPreviewHeader.tsx index 88e9ead7..623e3e87 100644 --- a/src/components/CardPreviewHeader/CardPreviewHeader.tsx +++ b/src/components/CardPreviewHeader/CardPreviewHeader.tsx @@ -1,10 +1,12 @@ -import { FC } from 'react' import classnames from 'classnames' +import { FC } from 'react' + import IconCompare from '@/assets/icons/IconCompare.svg' import IconLike from '@/assets/icons/IconLike' -import styles from './CardPreviewHeader.module.scss' import { Button, ButtonSize } from '@/shared/ui/Button/Button' +import styles from './CardPreviewHeader.module.scss' + interface TCardPreviewHeader { isLiked: boolean isInCompared: boolean diff --git a/src/components/CatalogLink/CatalogLink.tsx b/src/components/CatalogLink/CatalogLink.tsx index 204c4fbf..b23546fd 100644 --- a/src/components/CatalogLink/CatalogLink.tsx +++ b/src/components/CatalogLink/CatalogLink.tsx @@ -1,6 +1,8 @@ -import { FC } from 'react' import classNames from 'classnames' +import { FC } from 'react' + import Link, { TLinkProps } from '@/shared/ui/Link/Link' + import styles from './catalogLink.module.scss' /** diff --git a/src/components/CategoryList/CategoryList.tsx b/src/components/CategoryList/CategoryList.tsx index 0f1c7fcf..e8b78610 100644 --- a/src/components/CategoryList/CategoryList.tsx +++ b/src/components/CategoryList/CategoryList.tsx @@ -1,6 +1,8 @@ import { FC } from 'react' + import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' import Link from '@/shared/ui/Link/Link' + import styles from './CategoryList.module.scss' /** diff --git a/src/components/ContainerCards/ContainerCards.tsx b/src/components/ContainerCards/ContainerCards.tsx index f0239870..504d5120 100644 --- a/src/components/ContainerCards/ContainerCards.tsx +++ b/src/components/ContainerCards/ContainerCards.tsx @@ -1,9 +1,12 @@ import { FC } from 'react' -import CardForContainer from '../CardForContainer/CardForContainer' -import { TCard } from '@/models/CardModel' + import IconLink from '@/assets/icons/IconLink' +import { TCard } from '@/models/CardModel' import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' import Link from '@/shared/ui/Link/Link' + +import CardForContainer from '../CardForContainer/CardForContainer' + import styles from './container-cards.module.scss' export type Props = { diff --git a/src/components/ContextMenuElement/ContextMenuElement.tsx b/src/components/ContextMenuElement/ContextMenuElement.tsx index fd2df7f3..16b419ef 100644 --- a/src/components/ContextMenuElement/ContextMenuElement.tsx +++ b/src/components/ContextMenuElement/ContextMenuElement.tsx @@ -1,5 +1,7 @@ import { type FC, ReactNode, useEffect, useRef, useState } from 'react' + import { LEFT_POSITION, RIGHT_POSITION } from '@/shared/constants/constants' + import styles from './contextMenuElement.module.scss' type TContextMenuElement = { diff --git a/src/components/Dots/Dots.tsx b/src/components/Dots/Dots.tsx index c217fce2..f0ce5635 100644 --- a/src/components/Dots/Dots.tsx +++ b/src/components/Dots/Dots.tsx @@ -1,4 +1,5 @@ import { FC } from 'react' + import styles from './dots.module.scss' export type Props = { diff --git a/src/components/Dropdown/Dropdown.tsx b/src/components/Dropdown/Dropdown.tsx index ef9bde63..0728b969 100644 --- a/src/components/Dropdown/Dropdown.tsx +++ b/src/components/Dropdown/Dropdown.tsx @@ -1,4 +1,5 @@ import React, { ChangeEvent, useState } from 'react' + import styles from './Dropdown.module.scss' interface DropdownProps extends React.HTMLProps { diff --git a/src/components/HeaderAccount/HeaderAccount.tsx b/src/components/HeaderAccount/HeaderAccount.tsx index d450c9f7..f07fc3eb 100644 --- a/src/components/HeaderAccount/HeaderAccount.tsx +++ b/src/components/HeaderAccount/HeaderAccount.tsx @@ -1,19 +1,21 @@ import { FC, lazy, useState, Suspense, useEffect } from 'react' import { useSelector } from 'react-redux' -import Modal from '@/shared/ui/Modal/Modal' + +import CartIcon from '@/assets/images/headerAccount/cart.svg' +import HeartIcon from '@/assets/images/headerAccount/heart.svg' import PersonIcon from '@/assets/images/headerAccount/person.svg' import PersonAuthIcon from '@/assets/images/headerAccount/person_auth.svg' import ScalesIcon from '@/assets/images/headerAccount/scales.svg' -import HeartIcon from '@/assets/images/headerAccount/heart.svg' -import CartIcon from '@/assets/images/headerAccount/cart.svg' -import Spinner from '@/shared/ui/Spinner/Spinner' -import styles from './headerAccount.module.scss' -import { useAppDispatch } from '@/shared/libs/hooks/store' -import { logout } from '@/features/login/model/services/logout/logout' import { getUserAuthStatus } from '@/features/login/model/selectors/getUserAuthStatus' +import { logout } from '@/features/login/model/services/logout/logout' import { loginActions } from '@/features/login/model/slice/loginSlice' -import Link from '@/shared/ui/Link/Link' import { Routes } from '@/shared/config/routerConfig/routes' +import { useAppDispatch } from '@/shared/libs/hooks/store' +import Link from '@/shared/ui/Link/Link' +import Modal from '@/shared/ui/Modal/Modal' +import Spinner from '@/shared/ui/Spinner/Spinner' + +import styles from './headerAccount.module.scss' export type HeaderAccountProps = { counter: number diff --git a/src/components/PageControls/PageControls.tsx b/src/components/PageControls/PageControls.tsx index 450f6172..426f8179 100644 --- a/src/components/PageControls/PageControls.tsx +++ b/src/components/PageControls/PageControls.tsx @@ -1,9 +1,11 @@ import { ChangeEventHandler, FC } from 'react' -import { Dropdown } from '@/components/Dropdown/Dropdown' + +import IconCompact from '@/assets/icons/IconCompact.svg' import IconGrid from '@/assets/icons/IconGrid.svg' import IconList from '@/assets/icons/IconList.svg' -import IconCompact from '@/assets/icons/IconCompact.svg' +import { Dropdown } from '@/components/Dropdown/Dropdown' import { ECardView } from '@/shared/model/types/common' + import styles from './PageControls.module.scss' type TPageControls = { diff --git a/src/components/PageDescription/PageDescription.tsx b/src/components/PageDescription/PageDescription.tsx index 61a7134f..00281992 100644 --- a/src/components/PageDescription/PageDescription.tsx +++ b/src/components/PageDescription/PageDescription.tsx @@ -1,8 +1,9 @@ -import styles from './PageDescription.module.scss' import Heading from '@/shared/ui/Heading/Heading' import Link from '@/shared/ui/Link/Link' import Subheading from '@/shared/ui/Subheading/Subheading' +import styles from './PageDescription.module.scss' + /** * Компонент заголовка страницы товаров. * Содержит информацию о текущей просматриваемой категории. diff --git a/src/components/Pagination/Pagination.tsx b/src/components/Pagination/Pagination.tsx index e03d1ed4..41366253 100644 --- a/src/components/Pagination/Pagination.tsx +++ b/src/components/Pagination/Pagination.tsx @@ -1,4 +1,5 @@ import { FC } from 'react' + import styles from './Pagination.module.scss' type TPaginationProps = { @@ -15,7 +16,12 @@ type TPaginationProps = { * @param {function} handlePageChange - функция изменения отображаемой страницы; * @param {function} handleShowMore - функция управления подгрузкой дополнительного контента; */ -export const Pagination: FC = ({ currentPage, totalPages, handlePageChange, handleShowMore }) => { +export const Pagination: FC = ({ + currentPage, + totalPages, + handlePageChange, + handleShowMore +}) => { return (
diff --git a/src/components/ProductAvailability/ProductAvailability.tsx b/src/components/ProductAvailability/ProductAvailability.tsx index 8e365746..555b97c7 100644 --- a/src/components/ProductAvailability/ProductAvailability.tsx +++ b/src/components/ProductAvailability/ProductAvailability.tsx @@ -1,4 +1,5 @@ import { FC } from 'react' + import styles from './ProductAvailability.module.scss' /** diff --git a/src/components/ProductCard/ProductCard.tsx b/src/components/ProductCard/ProductCard.tsx index 3ee369f1..1bb2995b 100644 --- a/src/components/ProductCard/ProductCard.tsx +++ b/src/components/ProductCard/ProductCard.tsx @@ -1,13 +1,16 @@ +import classnames from 'classnames' import { FC, useState } from 'react' + +import { PRODUCT_PHOTOS } from '@/mockData/productsPageOptions' import { ECardView } from '@/shared/model/types/common' -import styles from './ProductCard.module.scss' -import classnames from 'classnames' +import Carousel from '@/shared/ui/Carousel/Carousel' + import { ProductAvailability } from '../ProductAvailability/ProductAvailability' import { WidgetButtonsFunctions } from '../WidgetButtonsFunctions/WidgetButtonsFunctions' import { WidgetButtonsPurchase } from '../WidgetButtonsPurchase/WidgetButtonsPurchase' + +import styles from './ProductCard.module.scss' import { getStylesForCurrentLayout } from './utils/utils' -import { PRODUCT_PHOTOS } from '@/mockData/productsPageOptions' -import Carousel from '@/shared/ui/Carousel/Carousel' type TProductCard = { layout: ECardView @@ -115,8 +118,9 @@ export const ProductCard: FC = ({ layout, onEyeClick }) => {
{layout === 'list' && (

- GSM/GPS трекер-маяк GF-07 для отслеживания собак, детей, автомобилей с приложением на телефон. Миниатюрный - GPS трекер модели GF-07 предназначен для охраны вашего имущества и контроля за местонахождением. + GSM/GPS трекер-маяк GF-07 для отслеживания собак, детей, автомобилей с приложением на телефон. + Миниатюрный GPS трекер модели GF-07 предназначен для охраны вашего имущества и контроля за + местонахождением.

)} {layout === 'compact' && ( diff --git a/src/components/Slider/Slider.tsx b/src/components/Slider/Slider.tsx index ea31d14a..d4261345 100644 --- a/src/components/Slider/Slider.tsx +++ b/src/components/Slider/Slider.tsx @@ -1,11 +1,14 @@ import { FC, useState } from 'react' -import Arrows from '../Arrows/Arrows' -import Dots from '../Dots/Dots' + import { sliderData } from '@/mockData/sliderData' +import { media } from '@/shared/styles/utils/media' import Link from '@/shared/ui/Link/Link' -import styles from './slider.module.scss' import Img from '@/ui/img' -import { media } from '@/shared/styles/utils/media' + +import Arrows from '../Arrows/Arrows' +import Dots from '../Dots/Dots' + +import styles from './slider.module.scss' /** * Component Slider diff --git a/src/components/SliderBlock/SliderBlock.tsx b/src/components/SliderBlock/SliderBlock.tsx index 9ae6936c..b8e0c118 100644 --- a/src/components/SliderBlock/SliderBlock.tsx +++ b/src/components/SliderBlock/SliderBlock.tsx @@ -1,6 +1,7 @@ -import styles from './slider-block.module.scss' import Slider from '../Slider/Slider' +import styles from './slider-block.module.scss' + /** * Component SliderBlock * Обертка для слайдера на главной странице. diff --git a/src/components/Subscribe/Subscribe.tsx b/src/components/Subscribe/Subscribe.tsx index c4a18f33..84e08f5f 100644 --- a/src/components/Subscribe/Subscribe.tsx +++ b/src/components/Subscribe/Subscribe.tsx @@ -1,7 +1,9 @@ -import styles from './Subscribe.module.scss' import imgSubs from '@/assets/images/img-subsc-small.png' + import SubscribeForm from '../../features/SubscribeForm/SubscribeForm' +import styles from './Subscribe.module.scss' + const Subscribe = () => { const onSubmitHandler = () => {} diff --git a/src/components/WidgetButtonsFunctions/WidgetButtonsFunctions.tsx b/src/components/WidgetButtonsFunctions/WidgetButtonsFunctions.tsx index 9f609ef9..bb9185d9 100644 --- a/src/components/WidgetButtonsFunctions/WidgetButtonsFunctions.tsx +++ b/src/components/WidgetButtonsFunctions/WidgetButtonsFunctions.tsx @@ -1,12 +1,14 @@ -import { FC } from 'react' import classnames from 'classnames' +import { FC } from 'react' -import { ECardView } from '@/shared/model/types/common' import IconCompare from '@/assets/icons/IconCompare.svg' import IconLike from '@/assets/icons/IconLike' +import { ECardView } from '@/shared/model/types/common' import { Button, ButtonSize, ButtonTheme } from '@/shared/ui/Button/Button' -import { getStylesForCurrentLayout } from '../ProductCard/utils/utils' + import styles from '../ProductCard/ProductCard.module.scss' +import { getStylesForCurrentLayout } from '../ProductCard/utils/utils' + import stylesSvg from './WidgetButtonsFunctions.module.scss' type TWidgetButtonsFunctions = { diff --git a/src/components/WidgetButtonsPurchase/WidgetButtonsPurchase.tsx b/src/components/WidgetButtonsPurchase/WidgetButtonsPurchase.tsx index 6bdc8d61..abf41054 100644 --- a/src/components/WidgetButtonsPurchase/WidgetButtonsPurchase.tsx +++ b/src/components/WidgetButtonsPurchase/WidgetButtonsPurchase.tsx @@ -1,8 +1,10 @@ import { FC } from 'react' + import IconCart from '@/assets/icons/IconCart.svg' import IconEye from '@/assets/icons/IconEye.svg' import { ECardView } from '@/shared/model/types/common' import { Button, ButtonSize, ButtonTheme } from '@/shared/ui/Button/Button' + import styles from './WidgetButtonsPurchase.module.scss' type TWidgetButtonsPurchase = { diff --git a/src/components/WrapperForMainContent/WrapperForMainContent.tsx b/src/components/WrapperForMainContent/WrapperForMainContent.tsx index 597c1d66..d0366d7c 100644 --- a/src/components/WrapperForMainContent/WrapperForMainContent.tsx +++ b/src/components/WrapperForMainContent/WrapperForMainContent.tsx @@ -1,4 +1,5 @@ import { FC, PropsWithChildren } from 'react' + import styles from './wrapper.module.scss' /** diff --git a/src/components/header/header.tsx b/src/components/header/header.tsx index 6fcef70a..603571cd 100644 --- a/src/components/header/header.tsx +++ b/src/components/header/header.tsx @@ -1,27 +1,30 @@ -import { coreBaseData } from '@/mockData/coreBaseData' -import { useEffect, useMemo } from 'react' import classNames from 'classnames' -import Logo from '../../shared/ui/logo/Logo' +import { useEffect, useMemo } from 'react' +import { useDispatch, useSelector } from 'react-redux' + +import { AppDispatch } from '@/app/providers/StoreProvider/config/store' import ArrowIcon from '@/assets/icons/arrow.svg' +import IconCategories from '@/assets/icons/IconCategories.svg' import LightningIcon from '@/assets/images/header/lightning.svg' -import ContextMenuElement from '../ContextMenuElement/ContextMenuElement' -import HeaderAccount from '../HeaderAccount/HeaderAccount' -import { PHONE_NUMBER } from '@/shared/constants/constants' +import { selectCategories, selectDisplayedCategories } from '@/entities/Category/selectors/categorySelectors' +import { fetchCategories } from '@/entities/Category/slice/categorySlice' +import SearchProduct from '@/features/SearchProduct' +import { linkItems } from '@/mockData/catalogListData' +import { coreBaseData } from '@/mockData/coreBaseData' import { headerAccountData } from '@/mockData/headerAccountData' -import CatalogLink from '../CatalogLink/CatalogLink' import { Routes } from '@/shared/config/routerConfig/routes' +import { PHONE_NUMBER } from '@/shared/constants/constants' import Link from '@/shared/ui/Link/Link' -import IconCategories from '@/assets/icons/IconCategories.svg' -import SearchProduct from '@/features/SearchProduct' -import { linkItems } from '@/mockData/catalogListData' -import styles from './header.module.scss' -import { useDispatch, useSelector } from 'react-redux' -import { fetchCategories } from '@/entities/Category/slice/categorySlice' -import { AppDispatch } from '@/app/providers/StoreProvider/config/store' -import { selectCategories, selectDisplayedCategories } from '@/entities/Category/selectors/categorySelectors' import CatalogNodeItem from '@/widgets/CatalogNodeItem/CatalogNodeItem' import NavigationLink from '@/widgets/NavigationLink/NavigationLink' +import Logo from '../../shared/ui/logo/Logo' +import CatalogLink from '../CatalogLink/CatalogLink' +import ContextMenuElement from '../ContextMenuElement/ContextMenuElement' +import HeaderAccount from '../HeaderAccount/HeaderAccount' + +import styles from './header.module.scss' + function Header() { const dispatch = useDispatch() const categories = useSelector(selectCategories) diff --git a/src/entities/AdvantageCard/ui/AdvantageCard/AdvantageCard.tsx b/src/entities/AdvantageCard/ui/AdvantageCard/AdvantageCard.tsx index a6fbf762..62dd05a2 100644 --- a/src/entities/AdvantageCard/ui/AdvantageCard/AdvantageCard.tsx +++ b/src/entities/AdvantageCard/ui/AdvantageCard/AdvantageCard.tsx @@ -1,5 +1,7 @@ import { FC } from 'react' + import Link from '@/shared/ui/Link/Link' + import styles from './advantageCard.module.scss' export type TAdvantageCardProps = { diff --git a/src/entities/BlogCard/BlogCard.stories.tsx b/src/entities/BlogCard/BlogCard.stories.tsx index d571daec..35f7d03e 100644 --- a/src/entities/BlogCard/BlogCard.stories.tsx +++ b/src/entities/BlogCard/BlogCard.stories.tsx @@ -1,7 +1,9 @@ import type { Meta, StoryObj } from '@storybook/react' -import BlogCard from './BlogCard' + import Img1 from '@/assets/images/blog/img-blog-01.png' +import BlogCard from './BlogCard' + const meta = { title: 'entities/BlogCard', component: BlogCard, diff --git a/src/entities/BlogCard/BlogCard.tsx b/src/entities/BlogCard/BlogCard.tsx index c189ae9b..bf03c425 100644 --- a/src/entities/BlogCard/BlogCard.tsx +++ b/src/entities/BlogCard/BlogCard.tsx @@ -1,8 +1,10 @@ import { FC, useMemo } from 'react' -import styles from './BlogCard.module.scss' -import Link from '@/shared/ui/Link/Link' -import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' + import NoImage from '@/assets/icons/image-not-found-icon.svg' +import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' +import Link from '@/shared/ui/Link/Link' + +import styles from './BlogCard.module.scss' type Props = { id: number diff --git a/src/entities/BrandCard/BrandCard.stories.tsx b/src/entities/BrandCard/BrandCard.stories.tsx index 5babf4d3..44a797ae 100644 --- a/src/entities/BrandCard/BrandCard.stories.tsx +++ b/src/entities/BrandCard/BrandCard.stories.tsx @@ -1,7 +1,9 @@ import type { Meta, StoryObj } from '@storybook/react' -import BrandCard from './BrandCard' + import Brand1 from '@/assets/images/brands/1-150x150.webp' +import BrandCard from './BrandCard' + const meta = { title: 'entities/BrandBlock', component: BrandCard, diff --git a/src/entities/BrandCard/BrandCard.tsx b/src/entities/BrandCard/BrandCard.tsx index 60095f28..893fb157 100644 --- a/src/entities/BrandCard/BrandCard.tsx +++ b/src/entities/BrandCard/BrandCard.tsx @@ -1,9 +1,11 @@ import { FC } from 'react' + +import BrandWithoutImage from '@/assets/images/brands/brand-without-image.webp' import { Routes } from '@/shared/config/routerConfig/routes' -import { Brand } from '@/widgets/BrandBlock/types/types' import Link from '@/shared/ui/Link/Link' import Img from '@/ui/img' -import BrandWithoutImage from '@/assets/images/brands/brand-without-image.webp' +import { Brand } from '@/widgets/BrandBlock/types/types' + import styles from './BrandCard.module.scss' interface BrandCardProps { diff --git a/src/entities/CardReview/ui/CardReview/CardReview.stories.tsx b/src/entities/CardReview/ui/CardReview/CardReview.stories.tsx index 1289f31a..3d80613d 100644 --- a/src/entities/CardReview/ui/CardReview/CardReview.stories.tsx +++ b/src/entities/CardReview/ui/CardReview/CardReview.stories.tsx @@ -1,4 +1,5 @@ import type { Meta, StoryObj } from '@storybook/react' + import CardReview from './CardReview' const meta = { diff --git a/src/entities/CardReview/ui/CardReview/CardReview.tsx b/src/entities/CardReview/ui/CardReview/CardReview.tsx index 1181d05a..8cd29586 100644 --- a/src/entities/CardReview/ui/CardReview/CardReview.tsx +++ b/src/entities/CardReview/ui/CardReview/CardReview.tsx @@ -1,11 +1,13 @@ import { FC, useMemo } from 'react' + import IconStar from '@/assets/icons/IconStar' -import Paragraph from '@/shared/ui/Paragraph/Paragraph' import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' import Link from '@/shared/ui/Link/Link' -import styles from './cardReview.module.scss' +import Paragraph from '@/shared/ui/Paragraph/Paragraph' import Subheading from '@/shared/ui/Subheading/Subheading' +import styles from './cardReview.module.scss' + export type Props = { pk: number text: string diff --git a/src/entities/Category/slice/categorySlice.ts b/src/entities/Category/slice/categorySlice.ts index cc77499a..fa71e0be 100644 --- a/src/entities/Category/slice/categorySlice.ts +++ b/src/entities/Category/slice/categorySlice.ts @@ -1,9 +1,11 @@ import { createSlice, createAsyncThunk } from '@reduxjs/toolkit' -import { ApiError, ApiErrorTypes, ApiRoutes } from '@/shared/api/types' + import { ThunkConfig } from '@/app/providers/StoreProvider/config/StateSchema' -import { Category, CategorySchema } from '../types/types' import { apiErrorIdentify } from '@/shared/api/apiErrorIdentify' import { rejectedPayloadHandle } from '@/shared/api/rejectedPayloadHandle' +import { ApiError, ApiErrorTypes, ApiRoutes } from '@/shared/api/types' + +import { Category, CategorySchema } from '../types/types' const initialState: CategorySchema = { categories: [], diff --git a/src/entities/ContactCard/ContactCard.tsx b/src/entities/ContactCard/ContactCard.tsx index f84f04bf..1f048598 100644 --- a/src/entities/ContactCard/ContactCard.tsx +++ b/src/entities/ContactCard/ContactCard.tsx @@ -1,9 +1,11 @@ import { FC } from 'react' + import { TMessenger } from '@/models/MessengerModel' -import styles from './contactCard.module.scss' import Link from '@/shared/ui/Link/Link' import Paragraph from '@/shared/ui/Paragraph/Paragraph' +import styles from './contactCard.module.scss' + export type PropsContactCard = { messenger: TMessenger Icon: string diff --git a/src/entities/NewsCard/NewsCard.stories.tsx b/src/entities/NewsCard/NewsCard.stories.tsx index c4344e62..11fd6025 100644 --- a/src/entities/NewsCard/NewsCard.stories.tsx +++ b/src/entities/NewsCard/NewsCard.stories.tsx @@ -1,4 +1,5 @@ import type { Meta, StoryObj } from '@storybook/react' + import NewsCard from './NewsCard' const meta = { diff --git a/src/entities/NewsCard/NewsCard.tsx b/src/entities/NewsCard/NewsCard.tsx index 7c403a95..bc5385cb 100644 --- a/src/entities/NewsCard/NewsCard.tsx +++ b/src/entities/NewsCard/NewsCard.tsx @@ -1,8 +1,10 @@ import { FC, useMemo } from 'react' -import styles from './NewsCard.module.scss' -import Link from '@/shared/ui/Link/Link' -import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' + import NoImage from '@/assets/icons/image-not-found-icon.svg' +import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' +import Link from '@/shared/ui/Link/Link' + +import styles from './NewsCard.module.scss' type Props = { id: number diff --git a/src/entities/Payments/Payments.tsx b/src/entities/Payments/Payments.tsx index a762662b..a966e37d 100644 --- a/src/entities/Payments/Payments.tsx +++ b/src/entities/Payments/Payments.tsx @@ -1,5 +1,7 @@ import { type FC } from 'react' + import Link from '@/shared/ui/Link/Link' + import styles from './payments.module.scss' type TPayments = { diff --git a/src/entities/ProductEntity/ui/ProductEntity/ProductEntity.stories.tsx b/src/entities/ProductEntity/ui/ProductEntity/ProductEntity.stories.tsx index 3ab5d024..fedf7210 100644 --- a/src/entities/ProductEntity/ui/ProductEntity/ProductEntity.stories.tsx +++ b/src/entities/ProductEntity/ui/ProductEntity/ProductEntity.stories.tsx @@ -1,7 +1,9 @@ import type { Meta, StoryObj } from '@storybook/react' -import { ProductEntity } from './ProductEntity' + import image1 from '@/assets/images/product/2-500x500.webp' +import { ProductEntity } from './ProductEntity' + const meta = { title: 'entities/ProductEntity', component: ProductEntity, diff --git a/src/entities/ProductEntity/ui/ProductEntity/ProductEntity.tsx b/src/entities/ProductEntity/ui/ProductEntity/ProductEntity.tsx index 488cca88..4532a1f0 100644 --- a/src/entities/ProductEntity/ui/ProductEntity/ProductEntity.tsx +++ b/src/entities/ProductEntity/ui/ProductEntity/ProductEntity.tsx @@ -1,8 +1,10 @@ -import { TProduct } from '@/mockData/productsData' -import styles from './ProductEntity.module.scss' import { type FC } from 'react' + +import { TProduct } from '@/mockData/productsData' import Subheading from '@/shared/ui/Subheading/Subheading' +import styles from './ProductEntity.module.scss' + /** * Компонент служит для отображения товаров, пришедших с сервера. * @param {string} src-картика с изображением продукта; diff --git a/src/entities/SearchItem/SearchItem.stories.tsx b/src/entities/SearchItem/SearchItem.stories.tsx index 35f22c83..d772ee97 100644 --- a/src/entities/SearchItem/SearchItem.stories.tsx +++ b/src/entities/SearchItem/SearchItem.stories.tsx @@ -1,9 +1,11 @@ import { Meta, Story } from '@storybook/react' + import { searchResponseData } from '@/mockData/searchData' -import SearchItem from './SearchItem' import { TProduct } from '@/shared/model/types/common' import { TLinkProps } from '@/shared/ui/Link/Link' +import SearchItem from './SearchItem' + export default { title: 'Entities/SearchItem', component: SearchItem, diff --git a/src/entities/SearchItem/SearchItem.tsx b/src/entities/SearchItem/SearchItem.tsx index ca657e43..8f719d25 100644 --- a/src/entities/SearchItem/SearchItem.tsx +++ b/src/entities/SearchItem/SearchItem.tsx @@ -1,7 +1,9 @@ import { type FC, useMemo, useState } from 'react' + import ArrowRightIcon from '@/assets/images/searchItem/arrow-right.svg' import { TProduct } from '@/shared/model/types/common' import Link, { TLinkProps } from '@/shared/ui/Link/Link' + import styles from './SearchItem.module.scss' /** diff --git a/src/entities/StoryCard/StoryCard.stories.tsx b/src/entities/StoryCard/StoryCard.stories.tsx index 3ca6aeec..7711456c 100644 --- a/src/entities/StoryCard/StoryCard.stories.tsx +++ b/src/entities/StoryCard/StoryCard.stories.tsx @@ -1,7 +1,9 @@ import type { Meta, StoryObj } from '@storybook/react' -import StoryCard from './StoryCard' + import Img1 from '@/assets/images/stories/img-stories-01.png' +import StoryCard from './StoryCard' + const meta = { title: 'entities/StoryCard', component: StoryCard, diff --git a/src/entities/StoryCard/StoryCard.tsx b/src/entities/StoryCard/StoryCard.tsx index 31e326da..2c811b34 100644 --- a/src/entities/StoryCard/StoryCard.tsx +++ b/src/entities/StoryCard/StoryCard.tsx @@ -1,8 +1,10 @@ import { FC } from 'react' + import { TCard } from '@/models/CardModel' -import styles from './StoryCard.module.scss' import Link from '@/shared/ui/Link/Link' +import styles from './StoryCard.module.scss' + export type Props = { card: TCard } diff --git a/src/features/CallBack/ui/CallBack/CallBack.tsx b/src/features/CallBack/ui/CallBack/CallBack.tsx index 053d0a5b..a795c34f 100644 --- a/src/features/CallBack/ui/CallBack/CallBack.tsx +++ b/src/features/CallBack/ui/CallBack/CallBack.tsx @@ -1,15 +1,17 @@ -import React, { useCallback } from 'react' import { ErrorMessage, Field, Form, Formik, FormikHelpers } from 'formik' +import React, { useCallback } from 'react' + import IconClose from '@/assets/icons/IconClose.svg' -import { Input } from '@/shared/ui/Input/Input' +import { CallBackData } from '@/features/CallBack/models/types/types' +import { validationSchema } from '@/features/CallBack/models/validation/validation' import { Button, ButtonSize, ButtonTheme } from '@/shared/ui/Button/Button' -import { Textarea } from '@/shared/ui/Textarea/Textarea' import Heading from '@/shared/ui/Heading/Heading' -import Paragraph, { ParagraphTheme } from '@/shared/ui/Paragraph/Paragraph' +import { Input } from '@/shared/ui/Input/Input' import Label from '@/shared/ui/Label/Label' +import Paragraph, { ParagraphTheme } from '@/shared/ui/Paragraph/Paragraph' import Span from '@/shared/ui/Span/Span' -import { validationSchema } from '@/features/CallBack/models/validation/validation' -import { CallBackData } from '@/features/CallBack/models/types/types' +import { Textarea } from '@/shared/ui/Textarea/Textarea' + import styles from './CallBack.module.scss' interface CallBackProps { diff --git a/src/features/CartCouponApply/ui/CartCouponApply/CartCouponApply.stories.tsx b/src/features/CartCouponApply/ui/CartCouponApply/CartCouponApply.stories.tsx index b9ba4466..f026deb5 100644 --- a/src/features/CartCouponApply/ui/CartCouponApply/CartCouponApply.stories.tsx +++ b/src/features/CartCouponApply/ui/CartCouponApply/CartCouponApply.stories.tsx @@ -1,4 +1,5 @@ import type { Meta, StoryObj } from '@storybook/react' + import { CartCouponApply } from './CartCouponApply' const meta = { diff --git a/src/features/CartCouponApply/ui/CartCouponApply/CartCouponApply.tsx b/src/features/CartCouponApply/ui/CartCouponApply/CartCouponApply.tsx index 548e65a4..7a430b40 100644 --- a/src/features/CartCouponApply/ui/CartCouponApply/CartCouponApply.tsx +++ b/src/features/CartCouponApply/ui/CartCouponApply/CartCouponApply.tsx @@ -1,8 +1,10 @@ import { useState } from 'react' -import styles from './CartCouponApply.module.scss' + +import { Button, ButtonSize, ButtonTheme } from '@/shared/ui/Button/Button' import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' import { Input, InputSize, InputTheme } from '@/shared/ui/Input/Input' -import { Button, ButtonSize, ButtonTheme } from '@/shared/ui/Button/Button' + +import styles from './CartCouponApply.module.scss' const states = { CERTIFICATE: 'CERTIFICATE', diff --git a/src/features/CartEdit/ui/CartEdit/CartEdit.stories.tsx b/src/features/CartEdit/ui/CartEdit/CartEdit.stories.tsx index 22aa1f6c..379de7d5 100644 --- a/src/features/CartEdit/ui/CartEdit/CartEdit.stories.tsx +++ b/src/features/CartEdit/ui/CartEdit/CartEdit.stories.tsx @@ -1,8 +1,10 @@ import type { Meta, StoryObj } from '@storybook/react' -import { CartEdit, TCartEditProps } from './CartEdit' -import image1 from '@/assets/images/product/2-500x500.webp' import { FC } from 'react' +import image1 from '@/assets/images/product/2-500x500.webp' + +import { CartEdit, TCartEditProps } from './CartEdit' + const CartEditWrapper: FC = props => { return (
diff --git a/src/features/CartEdit/ui/CartEdit/CartEdit.tsx b/src/features/CartEdit/ui/CartEdit/CartEdit.tsx index a179302d..6c07e5d7 100644 --- a/src/features/CartEdit/ui/CartEdit/CartEdit.tsx +++ b/src/features/CartEdit/ui/CartEdit/CartEdit.tsx @@ -1,10 +1,12 @@ -import { TCartItemExt } from '@/mockData/cartData' -import styles from './CartEdit.module.scss' import { useEffect, useState } from 'react' -import ButtonDots from '@/shared/ui/ButtonDots/ButtonDots' + import { ProductEntity } from '@/entities/ProductEntity/ui/ProductEntity/ProductEntity' -import Subheading from '@/shared/ui/Subheading/Subheading' +import { TCartItemExt } from '@/mockData/cartData' +import ButtonDots from '@/shared/ui/ButtonDots/ButtonDots' import Paragraph from '@/shared/ui/Paragraph/Paragraph' +import Subheading from '@/shared/ui/Subheading/Subheading' + +import styles from './CartEdit.module.scss' export type TCartEditProps = { product: TCartItemExt diff --git a/src/features/Contacts/Contacts.tsx b/src/features/Contacts/Contacts.tsx index c0499344..df35d504 100644 --- a/src/features/Contacts/Contacts.tsx +++ b/src/features/Contacts/Contacts.tsx @@ -1,11 +1,13 @@ -import { type FC, useState } from 'react' import classNames from 'classnames' -import { TMessenger } from '@/models/MessengerModel' -import styles from './contacts.module.scss' -import { Button, ButtonTheme, ButtonDesign } from '@/shared/ui/Button/Button' +import { type FC, useState } from 'react' + import MessageIcon from '@/assets/icons/chat.svg' import CloseIcon from '@/assets/icons/IconMessageClose.svg' import ContactCard from '@/entities/ContactCard/ContactCard' +import { TMessenger } from '@/models/MessengerModel' +import { Button, ButtonTheme, ButtonDesign } from '@/shared/ui/Button/Button' + +import styles from './contacts.module.scss' export type PropsContacts = { messenger: TMessenger[] diff --git a/src/features/QuickPurchase/ui/QuickPurchaseForm/QuickPurchaseForm.tsx b/src/features/QuickPurchase/ui/QuickPurchaseForm/QuickPurchaseForm.tsx index dace388c..4a50c4b4 100644 --- a/src/features/QuickPurchase/ui/QuickPurchaseForm/QuickPurchaseForm.tsx +++ b/src/features/QuickPurchase/ui/QuickPurchaseForm/QuickPurchaseForm.tsx @@ -1,15 +1,17 @@ -import React, { useCallback } from 'react' import { Formik, Field, Form, ErrorMessage, FormikHelpers } from 'formik' +import React, { useCallback } from 'react' + import IconClose from '@/assets/icons/IconClose.svg' -import { Input } from '@/shared/ui/Input/Input' +import { IFormValues } from '@/features/QuickPurchase/model/types/types' +import { validationSchema } from '@/features/QuickPurchase/model/validation/validation' import { Button, ButtonSize, ButtonTheme } from '@/shared/ui/Button/Button' -import { Textarea } from '@/shared/ui/Textarea/Textarea' import Heading from '@/shared/ui/Heading/Heading' -import Paragraph, { ParagraphTheme } from '@/shared/ui/Paragraph/Paragraph' +import { Input } from '@/shared/ui/Input/Input' import Label from '@/shared/ui/Label/Label' +import Paragraph, { ParagraphTheme } from '@/shared/ui/Paragraph/Paragraph' import Span from '@/shared/ui/Span/Span' -import { validationSchema } from '@/features/QuickPurchase/model/validation/validation' -import { IFormValues } from '@/features/QuickPurchase/model/types/types' +import { Textarea } from '@/shared/ui/Textarea/Textarea' + import styles from './QuickPurchaseForm.module.scss' interface QuickPurchaseProps { diff --git a/src/features/SearchProduct/slice/searchProductSlice.ts b/src/features/SearchProduct/slice/searchProductSlice.ts index c8de78c1..ea5a5cc2 100644 --- a/src/features/SearchProduct/slice/searchProductSlice.ts +++ b/src/features/SearchProduct/slice/searchProductSlice.ts @@ -1,12 +1,14 @@ import { createSlice, createAsyncThunk } from '@reduxjs/toolkit' -import { ApiError, ApiErrorTypes, ApiRoutes } from '@/shared/api/types' + import { ThunkConfig } from '@/app/providers/StoreProvider/config/StateSchema' -import { SearchResultSchema } from '../types/types' +import { Category } from '@/entities/Category/types/types' import { apiErrorIdentify } from '@/shared/api/apiErrorIdentify' import { rejectedPayloadHandle } from '@/shared/api/rejectedPayloadHandle' -import { Category } from '@/entities/Category/types/types' +import { ApiError, ApiErrorTypes, ApiRoutes } from '@/shared/api/types' import { TProduct } from '@/shared/model/types/common' +import { SearchResultSchema } from '../types/types' + type SearchPayload = { category: Category[] product: { results: TProduct[] } diff --git a/src/features/SearchProduct/ui/SearchProduct.stories.tsx b/src/features/SearchProduct/ui/SearchProduct.stories.tsx index 3c6bee42..b97b32af 100644 --- a/src/features/SearchProduct/ui/SearchProduct.stories.tsx +++ b/src/features/SearchProduct/ui/SearchProduct.stories.tsx @@ -1,4 +1,5 @@ import { Meta, Story } from '@storybook/react' + import SearchProduct from './SearchProduct' export default { diff --git a/src/features/SearchProduct/ui/SearchProduct.tsx b/src/features/SearchProduct/ui/SearchProduct.tsx index bad5ff08..487dc392 100644 --- a/src/features/SearchProduct/ui/SearchProduct.tsx +++ b/src/features/SearchProduct/ui/SearchProduct.tsx @@ -1,12 +1,14 @@ import { useRef, useEffect, useState } from 'react' +import { useNavigate } from 'react-router-dom' + import { searchResponseData } from '@/mockData/searchData' +import { Routes } from '@/shared/config/routerConfig/routes' import { TResultData } from '@/shared/model/types/common' -import SearchResult from '@/widgets/SearchResult/SearchResult' -import { Input, InputSize, InputTheme } from '@/shared/ui/Input/Input' import { Button, ButtonDesign, ButtonSize, ButtonTheme } from '@/shared/ui/Button/Button' +import { Input, InputSize, InputTheme } from '@/shared/ui/Input/Input' +import SearchResult from '@/widgets/SearchResult/SearchResult' + import styles from './SearchProduct.module.scss' -import { Routes } from '@/shared/config/routerConfig/routes' -import { useNavigate } from 'react-router-dom' // @TODO: Перевести форму на Formik + Yup // https://github.com/Studio-Yandex-Practicum/maxboom_frontend/issues/92 diff --git a/src/features/SubscribeForm/SubscribeForm.tsx b/src/features/SubscribeForm/SubscribeForm.tsx index c581dd39..4282c9ca 100644 --- a/src/features/SubscribeForm/SubscribeForm.tsx +++ b/src/features/SubscribeForm/SubscribeForm.tsx @@ -1,8 +1,10 @@ +import classNames from 'classnames' import { type FC, FormEvent } from 'react' + import SubscribeIcon from '@/assets/images/subscriptionForm/icon-subsc.svg' -import styles from './subscribeForm.module.scss' import { Input, InputSize, InputTheme } from '@/shared/ui/Input/Input' -import classNames from 'classnames' + +import styles from './subscribeForm.module.scss' type TSubscribeForm = { type: 'footer' | 'subscribe' diff --git a/src/features/login/model/services/loginByUsername/loginByUsername.ts b/src/features/login/model/services/loginByUsername/loginByUsername.ts index 53e28d59..f5b74ac9 100644 --- a/src/features/login/model/services/loginByUsername/loginByUsername.ts +++ b/src/features/login/model/services/loginByUsername/loginByUsername.ts @@ -1,11 +1,13 @@ import { createAsyncThunk } from '@reduxjs/toolkit' + import { ThunkConfig } from '@/app/providers/StoreProvider/config/StateSchema' -import { ApiError, ApiErrorTypes, ApiRoutes } from '@/shared/api/types' -import { LoginAuthData, LoginTokenData } from '../../../model/types/types' import { apiErrorIdentify } from '@/shared/api/apiErrorIdentify' +import { ApiError, ApiErrorTypes, ApiRoutes } from '@/shared/api/types' import { LOCAL_STORAGE_TOKEN_KEY } from '@/shared/constants/localStorage' import { $localStorageHandler } from '@/shared/libs/helpers/localStorageHandler' +import { LoginAuthData, LoginTokenData } from '../../../model/types/types' + export const loginByUsername = createAsyncThunk>( 'login/loginByUsername', async (authData, thunkAPI) => { diff --git a/src/features/login/model/services/logout/logout.ts b/src/features/login/model/services/logout/logout.ts index 7cc2dd80..3585c5d7 100644 --- a/src/features/login/model/services/logout/logout.ts +++ b/src/features/login/model/services/logout/logout.ts @@ -1,7 +1,8 @@ import { createAsyncThunk } from '@reduxjs/toolkit' + import { ThunkConfig } from '@/app/providers/StoreProvider/config/StateSchema' -import { ApiError, ApiErrorTypes, ApiRoutes } from '@/shared/api/types' import { apiErrorIdentify } from '@/shared/api/apiErrorIdentify' +import { ApiError, ApiErrorTypes, ApiRoutes } from '@/shared/api/types' import { LOCAL_STORAGE_TOKEN_KEY } from '@/shared/constants/localStorage' import { $localStorageHandler } from '@/shared/libs/helpers/localStorageHandler' diff --git a/src/features/login/model/slice/loginSlice.ts b/src/features/login/model/slice/loginSlice.ts index 8e5a43fb..4ea86115 100644 --- a/src/features/login/model/slice/loginSlice.ts +++ b/src/features/login/model/slice/loginSlice.ts @@ -1,8 +1,10 @@ import { createSlice } from '@reduxjs/toolkit' -import { loginByUsername } from '../services/loginByUsername/loginByUsername' + import { rejectedPayloadHandle } from '@/shared/api/rejectedPayloadHandle' -import { LoginSchema } from '../types/types' + +import { loginByUsername } from '../services/loginByUsername/loginByUsername' import { logout } from '../services/logout/logout' +import { LoginSchema } from '../types/types' const initialState: LoginSchema = { isLoading: false, diff --git a/src/features/login/ui/LoginForm/LoginForm.tsx b/src/features/login/ui/LoginForm/LoginForm.tsx index 069307e2..d2d89f45 100644 --- a/src/features/login/ui/LoginForm/LoginForm.tsx +++ b/src/features/login/ui/LoginForm/LoginForm.tsx @@ -1,17 +1,20 @@ -import { useSelector } from 'react-redux' import { ErrorMessage, Field, Form, Formik, FormikHelpers } from 'formik' -import { Input } from '@/shared/ui/Input/Input' +import { useSelector } from 'react-redux' + +import { getErrorAuthStatus } from '@/features/login/model/selectors/getUserAuthStatus' +import { useAppDispatch } from '@/shared/libs/hooks/store' import { Button, ButtonSize, ButtonTheme } from '@/shared/ui/Button/Button' import Heading from '@/shared/ui/Heading/Heading' -import { validationSchema } from '../../model/validation/validation' -import { LoginAuthData } from '../../model/types/types' +import { Input } from '@/shared/ui/Input/Input' import Link from '@/shared/ui/Link/Link' -import styles from './LoginForm.module.scss' -import { useAppDispatch } from '@/shared/libs/hooks/store' -import { loginByUsername } from '../../model/services/loginByUsername/loginByUsername' -import { getErrorAuthStatus } from '@/features/login/model/selectors/getUserAuthStatus' import Paragraph, { ParagraphTheme } from '@/shared/ui/Paragraph/Paragraph' +import { loginByUsername } from '../../model/services/loginByUsername/loginByUsername' +import { LoginAuthData } from '../../model/types/types' +import { validationSchema } from '../../model/validation/validation' + +import styles from './LoginForm.module.scss' + export interface LoginFormProps { onLogin?: VoidFunction } diff --git a/src/index.tsx b/src/index.tsx index 13b3bd19..9e2e4daa 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,9 +1,11 @@ import React from 'react' import ReactDOM from 'react-dom/client' + import './app/styles/index.scss' -import App from './app/App' import { StoreProvider } from '@/app/providers/StoreProvider' +import App from './app/App' + const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement) root.render( diff --git a/src/mockData/advantagesData.ts b/src/mockData/advantagesData.ts index c281328d..87c7f973 100644 --- a/src/mockData/advantagesData.ts +++ b/src/mockData/advantagesData.ts @@ -1,6 +1,6 @@ import img1 from '@/assets/images/advantages/img1.png' import img2 from '@/assets/images/advantages/img2.png' -import img3 from '@/assets//images/advantages/img3.png' +import img3 from '@/assets/images/advantages/img3.png' import img4 from '@/assets/images/advantages/img4.png' import img5 from '@/assets/images/advantages/img5.png' import img6 from '@/assets/images/advantages/img6.png' diff --git a/src/mockData/blogPageData.ts b/src/mockData/blogPageData.ts index 0c6e1d2b..79ebc776 100644 --- a/src/mockData/blogPageData.ts +++ b/src/mockData/blogPageData.ts @@ -1,3 +1,4 @@ +import Img10 from '@/assets/images/blogPage/image10.webp' import Img1 from '@/assets/images/blogPage/img-blog-02.png' import Img2 from '@/assets/images/blogPage/img-blog-03.png' import Img3 from '@/assets/images/blogPage/img-blog-04.png' @@ -7,7 +8,6 @@ import Img6 from '@/assets/images/blogPage/img-blog-07.webp' import Img7 from '@/assets/images/blogPage/img-blog-08.webp' import Img8 from '@/assets/images/blogPage/img-blog-09.webp' import Img9 from '@/assets/images/blogPage/img-blog-10.webp' -import Img10 from '@/assets/images/blogPage/image10.webp' export const blogPageData = [ { diff --git a/src/mockData/brandData.ts b/src/mockData/brandData.ts index 7734876b..95c81777 100644 --- a/src/mockData/brandData.ts +++ b/src/mockData/brandData.ts @@ -1,8 +1,8 @@ import Brand1 from '@/assets/images/brands/1-150x150.webp' import Brand2 from '@/assets/images/brands/10-150x150.webp' +import Brand5 from '@/assets/images/brands/3-150x150.webp' import Brand3 from '@/assets/images/brands/4-150x150.webp' import Brand4 from '@/assets/images/brands/6-150x150.webp' -import Brand5 from '@/assets/images/brands/3-150x150.webp' import Brand6 from '@/assets/images/brands/9-150x150.webp' export const brandsData = [ diff --git a/src/mockData/searchData.ts b/src/mockData/searchData.ts index f249d48e..8307f91f 100644 --- a/src/mockData/searchData.ts +++ b/src/mockData/searchData.ts @@ -1,5 +1,5 @@ -import { TResultData } from '@/shared/model/types/common' import img1 from '@/assets/images/searchItem/cream.jpeg' +import { TResultData } from '@/shared/model/types/common' export const searchResponseData: TResultData = { data: [ diff --git a/src/mockData/storiesData.ts b/src/mockData/storiesData.ts index 65be96a1..32e5c8f5 100644 --- a/src/mockData/storiesData.ts +++ b/src/mockData/storiesData.ts @@ -1,6 +1,6 @@ +import Img1 from '@/assets/images/stories/img-stories-01.png' import Img2 from '@/assets/images/stories/img-stories-02.png' import Img3 from '@/assets/images/stories/img-stories-03.png' -import Img1 from '@/assets/images/stories/img-stories-01.png' import Img4 from '@/assets/images/stories/img-stories-04.png' import Img5 from '@/assets/images/stories/img-stories-05.png' import Img6 from '@/assets/images/stories/img-stories-06.png' diff --git a/src/pages/BlogPage/BlogPage.tsx b/src/pages/BlogPage/BlogPage.tsx index 7ab211b9..719678db 100644 --- a/src/pages/BlogPage/BlogPage.tsx +++ b/src/pages/BlogPage/BlogPage.tsx @@ -1,6 +1,6 @@ import BlogMain from '@/components/BlogMain/BlogMain' -import { blogPageData } from '@/mockData/blogPageData' import WrapperForMainContent from '@/components/WrapperForMainContent/WrapperForMainContent' +import { blogPageData } from '@/mockData/blogPageData' import { TEXT_BLOG, LINK_SHOW_ALL } from '@/shared/constants/constants' const BlogPage = () => { diff --git a/src/pages/CartPage/CartPage.tsx b/src/pages/CartPage/CartPage.tsx index 9f052b1b..8d7b82b2 100644 --- a/src/pages/CartPage/CartPage.tsx +++ b/src/pages/CartPage/CartPage.tsx @@ -1,16 +1,18 @@ +import { useEffect, useState } from 'react' +import { Link } from 'react-router-dom' + +import WrapperForMainContent from '@/components/WrapperForMainContent/WrapperForMainContent' import { CartCouponApply } from '@/features/CartCouponApply/ui/CartCouponApply/CartCouponApply' import { CartEdit } from '@/features/CartEdit/ui/CartEdit/CartEdit' -import { MakeOrder } from '@/widgets/MakeOrder/ui/MakeOrder/MakeOrder' -import styles from './CartPage.module.scss' -import WrapperForMainContent from '@/components/WrapperForMainContent/WrapperForMainContent' -import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' -import Subheading from '@/shared/ui/Subheading/Subheading' -import { useEffect, useState } from 'react' import { TCart, TCartItem, TCartItemExt, cartData } from '@/mockData/cartData' import { getProduct } from '@/shared/api/maxboom/product' -import { Link } from 'react-router-dom' -import { TOrder } from '@/shared/model/types/common' import { MAX_PRODUCTS_NUMBER } from '@/shared/constants/constants' +import { TOrder } from '@/shared/model/types/common' +import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' +import Subheading from '@/shared/ui/Subheading/Subheading' +import { MakeOrder } from '@/widgets/MakeOrder/ui/MakeOrder/MakeOrder' + +import styles from './CartPage.module.scss' /** * Компонент страница корзины. На странице отображаются товары в корзине, можно изменять кол-во товаров в корзине, diff --git a/src/pages/ComparePage/ComparePage.tsx b/src/pages/ComparePage/ComparePage.tsx index 29c5e32e..5a6cbf87 100644 --- a/src/pages/ComparePage/ComparePage.tsx +++ b/src/pages/ComparePage/ComparePage.tsx @@ -1,6 +1,7 @@ import WrapperForMainContent from '@/components/WrapperForMainContent/WrapperForMainContent' import Heading from '@/shared/ui/Heading/Heading' import Subheading from '@/shared/ui/Subheading/Subheading' + import styles from './ComparePage.module.scss' /** diff --git a/src/pages/FavoritesPage/FavoritesPage.tsx b/src/pages/FavoritesPage/FavoritesPage.tsx index 87a8f9b1..2e426205 100644 --- a/src/pages/FavoritesPage/FavoritesPage.tsx +++ b/src/pages/FavoritesPage/FavoritesPage.tsx @@ -1,6 +1,7 @@ import WrapperForMainContent from '@/components/WrapperForMainContent/WrapperForMainContent' import Heading from '@/shared/ui/Heading/Heading' import Subheading from '@/shared/ui/Subheading/Subheading' + import styles from './FavoritesPage.module.scss' /** diff --git a/src/pages/LoginPage/LoginPage.tsx b/src/pages/LoginPage/LoginPage.tsx index e4df6faf..db9c1981 100644 --- a/src/pages/LoginPage/LoginPage.tsx +++ b/src/pages/LoginPage/LoginPage.tsx @@ -1,10 +1,12 @@ import { Suspense, lazy, useCallback } from 'react' import { useNavigate } from 'react-router' + import WrapperForMainContent from '@/components/WrapperForMainContent/WrapperForMainContent' +import { Routes } from '@/shared/config/routerConfig/routes' import Heading from '@/shared/ui/Heading/Heading' -import styles from './LoginPage.module.scss' import Spinner from '@/shared/ui/Spinner/Spinner' -import { Routes } from '@/shared/config/routerConfig/routes' + +import styles from './LoginPage.module.scss' const LazyLoginForm = lazy(() => import('@/features/login/index')) diff --git a/src/pages/MainPage/MainPage.tsx b/src/pages/MainPage/MainPage.tsx index e421ebda..c1cda542 100644 --- a/src/pages/MainPage/MainPage.tsx +++ b/src/pages/MainPage/MainPage.tsx @@ -1,16 +1,16 @@ -import WrapperForMainContent from '@/components/WrapperForMainContent/WrapperForMainContent' +import ArticleBlock from '@/components/ArticleBlock/ArticleBlock' +// import ContainerCards from '@/components/ContainerCards/ContainerCards' import SliderBlock from '@/components/SliderBlock/SliderBlock' +import WrapperForMainContent from '@/components/WrapperForMainContent/WrapperForMainContent' +// import { storiesData } from '@/mockData/storiesData' +import { TEXT_CUSTOMERS_ABOUT_US, LINK_REVIEWS_ALL } from '@/shared/constants/constants' +import Advantages from '@/widgets/Advantages/ui/Advantages/Advantages' +import BlogBlock from '@/widgets/BlogBlock/ui/BlogBlock' import BrandsBlock from '@/widgets/BrandBlock/ui/BrandBlock/BrandBlock' -import { storiesData } from '@/mockData/storiesData' -import { TEXT_STORIES, TEXT_CUSTOMERS_ABOUT_US, LINK_REVIEWS_ALL } from '@/shared/constants/constants' -import ArticleBlock from '@/components/ArticleBlock/ArticleBlock' import CategoryGrid from '@/widgets/CategoryGrid/CategoryGrid' -import ReviewsBlock from '@/widgets/ReviewsBlock/ui/ReviewsBlock/ReviewsBlock' -import Advantages from '@/widgets/Advantages/ui/Advantages/Advantages' import NewsBlock from '@/widgets/NewsBlock/ui/NewsBlock' -import ContainerCards from '@/components/ContainerCards/ContainerCards' +import ReviewsBlock from '@/widgets/ReviewsBlock/ui/ReviewsBlock/ReviewsBlock' import StoriesBlock from '@/widgets/StoriesBlock/ui/StoriesBlock' -import BlogBlock from '@/widgets/BlogBlock/ui/BlogBlock' const MainPage = () => { return ( diff --git a/src/pages/ProductsPage/ProductsPage.tsx b/src/pages/ProductsPage/ProductsPage.tsx index 83cfa7dc..d923b96f 100644 --- a/src/pages/ProductsPage/ProductsPage.tsx +++ b/src/pages/ProductsPage/ProductsPage.tsx @@ -1,14 +1,16 @@ import { useState } from 'react' -import Modal from '@/shared/ui/Modal/Modal' -import WrapperForMainContent from '@/components/WrapperForMainContent/WrapperForMainContent' + +import { CardPreview } from '@/components/CardPreview/CardPreview' import { CategoryList } from '@/components/CategoryList/CategoryList' -import { PageDescription } from '@/components/PageDescription/PageDescription' import { PageControls } from '@/components/PageControls/PageControls' +import { PageDescription } from '@/components/PageDescription/PageDescription' import { Pagination } from '@/components/Pagination/Pagination' import { ProductCard } from '@/components/ProductCard/ProductCard' +import WrapperForMainContent from '@/components/WrapperForMainContent/WrapperForMainContent' import { ITEMS_PER_PAGE_OPTION, SORT_OPTION, TOTAL_PAGES } from '@/mockData/productsPageOptions' import { ECardView } from '@/shared/model/types/common' -import { CardPreview } from '@/components/CardPreview/CardPreview' +import Modal from '@/shared/ui/Modal/Modal' + import styles from './ProductsPage.module.scss' /** diff --git a/src/pages/RootPage/RootPage.tsx b/src/pages/RootPage/RootPage.tsx index 7f16f267..2a8a9679 100644 --- a/src/pages/RootPage/RootPage.tsx +++ b/src/pages/RootPage/RootPage.tsx @@ -1,9 +1,12 @@ import { Outlet } from 'react-router' + import Header from '@/components/header/header' +import { messengerArray } from '@/shared/model/types/messengerArray' import Footer from '@/widgets/Footer/Footer' -import styles from './root.module.scss' + import Contact from '../../features/Contacts/Contacts' -import { messengerArray } from '@/shared/model/types/messengerArray' + +import styles from './root.module.scss' const RootPage = () => { return ( diff --git a/src/pages/SearchResultsPage/SearchResultsPage.tsx b/src/pages/SearchResultsPage/SearchResultsPage.tsx index c848a4e9..a1ec43cb 100644 --- a/src/pages/SearchResultsPage/SearchResultsPage.tsx +++ b/src/pages/SearchResultsPage/SearchResultsPage.tsx @@ -1,15 +1,17 @@ +import { AnyAction, ThunkDispatch } from '@reduxjs/toolkit' import { useEffect } from 'react' import { useSelector, useDispatch } from 'react-redux' import { useParams } from 'react-router-dom' + +import { ThunkExtraArg } from '@/app/providers/StoreProvider/config/StateSchema' +import { RootState } from '@/app/providers/StoreProvider/config/store' import WrapperForMainContent from '@/components/WrapperForMainContent/WrapperForMainContent' +import { selectSearchResult } from '@/features/SearchProduct/selectors/searchProductSelectors' +import { search } from '@/features/SearchProduct/slice/searchProductSlice' import Heading from '@/shared/ui/Heading/Heading' import Subheading from '@/shared/ui/Subheading/Subheading' + import styles from './SearchResultsPage.module.scss' -import { search } from '@/features/SearchProduct/slice/searchProductSlice' -import { selectSearchResult } from '@/features/SearchProduct/selectors/searchProductSelectors' -import { AnyAction, ThunkDispatch } from '@reduxjs/toolkit' -import { RootState } from '@/app/providers/StoreProvider/config/store' -import { ThunkExtraArg } from '@/app/providers/StoreProvider/config/StateSchema' /** * Страница с результатами поискового запроса diff --git a/src/shared/api/apiErrorIdentify.ts b/src/shared/api/apiErrorIdentify.ts index b5e15eff..dfd3c5a9 100644 --- a/src/shared/api/apiErrorIdentify.ts +++ b/src/shared/api/apiErrorIdentify.ts @@ -1,4 +1,5 @@ import axios from 'axios' + import { ApiErrorTypes, SERVER_ERROR_FIELD } from './types' export const apiErrorIdentify = (e: unknown, message?: ApiErrorTypes) => diff --git a/src/shared/libs/hooks/store.ts b/src/shared/libs/hooks/store.ts index a1d79179..59546958 100644 --- a/src/shared/libs/hooks/store.ts +++ b/src/shared/libs/hooks/store.ts @@ -1,4 +1,5 @@ import { useDispatch } from 'react-redux' + import type { AppDispatch } from '@/app/providers/StoreProvider/config/store' // export type AppStoreState = ReturnType diff --git a/src/shared/model/types/messengerArray.tsx b/src/shared/model/types/messengerArray.tsx index afeaabbd..77cc23ec 100644 --- a/src/shared/model/types/messengerArray.tsx +++ b/src/shared/model/types/messengerArray.tsx @@ -1,7 +1,7 @@ -import WhatsAppIcon from '@/assets/icons/whatsapp.svg' -import ViberIcon from '@/assets/icons/viber.svg' -import TelegramIcon from '@/assets/icons/telegram.svg' import EmailIcon from '@/assets/icons/email.svg' +import TelegramIcon from '@/assets/icons/telegram.svg' +import ViberIcon from '@/assets/icons/viber.svg' +import WhatsAppIcon from '@/assets/icons/whatsapp.svg' import { WHATSAPP_LINK, VIBER_LINK, TELEGRAM_LINK, EMAIL_LINK } from '../../constants/constants' diff --git a/src/shared/ui/Button/Button.stories.tsx b/src/shared/ui/Button/Button.stories.tsx index 2d4a2111..17718e3f 100644 --- a/src/shared/ui/Button/Button.stories.tsx +++ b/src/shared/ui/Button/Button.stories.tsx @@ -1,5 +1,7 @@ import type { Meta, StoryObj } from '@storybook/react' + import ChatIcon from '@/assets/icons/chat.svg' + import { Button, ButtonDesign, ButtonSize, ButtonTheme } from './Button' const meta = { diff --git a/src/shared/ui/Button/Button.tsx b/src/shared/ui/Button/Button.tsx index f8124639..3746fc5c 100644 --- a/src/shared/ui/Button/Button.tsx +++ b/src/shared/ui/Button/Button.tsx @@ -1,5 +1,6 @@ -import { ButtonHTMLAttributes, FC } from 'react' import classNames from 'classnames' +import { ButtonHTMLAttributes, FC } from 'react' + import style from './Button.module.scss' export enum ButtonTheme { @@ -37,12 +38,24 @@ interface ButtonProps extends ButtonHTMLAttributes { */ export const Button: FC = props => { - const { className, children, disabled, theme, design = ButtonDesign.SQUARE, size = ButtonSize.M, ...rest } = props + const { + className, + children, + disabled, + theme, + design = ButtonDesign.SQUARE, + size = ButtonSize.M, + ...rest + } = props const additionalClasses = [className, theme && style[theme], style[size], style[design]] return ( - ) diff --git a/src/shared/ui/ButtonDots/ButtonDots.stories.tsx b/src/shared/ui/ButtonDots/ButtonDots.stories.tsx index 6882b98b..9f437d7b 100644 --- a/src/shared/ui/ButtonDots/ButtonDots.stories.tsx +++ b/src/shared/ui/ButtonDots/ButtonDots.stories.tsx @@ -1,4 +1,5 @@ import type { Meta, StoryObj } from '@storybook/react' + import ButtonDots from './ButtonDots' const meta = { diff --git a/src/shared/ui/ButtonDots/ButtonDots.tsx b/src/shared/ui/ButtonDots/ButtonDots.tsx index 4b28594f..b211fb2f 100644 --- a/src/shared/ui/ButtonDots/ButtonDots.tsx +++ b/src/shared/ui/ButtonDots/ButtonDots.tsx @@ -1,4 +1,5 @@ import React, { useEffect, useRef, useState } from 'react' + import styles from './ButtonDots.module.scss' type TProps = { diff --git a/src/shared/ui/Carousel/Carousel.stories.tsx b/src/shared/ui/Carousel/Carousel.stories.tsx index 613e67a0..8bbb8945 100644 --- a/src/shared/ui/Carousel/Carousel.stories.tsx +++ b/src/shared/ui/Carousel/Carousel.stories.tsx @@ -1,7 +1,9 @@ import { Story, Meta } from '@storybook/react' -import Carousel, { CarouselProps } from './Carousel' -import { ECardView } from '@/shared/model/types/common' + import { PRODUCT_PHOTOS } from '@/mockData/productsPageOptions' +import { ECardView } from '@/shared/model/types/common' + +import Carousel, { CarouselProps } from './Carousel' export default { title: 'shared/Carousel', diff --git a/src/shared/ui/Carousel/Carousel.tsx b/src/shared/ui/Carousel/Carousel.tsx index ea128e97..8d3de3cc 100644 --- a/src/shared/ui/Carousel/Carousel.tsx +++ b/src/shared/ui/Carousel/Carousel.tsx @@ -1,7 +1,9 @@ -import React, { useState, useRef, useEffect } from 'react' import classNames from 'classnames' +import React, { useState, useRef, useEffect } from 'react' + import { getStylesForCurrentLayout } from '@/components/ProductCard/utils/utils' import { ECardView } from '@/shared/model/types/common' + import styles from './Carousel.module.scss' export interface CarouselProps { diff --git a/src/shared/ui/CategoryCard/ui/CategoryCard.tsx b/src/shared/ui/CategoryCard/ui/CategoryCard.tsx index 209a56ab..a80a877b 100644 --- a/src/shared/ui/CategoryCard/ui/CategoryCard.tsx +++ b/src/shared/ui/CategoryCard/ui/CategoryCard.tsx @@ -1,9 +1,12 @@ import { type FC } from 'react' -import { Routes } from '@/shared/config/routerConfig/routes' + import { TCategory } from '@/models/CategoryModel' +import { Routes } from '@/shared/config/routerConfig/routes' import Link from '@/shared/ui/Link/Link' + import Subheading from '../../Subheading/Subheading' import { COLORS } from '../constants/constants' + import styles from './CategoryCard.module.scss' interface CategoryCardProps { diff --git a/src/shared/ui/Heading/Heading.tsx b/src/shared/ui/Heading/Heading.tsx index e141c4c9..c140039a 100644 --- a/src/shared/ui/Heading/Heading.tsx +++ b/src/shared/ui/Heading/Heading.tsx @@ -1,6 +1,7 @@ +import classnames from 'classnames' import React, { FC } from 'react' + import styles from './heading.module.scss' -import classnames from 'classnames' export enum HeadingType { MAIN = 'main', diff --git a/src/shared/ui/Input/Input.tsx b/src/shared/ui/Input/Input.tsx index 9fb7060e..d95b61cc 100644 --- a/src/shared/ui/Input/Input.tsx +++ b/src/shared/ui/Input/Input.tsx @@ -1,6 +1,7 @@ +import classNames from 'classnames' import React, { InputHTMLAttributes } from 'react' import InputMask from 'react-input-mask' -import classNames from 'classnames' + import styles from './Input.module.scss' export enum InputTheme { diff --git a/src/shared/ui/Label/Label.stories.tsx b/src/shared/ui/Label/Label.stories.tsx index 6386e4e3..d520092c 100644 --- a/src/shared/ui/Label/Label.stories.tsx +++ b/src/shared/ui/Label/Label.stories.tsx @@ -1,4 +1,5 @@ import type { Meta, StoryObj } from '@storybook/react' + import Label from './Label' const meta = { diff --git a/src/shared/ui/Label/Label.tsx b/src/shared/ui/Label/Label.tsx index a473641d..971f765f 100644 --- a/src/shared/ui/Label/Label.tsx +++ b/src/shared/ui/Label/Label.tsx @@ -1,4 +1,5 @@ import React, { FC } from 'react' + import styles from './Label.module.scss' type TLabelProps = React.HTMLAttributes & { diff --git a/src/shared/ui/Link/Link.stories.tsx b/src/shared/ui/Link/Link.stories.tsx index a89f57c4..7a36a724 100644 --- a/src/shared/ui/Link/Link.stories.tsx +++ b/src/shared/ui/Link/Link.stories.tsx @@ -1,5 +1,7 @@ import { Meta, Story } from '@storybook/react' + import Svg from '@/assets/icons/IconEye.svg' + import Link from './Link' const meta: Meta = { diff --git a/src/shared/ui/Link/Link.tsx b/src/shared/ui/Link/Link.tsx index 3ae8cf75..01a2099b 100644 --- a/src/shared/ui/Link/Link.tsx +++ b/src/shared/ui/Link/Link.tsx @@ -1,6 +1,7 @@ +import classNames from 'classnames' import { FC } from 'react' import { Link as ReactLink, LinkProps } from 'react-router-dom' -import classNames from 'classnames' + import styles from './Link.module.scss' export type TLinkProps = { diff --git a/src/shared/ui/Modal/Modal.tsx b/src/shared/ui/Modal/Modal.tsx index 25d57739..4db92f9f 100644 --- a/src/shared/ui/Modal/Modal.tsx +++ b/src/shared/ui/Modal/Modal.tsx @@ -1,7 +1,8 @@ -import React, { HTMLAttributes, useCallback, useEffect, useRef } from 'react' import classNames from 'classnames' import { createFocusTrap } from 'focus-trap' +import React, { HTMLAttributes, useCallback, useEffect, useRef } from 'react' import { createPortal } from 'react-dom' + import styles from './Modal.module.scss' interface IModalProps extends HTMLAttributes { diff --git a/src/shared/ui/Paragraph/Paragraph.stories.tsx b/src/shared/ui/Paragraph/Paragraph.stories.tsx index a9472858..b31ef7bc 100644 --- a/src/shared/ui/Paragraph/Paragraph.stories.tsx +++ b/src/shared/ui/Paragraph/Paragraph.stories.tsx @@ -1,4 +1,5 @@ import type { Meta, StoryObj } from '@storybook/react' + import Paragraph, { ParagraphTheme } from './Paragraph' const meta = { diff --git a/src/shared/ui/Paragraph/Paragraph.tsx b/src/shared/ui/Paragraph/Paragraph.tsx index 88361fdd..f36a38b9 100644 --- a/src/shared/ui/Paragraph/Paragraph.tsx +++ b/src/shared/ui/Paragraph/Paragraph.tsx @@ -1,6 +1,7 @@ +import classNames from 'classnames' import React, { FC } from 'react' + import styles from './paragraph.module.scss' -import classNames from 'classnames' export enum ParagraphTheme { ERROR = 'error' diff --git a/src/shared/ui/Scroll/Scroll.stories.tsx b/src/shared/ui/Scroll/Scroll.stories.tsx index 0c28653e..79df9d49 100644 --- a/src/shared/ui/Scroll/Scroll.stories.tsx +++ b/src/shared/ui/Scroll/Scroll.stories.tsx @@ -1,5 +1,6 @@ import type { Meta, StoryObj } from '@storybook/react' import { FC } from 'react' + import Scroll from './Scroll' import styles from './Scroll.module.scss' diff --git a/src/shared/ui/Scroll/Scroll.tsx b/src/shared/ui/Scroll/Scroll.tsx index eb0114a6..678289ce 100644 --- a/src/shared/ui/Scroll/Scroll.tsx +++ b/src/shared/ui/Scroll/Scroll.tsx @@ -1,4 +1,5 @@ import React, { FC } from 'react' + import styles from './Scroll.module.scss' export type TProps = { diff --git a/src/shared/ui/Span/Span.stories.tsx b/src/shared/ui/Span/Span.stories.tsx index 25a74a06..b80dbb39 100644 --- a/src/shared/ui/Span/Span.stories.tsx +++ b/src/shared/ui/Span/Span.stories.tsx @@ -1,4 +1,5 @@ import type { Meta, StoryObj } from '@storybook/react' + import Span from './Span' const meta = { diff --git a/src/shared/ui/Span/Span.tsx b/src/shared/ui/Span/Span.tsx index ec9fc49c..bca4c28d 100644 --- a/src/shared/ui/Span/Span.tsx +++ b/src/shared/ui/Span/Span.tsx @@ -1,4 +1,5 @@ import React, { FC } from 'react' + import styles from './Span.module.scss' type TSpanProps = React.HTMLAttributes & { diff --git a/src/shared/ui/Spinner/Spinner.stories.tsx b/src/shared/ui/Spinner/Spinner.stories.tsx index 805e6f06..4ed6de5f 100644 --- a/src/shared/ui/Spinner/Spinner.stories.tsx +++ b/src/shared/ui/Spinner/Spinner.stories.tsx @@ -1,4 +1,5 @@ import { Story, Meta } from '@storybook/react' + import Spinner from './Spinner' export default { diff --git a/src/shared/ui/Subheading/Subheading.tsx b/src/shared/ui/Subheading/Subheading.tsx index f55bdc7a..e7b3ea52 100644 --- a/src/shared/ui/Subheading/Subheading.tsx +++ b/src/shared/ui/Subheading/Subheading.tsx @@ -1,4 +1,5 @@ import React, { FC } from 'react' + import styles from './subheading.module.scss' type TSubheadingProps = React.HTMLAttributes & { diff --git a/src/shared/ui/Textarea/Textarea.stories.tsx b/src/shared/ui/Textarea/Textarea.stories.tsx index 59f5cfe0..d1acd243 100644 --- a/src/shared/ui/Textarea/Textarea.stories.tsx +++ b/src/shared/ui/Textarea/Textarea.stories.tsx @@ -1,4 +1,5 @@ import { Meta, Story } from '@storybook/react' + import { Textarea, TextareaTheme, TextareaSize } from './Textarea' const meta: Meta = { diff --git a/src/shared/ui/Textarea/Textarea.tsx b/src/shared/ui/Textarea/Textarea.tsx index 26bd6240..e25ebdf9 100644 --- a/src/shared/ui/Textarea/Textarea.tsx +++ b/src/shared/ui/Textarea/Textarea.tsx @@ -1,5 +1,6 @@ -import React, { TextareaHTMLAttributes } from 'react' import classNames from 'classnames' +import React, { TextareaHTMLAttributes } from 'react' + import styles from './Textarea.module.scss' export enum TextareaTheme { diff --git a/src/shared/ui/logo/Logo.tsx b/src/shared/ui/logo/Logo.tsx index f7e9eea7..26f1f99a 100644 --- a/src/shared/ui/logo/Logo.tsx +++ b/src/shared/ui/logo/Logo.tsx @@ -1,7 +1,9 @@ import { type FC } from 'react' -import styles from './logo.module.scss' + import Link from '@/shared/ui/Link/Link' +import styles from './logo.module.scss' + type TLogoProps = { image: string title: string diff --git a/src/ui/img/index.tsx b/src/ui/img/index.tsx index 8654c2cc..335c7bc1 100644 --- a/src/ui/img/index.tsx +++ b/src/ui/img/index.tsx @@ -1,4 +1,5 @@ import { FC, ImgHTMLAttributes, SourceHTMLAttributes } from 'react' + import styles from './img.module.scss' type Props = SourceHTMLAttributes & ImgHTMLAttributes diff --git a/src/widgets/Advantages/ui/Advantages/Advantages.tsx b/src/widgets/Advantages/ui/Advantages/Advantages.tsx index 72ac8087..c0a1af84 100644 --- a/src/widgets/Advantages/ui/Advantages/Advantages.tsx +++ b/src/widgets/Advantages/ui/Advantages/Advantages.tsx @@ -1,8 +1,8 @@ import AdvantageCard from '@/entities/AdvantageCard/ui/AdvantageCard/AdvantageCard' -import styles from './advantages.module.scss' - import { advantagesData } from '@/mockData/advantagesData' +import styles from './advantages.module.scss' + function Advantages() { return (
diff --git a/src/widgets/BlogBlock/model/services/getBlogPosts.ts b/src/widgets/BlogBlock/model/services/getBlogPosts.ts index cb844975..b1fb7e5a 100644 --- a/src/widgets/BlogBlock/model/services/getBlogPosts.ts +++ b/src/widgets/BlogBlock/model/services/getBlogPosts.ts @@ -1,10 +1,12 @@ import { createAsyncThunk } from '@reduxjs/toolkit' + import { ThunkConfig } from '@/app/providers/StoreProvider/config/StateSchema' -import { ApiError, ApiErrorTypes, ApiRoutes } from '@/shared/api/types' import { apiErrorIdentify } from '@/shared/api/apiErrorIdentify' -import { IBlogPostData } from '../types/types' +import { ApiError, ApiErrorTypes, ApiRoutes } from '@/shared/api/types' import { ACTION_GET_BLOG_POSTS } from '@/shared/constants/constants' +import { IBlogPostData } from '../types/types' + // export const getStoreReviews = createAsyncThunk>( export const getBlogPosts = createAsyncThunk>( //void1- выходные данные, void2- входные данные , thunkConfig- тип store diff --git a/src/widgets/BlogBlock/model/slice/blogPostsSlice.ts b/src/widgets/BlogBlock/model/slice/blogPostsSlice.ts index 954ead65..7efd61af 100644 --- a/src/widgets/BlogBlock/model/slice/blogPostsSlice.ts +++ b/src/widgets/BlogBlock/model/slice/blogPostsSlice.ts @@ -1,8 +1,10 @@ import { createSlice } from '@reduxjs/toolkit' -import { IBlogPostsSchema } from '../types/types' -import { getBlogPosts } from '../services/getBlogPosts' -import { REDUCER_BLOG_POSTS } from '@/shared/constants/constants' + import { rejectedPayloadHandle } from '@/shared/api/rejectedPayloadHandle' +import { REDUCER_BLOG_POSTS } from '@/shared/constants/constants' + +import { getBlogPosts } from '../services/getBlogPosts' +import { IBlogPostsSchema } from '../types/types' const initialState: IBlogPostsSchema = { isLoading: false, diff --git a/src/widgets/BlogBlock/ui/BlogBlock.stories.tsx b/src/widgets/BlogBlock/ui/BlogBlock.stories.tsx index dae2de1e..aae3c9ed 100644 --- a/src/widgets/BlogBlock/ui/BlogBlock.stories.tsx +++ b/src/widgets/BlogBlock/ui/BlogBlock.stories.tsx @@ -1,8 +1,8 @@ import type { Meta, StoryObj } from '@storybook/react' import { FC } from 'react' -import styles from './BlogBlock.module.scss' import BlogBlock from './BlogBlock' +import styles from './BlogBlock.module.scss' const StorybookWrapper: FC = () => { return ( diff --git a/src/widgets/BlogBlock/ui/BlogBlock.tsx b/src/widgets/BlogBlock/ui/BlogBlock.tsx index 238f1e42..a161f757 100644 --- a/src/widgets/BlogBlock/ui/BlogBlock.tsx +++ b/src/widgets/BlogBlock/ui/BlogBlock.tsx @@ -1,14 +1,17 @@ import { FC, useEffect } from 'react' -import { getBlogPosts } from '../model/services/getBlogPosts' -import { useAppDispatch } from '@/shared/libs/hooks/store' -import { getBlogPostsSelector } from '../model/selectors/selectors' import { useSelector } from 'react-redux' + import IconLink from '@/assets/icons/IconLink' +import BlogCard from '@/entities/BlogCard/BlogCard' +import { useAppDispatch } from '@/shared/libs/hooks/store' import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' import Link from '@/shared/ui/Link/Link' -import styles from './BlogBlock.module.scss' import Scroll from '@/shared/ui/Scroll/Scroll' -import BlogCard from '@/entities/BlogCard/BlogCard' + +import { getBlogPostsSelector } from '../model/selectors/selectors' +import { getBlogPosts } from '../model/services/getBlogPosts' + +import styles from './BlogBlock.module.scss' /** * Блок группы карточек блога diff --git a/src/widgets/BrandBlock/slice/brandSlice.ts b/src/widgets/BrandBlock/slice/brandSlice.ts index df80ce9c..df09b519 100644 --- a/src/widgets/BrandBlock/slice/brandSlice.ts +++ b/src/widgets/BrandBlock/slice/brandSlice.ts @@ -1,9 +1,11 @@ import { createSlice, createAsyncThunk } from '@reduxjs/toolkit' -import { ApiError, ApiErrorTypes, ApiRoutes } from '@/shared/api/types' + import { ThunkConfig } from '@/app/providers/StoreProvider/config/StateSchema' -import { Brand, BrandSchema } from '../types/types' import { apiErrorIdentify } from '@/shared/api/apiErrorIdentify' import { rejectedPayloadHandle } from '@/shared/api/rejectedPayloadHandle' +import { ApiError, ApiErrorTypes, ApiRoutes } from '@/shared/api/types' + +import { Brand, BrandSchema } from '../types/types' const initialState: BrandSchema = { brands: [], diff --git a/src/widgets/BrandBlock/ui/BrandBlock/BrandBlock.stories.tsx b/src/widgets/BrandBlock/ui/BrandBlock/BrandBlock.stories.tsx index 8b53ce3a..b998a493 100644 --- a/src/widgets/BrandBlock/ui/BrandBlock/BrandBlock.stories.tsx +++ b/src/widgets/BrandBlock/ui/BrandBlock/BrandBlock.stories.tsx @@ -1,7 +1,9 @@ import type { Meta, StoryObj } from '@storybook/react' -import BrandBlock from './BrandBlock' + import { brandsData } from '@/mockData/brandData' +import BrandBlock from './BrandBlock' + const meta = { title: 'widgets/BrandBlock', component: BrandBlock, diff --git a/src/widgets/BrandBlock/ui/BrandBlock/BrandBlock.tsx b/src/widgets/BrandBlock/ui/BrandBlock/BrandBlock.tsx index 7e5aa95f..0ba876df 100644 --- a/src/widgets/BrandBlock/ui/BrandBlock/BrandBlock.tsx +++ b/src/widgets/BrandBlock/ui/BrandBlock/BrandBlock.tsx @@ -1,16 +1,19 @@ import { useEffect } from 'react' import { useDispatch, useSelector } from 'react-redux' -import { Routes } from '@/shared/config/routerConfig/routes' -import { brandSelector } from '../../selectors/selectors' -import { fetchBrands } from '../../slice/brandSlice' + import { AppDispatch } from '@/app/providers/StoreProvider/config/store' import IconLink from '@/assets/icons/IconLink' -import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' -import Link from '@/shared/ui/Link/Link' import BrandCard from '@/entities/BrandCard/BrandCard' +import { Routes } from '@/shared/config/routerConfig/routes' import { TEXT_OUR_BRANDS, TEXT_ALL_BRANDS } from '@/shared/constants/constants' -import styles from './BrandBlock.module.scss' import { BRANDS_FOR_MAIN_NUMBER } from '@/shared/constants/constants' +import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' +import Link from '@/shared/ui/Link/Link' + +import { brandSelector } from '../../selectors/selectors' +import { fetchBrands } from '../../slice/brandSlice' + +import styles from './BrandBlock.module.scss' /** * Компонент списка брендов для главной страницы. diff --git a/src/widgets/CatalogNodeItem/CatalogNodeItem.stories.tsx b/src/widgets/CatalogNodeItem/CatalogNodeItem.stories.tsx index 9d38b924..9988f671 100644 --- a/src/widgets/CatalogNodeItem/CatalogNodeItem.stories.tsx +++ b/src/widgets/CatalogNodeItem/CatalogNodeItem.stories.tsx @@ -1,5 +1,6 @@ // CatalogNodeItem.stories.tsx import { Meta, StoryObj } from '@storybook/react' + import CatalogNodeItem from './CatalogNodeItem' const meta = { diff --git a/src/widgets/CatalogNodeItem/CatalogNodeItem.tsx b/src/widgets/CatalogNodeItem/CatalogNodeItem.tsx index e87f7b5c..1346d02c 100644 --- a/src/widgets/CatalogNodeItem/CatalogNodeItem.tsx +++ b/src/widgets/CatalogNodeItem/CatalogNodeItem.tsx @@ -1,6 +1,7 @@ import { Category } from '@/entities/Category/types/types' import { Routes } from '@/shared/config/routerConfig/routes' import Link from '@/shared/ui/Link/Link' + import styles from './CatalogNodeItem.module.scss' /** diff --git a/src/widgets/CategoryGrid/CategoryGrid.tsx b/src/widgets/CategoryGrid/CategoryGrid.tsx index c7483486..4ffbedab 100644 --- a/src/widgets/CategoryGrid/CategoryGrid.tsx +++ b/src/widgets/CategoryGrid/CategoryGrid.tsx @@ -1,7 +1,8 @@ -import Heading from '@/shared/ui/Heading/Heading' -import CategoryCard from '@/shared/ui/CategoryCard/ui/CategoryCard' import { catalogListData } from '@/mockData/catalogListData' import { TEXT_POPULAR_CATEGORIES } from '@/shared/constants/constants' +import CategoryCard from '@/shared/ui/CategoryCard/ui/CategoryCard' +import Heading from '@/shared/ui/Heading/Heading' + import styles from './CategoryGrid.module.scss' /** diff --git a/src/widgets/MakeOrder/ui/MakeOrder/MakeOrder.stories.tsx b/src/widgets/MakeOrder/ui/MakeOrder/MakeOrder.stories.tsx index ec08f0d1..6a31d670 100644 --- a/src/widgets/MakeOrder/ui/MakeOrder/MakeOrder.stories.tsx +++ b/src/widgets/MakeOrder/ui/MakeOrder/MakeOrder.stories.tsx @@ -1,4 +1,5 @@ import type { Meta, StoryObj } from '@storybook/react' + import { MakeOrder } from './MakeOrder' const meta = { diff --git a/src/widgets/MakeOrder/ui/MakeOrder/MakeOrder.tsx b/src/widgets/MakeOrder/ui/MakeOrder/MakeOrder.tsx index 6d0b91a7..2a4b54d5 100644 --- a/src/widgets/MakeOrder/ui/MakeOrder/MakeOrder.tsx +++ b/src/widgets/MakeOrder/ui/MakeOrder/MakeOrder.tsx @@ -1,7 +1,9 @@ import { Link } from 'react-router-dom' -import styles from './MakeOrder.module.scss' + import { TOrder } from '@/shared/model/types/common' +import styles from './MakeOrder.module.scss' + /** * Компонент Сделать Заказ: тут представлены суммы за заказ , а также кнопки быстрого и обычного заказа * @param {number} amount -кол-во всех продуктов в заказе; diff --git a/src/widgets/NavigationLink/NavigationLink.stories.tsx b/src/widgets/NavigationLink/NavigationLink.stories.tsx index 64d2c0e8..977384c3 100644 --- a/src/widgets/NavigationLink/NavigationLink.stories.tsx +++ b/src/widgets/NavigationLink/NavigationLink.stories.tsx @@ -1,4 +1,5 @@ import { Meta, Story } from '@storybook/react' + import NavigationLink, { NavigationLinkProps } from './NavigationLink' export default { diff --git a/src/widgets/NavigationLink/NavigationLink.tsx b/src/widgets/NavigationLink/NavigationLink.tsx index e523444e..92412a20 100644 --- a/src/widgets/NavigationLink/NavigationLink.tsx +++ b/src/widgets/NavigationLink/NavigationLink.tsx @@ -1,4 +1,5 @@ import Link from '@/shared/ui/Link/Link' + import styles from './NavigationLink.module.scss' export type NavigationLinkProps = { diff --git a/src/widgets/NewsBlock/model/services/getShopNews.ts b/src/widgets/NewsBlock/model/services/getShopNews.ts index 25843a43..6dd0215b 100644 --- a/src/widgets/NewsBlock/model/services/getShopNews.ts +++ b/src/widgets/NewsBlock/model/services/getShopNews.ts @@ -1,10 +1,12 @@ import { createAsyncThunk } from '@reduxjs/toolkit' + import { ThunkConfig } from '@/app/providers/StoreProvider/config/StateSchema' -import { ApiError, ApiErrorTypes, ApiRoutes } from '@/shared/api/types' import { apiErrorIdentify } from '@/shared/api/apiErrorIdentify' -import { ShopNewsData } from '../types/types' +import { ApiError, ApiErrorTypes, ApiRoutes } from '@/shared/api/types' import { ACTION_GET_SHOP_NEWS } from '@/shared/constants/constants' +import { ShopNewsData } from '../types/types' + // export const getStoreReviews = createAsyncThunk>( export const getShopNews = createAsyncThunk>( //void1- выходные данные, void2- входные данные , thunkConfig- тип store diff --git a/src/widgets/NewsBlock/model/slice/shopNewsSlice.ts b/src/widgets/NewsBlock/model/slice/shopNewsSlice.ts index d5969d09..5cc7b031 100644 --- a/src/widgets/NewsBlock/model/slice/shopNewsSlice.ts +++ b/src/widgets/NewsBlock/model/slice/shopNewsSlice.ts @@ -1,7 +1,9 @@ import { createSlice } from '@reduxjs/toolkit' + +import { REDUCER_SHOP_NEWS } from '@/shared/constants/constants' + import { getShopNews } from '../services/getShopNews' import { ShopNewsSchema } from '../types/types' -import { REDUCER_SHOP_NEWS } from '@/shared/constants/constants' const initialState: ShopNewsSchema = { isLoading: false, diff --git a/src/widgets/NewsBlock/ui/NewsBlock.stories.tsx b/src/widgets/NewsBlock/ui/NewsBlock.stories.tsx index 3b80068a..22e4b5b4 100644 --- a/src/widgets/NewsBlock/ui/NewsBlock.stories.tsx +++ b/src/widgets/NewsBlock/ui/NewsBlock.stories.tsx @@ -1,7 +1,8 @@ import type { Meta, StoryObj } from '@storybook/react' -import styles from './NewsBlock.module.scss' import { FC } from 'react' + import NewsBlock from './NewsBlock' +import styles from './NewsBlock.module.scss' const StorybookWrapper: FC = () => { return ( diff --git a/src/widgets/NewsBlock/ui/NewsBlock.tsx b/src/widgets/NewsBlock/ui/NewsBlock.tsx index 63340cad..20b0b574 100644 --- a/src/widgets/NewsBlock/ui/NewsBlock.tsx +++ b/src/widgets/NewsBlock/ui/NewsBlock.tsx @@ -1,15 +1,18 @@ import { FC, useEffect } from 'react' -import { getShopNewsSelector } from '../model/selectors/selectors' import { useSelector } from 'react-redux' -import { useAppDispatch } from '@/shared/libs/hooks/store' -import { getShopNews } from '../model/services/getShopNews' + import IconLink from '@/assets/icons/IconLink' +import NewsCard from '@/entities/NewsCard/NewsCard' +import { useAppDispatch } from '@/shared/libs/hooks/store' import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' import Link from '@/shared/ui/Link/Link' -import styles from './NewsBlock.module.scss' -import NewsCard from '@/entities/NewsCard/NewsCard' import Scroll from '@/shared/ui/Scroll/Scroll' +import { getShopNewsSelector } from '../model/selectors/selectors' +import { getShopNews } from '../model/services/getShopNews' + +import styles from './NewsBlock.module.scss' + /** * Блок группы новостей */ diff --git a/src/widgets/ReviewsBlock/model/services/getStoreReviews.ts b/src/widgets/ReviewsBlock/model/services/getStoreReviews.ts index 798312fc..852a16f5 100644 --- a/src/widgets/ReviewsBlock/model/services/getStoreReviews.ts +++ b/src/widgets/ReviewsBlock/model/services/getStoreReviews.ts @@ -1,7 +1,9 @@ import { createAsyncThunk } from '@reduxjs/toolkit' + import { ThunkConfig } from '@/app/providers/StoreProvider/config/StateSchema' -import { ApiError, ApiErrorTypes, ApiRoutes } from '@/shared/api/types' import { apiErrorIdentify } from '@/shared/api/apiErrorIdentify' +import { ApiError, ApiErrorTypes, ApiRoutes } from '@/shared/api/types' + import { StoreReviewData } from '../types/types' export const getStoreReviews = createAsyncThunk>( diff --git a/src/widgets/ReviewsBlock/model/slice/reviewsSlice.ts b/src/widgets/ReviewsBlock/model/slice/reviewsSlice.ts index 1792dc3b..81ea14d5 100644 --- a/src/widgets/ReviewsBlock/model/slice/reviewsSlice.ts +++ b/src/widgets/ReviewsBlock/model/slice/reviewsSlice.ts @@ -1,6 +1,7 @@ import { createSlice } from '@reduxjs/toolkit' -import { StoreReviewsSchema } from '../types/types' + import { getStoreReviews } from '../services/getStoreReviews' +import { StoreReviewsSchema } from '../types/types' const initialState: StoreReviewsSchema = { isLoading: false, diff --git a/src/widgets/ReviewsBlock/ui/ReviewsBlock/ReviewsBlock.stories.tsx b/src/widgets/ReviewsBlock/ui/ReviewsBlock/ReviewsBlock.stories.tsx index da46ff64..edcb1ffe 100644 --- a/src/widgets/ReviewsBlock/ui/ReviewsBlock/ReviewsBlock.stories.tsx +++ b/src/widgets/ReviewsBlock/ui/ReviewsBlock/ReviewsBlock.stories.tsx @@ -1,7 +1,9 @@ import type { Meta, StoryObj } from '@storybook/react' -import ReviewsBlock from './ReviewsBlock' + import { LINK_REVIEWS_ALL, TEXT_CUSTOMERS_ABOUT_US } from '@/shared/constants/constants' +import ReviewsBlock from './ReviewsBlock' + const meta = { title: 'widgets/ReviewsBlock', component: ReviewsBlock, diff --git a/src/widgets/ReviewsBlock/ui/ReviewsBlock/ReviewsBlock.tsx b/src/widgets/ReviewsBlock/ui/ReviewsBlock/ReviewsBlock.tsx index 629ed3e5..c11d7296 100644 --- a/src/widgets/ReviewsBlock/ui/ReviewsBlock/ReviewsBlock.tsx +++ b/src/widgets/ReviewsBlock/ui/ReviewsBlock/ReviewsBlock.tsx @@ -1,15 +1,18 @@ -import { getStoreReviewsSelector } from '../../model/selectors/selectors' -import { useSelector } from 'react-redux' -import { useAppDispatch } from '@/shared/libs/hooks/store' import { useEffect, type FC } from 'react' -import IconHand from '@/assets/images/img-hand.png.png' +import { useSelector } from 'react-redux' + import IconLink from '@/assets/icons/IconLink' +import IconHand from '@/assets/images/img-hand.png.png' +import CardReview from '@/entities/CardReview/ui/CardReview/CardReview' +import { useAppDispatch } from '@/shared/libs/hooks/store' import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' import Link from '@/shared/ui/Link/Link' -import styles from './reviewsBlock.module.scss' -import CardReview from '@/entities/CardReview/ui/CardReview/CardReview' + +import { getStoreReviewsSelector } from '../../model/selectors/selectors' import { getStoreReviews } from '../../model/services/getStoreReviews' +import styles from './reviewsBlock.module.scss' + export type Props = { title: string linkText?: string diff --git a/src/widgets/SearchResult/SearchResult.stories.tsx b/src/widgets/SearchResult/SearchResult.stories.tsx index 716aaec1..781edd54 100644 --- a/src/widgets/SearchResult/SearchResult.stories.tsx +++ b/src/widgets/SearchResult/SearchResult.stories.tsx @@ -1,7 +1,9 @@ import { Meta, Story } from '@storybook/react' -import SearchResult from './SearchResult' + import { searchResponseData } from '@/mockData/searchData' +import SearchResult from './SearchResult' + export default { title: 'Widgets/SearchResult', component: SearchResult diff --git a/src/widgets/SearchResult/SearchResult.tsx b/src/widgets/SearchResult/SearchResult.tsx index d5163210..f3ec08c3 100644 --- a/src/widgets/SearchResult/SearchResult.tsx +++ b/src/widgets/SearchResult/SearchResult.tsx @@ -1,11 +1,13 @@ import { forwardRef } from 'react' + +import SearchIcon from '@/assets/images/search/search-icon.svg' import SearchItem from '@/entities/SearchItem/SearchItem' +import { TCategory } from '@/models/CategoryModel' +import { Routes } from '@/shared/config/routerConfig/routes' import { SEARCH_CATEGORY, SEARCH_PRODUCT } from '@/shared/constants/constants' import type { TProduct } from '@/shared/model/types/common' -import { TCategory } from '@/models/CategoryModel' -import SearchIcon from '@/assets/images/search/search-icon.svg' import Link from '@/shared/ui/Link/Link' -import { Routes } from '@/shared/config/routerConfig/routes' + import styles from './SearchResult.module.scss' type TProps = { diff --git a/src/widgets/StoriesBlock/ui/StoriesBlock.stories.tsx b/src/widgets/StoriesBlock/ui/StoriesBlock.stories.tsx index 9edae4a0..3f771518 100644 --- a/src/widgets/StoriesBlock/ui/StoriesBlock.stories.tsx +++ b/src/widgets/StoriesBlock/ui/StoriesBlock.stories.tsx @@ -1,7 +1,8 @@ -import { FC } from 'react' import type { Meta, StoryObj } from '@storybook/react' -import styles from './StoriesBlock.module.scss' +import { FC } from 'react' + import StoriesBlock from './StoriesBlock' +import styles from './StoriesBlock.module.scss' const StorybookWrapper: FC = () => { return ( diff --git a/src/widgets/StoriesBlock/ui/StoriesBlock.tsx b/src/widgets/StoriesBlock/ui/StoriesBlock.tsx index b81fd60d..641cafed 100644 --- a/src/widgets/StoriesBlock/ui/StoriesBlock.tsx +++ b/src/widgets/StoriesBlock/ui/StoriesBlock.tsx @@ -1,9 +1,11 @@ import { FC } from 'react' + +import StoryCard from '@/entities/StoryCard/StoryCard' +import { storiesData } from '@/mockData/storiesData' import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' -import styles from './StoriesBlock.module.scss' import Scroll from '@/shared/ui/Scroll/Scroll' -import { storiesData } from '@/mockData/storiesData' -import StoryCard from '@/entities/StoryCard/StoryCard' + +import styles from './StoriesBlock.module.scss' /** * Блок группы историй From 3c18930a1fab63989a437384fb01556534075122 Mon Sep 17 00:00:00 2001 From: Artur Khelshtein Date: Wed, 7 Feb 2024 19:32:29 +0300 Subject: [PATCH 7/9] rebase --- .../StoreProvider/config/StateSchema.ts | 3 +- .../providers/StoreProvider/config/store.ts | 6 ++- src/pages/RootPage/RootPage.tsx | 5 +-- .../header.tsx => widgets/Header/Header.tsx} | 17 ++++--- .../Header}/header.module.scss | 0 .../Header/model/selectors/selectors.tsx | 3 ++ .../model/services/getCoreBaseHeader.tsx | 29 ++++++++++++ .../Header/model/slice/headerSlice.tsx | 45 +++++++++++++++++++ src/widgets/Header/model/types/types.tsx | 21 +++++++++ 9 files changed, 118 insertions(+), 11 deletions(-) rename src/{components/header/header.tsx => widgets/Header/Header.tsx} (92%) rename src/{components/header => widgets/Header}/header.module.scss (100%) create mode 100644 src/widgets/Header/model/selectors/selectors.tsx create mode 100644 src/widgets/Header/model/services/getCoreBaseHeader.tsx create mode 100644 src/widgets/Header/model/slice/headerSlice.tsx create mode 100644 src/widgets/Header/model/types/types.tsx diff --git a/src/app/providers/StoreProvider/config/StateSchema.ts b/src/app/providers/StoreProvider/config/StateSchema.ts index 208d7dd2..1a5862f9 100644 --- a/src/app/providers/StoreProvider/config/StateSchema.ts +++ b/src/app/providers/StoreProvider/config/StateSchema.ts @@ -7,13 +7,14 @@ import { ShopNewsSchema } from '@/widgets/NewsBlock/model/types/types' import { StoreReviewsSchema } from '@/widgets/ReviewsBlock/model/types/types' import { IBlogPostsSchema } from '@/widgets/BlogBlock/model/types/types' import { CoreBaseFooterSchema } from '@/widgets/Footer/model/types/types' - +import { CoreBaseHeaderSchema } from '@/widgets/Header/model/types/types' export interface StateSchema { login: LoginSchema storeReviews: StoreReviewsSchema category: CategorySchema coreBaseFooter: CoreBaseFooterSchema + coreBaseHeader: CoreBaseHeaderSchema brand: BrandSchema searchResult: SearchResultSchema shopNews: ShopNewsSchema diff --git a/src/app/providers/StoreProvider/config/store.ts b/src/app/providers/StoreProvider/config/store.ts index c39329e9..f73e04fd 100644 --- a/src/app/providers/StoreProvider/config/store.ts +++ b/src/app/providers/StoreProvider/config/store.ts @@ -1,6 +1,6 @@ import { configureStore, ReducersMapObject } from '@reduxjs/toolkit' + import { loginReducer } from '@/features/login/model/slice/loginSlice' -import { StateSchema, ThunkExtraArg } from './StateSchema' import { $api } from '@/shared/api/api' import categorySlice from '@/entities/Category/slice/categorySlice' import brandSlice from '@/widgets/BrandBlock/slice/brandSlice' @@ -9,12 +9,16 @@ import { storeReviewsReducer } from '@/widgets/ReviewsBlock/model/slice/reviewsS import footerSlice from '@/widgets/Footer/model/slice/footerSlice' import { shopNewsReducer } from '@/widgets/NewsBlock/model/slice/shopNewsSlice' import { blogPostsReducer } from '@/widgets/BlogBlock/model/slice/blogPostsSlice' +import headerSlice from '@/widgets/Header/model/slice/headerSlice' + +import { StateSchema, ThunkExtraArg } from './StateSchema' export type RootState = StateSchema const rootReducer: ReducersMapObject = { login: loginReducer, category: categorySlice, + coreBaseHeader: headerSlice, coreBaseFooter: footerSlice, brand: brandSlice, searchResult: searchProductSlice, diff --git a/src/pages/RootPage/RootPage.tsx b/src/pages/RootPage/RootPage.tsx index 2a8a9679..3da8245d 100644 --- a/src/pages/RootPage/RootPage.tsx +++ b/src/pages/RootPage/RootPage.tsx @@ -1,10 +1,9 @@ import { Outlet } from 'react-router' -import Header from '@/components/header/header' +import Contact from '@/features/Contacts/Contacts' import { messengerArray } from '@/shared/model/types/messengerArray' import Footer from '@/widgets/Footer/Footer' - -import Contact from '../../features/Contacts/Contacts' +import Header from '@/widgets/Header/Header' import styles from './root.module.scss' diff --git a/src/components/header/header.tsx b/src/widgets/Header/Header.tsx similarity index 92% rename from src/components/header/header.tsx rename to src/widgets/Header/Header.tsx index 603571cd..bd846676 100644 --- a/src/components/header/header.tsx +++ b/src/widgets/Header/Header.tsx @@ -6,28 +6,29 @@ import { AppDispatch } from '@/app/providers/StoreProvider/config/store' import ArrowIcon from '@/assets/icons/arrow.svg' import IconCategories from '@/assets/icons/IconCategories.svg' import LightningIcon from '@/assets/images/header/lightning.svg' +import CatalogLink from '@/components/CatalogLink/CatalogLink' +import ContextMenuElement from '@/components/ContextMenuElement/ContextMenuElement' +import HeaderAccount from '@/components/HeaderAccount/HeaderAccount' import { selectCategories, selectDisplayedCategories } from '@/entities/Category/selectors/categorySelectors' import { fetchCategories } from '@/entities/Category/slice/categorySlice' import SearchProduct from '@/features/SearchProduct' import { linkItems } from '@/mockData/catalogListData' -import { coreBaseData } from '@/mockData/coreBaseData' import { headerAccountData } from '@/mockData/headerAccountData' import { Routes } from '@/shared/config/routerConfig/routes' import { PHONE_NUMBER } from '@/shared/constants/constants' import Link from '@/shared/ui/Link/Link' +import Logo from '@/shared/ui/logo/Logo' import CatalogNodeItem from '@/widgets/CatalogNodeItem/CatalogNodeItem' import NavigationLink from '@/widgets/NavigationLink/NavigationLink' -import Logo from '../../shared/ui/logo/Logo' -import CatalogLink from '../CatalogLink/CatalogLink' -import ContextMenuElement from '../ContextMenuElement/ContextMenuElement' -import HeaderAccount from '../HeaderAccount/HeaderAccount' - import styles from './header.module.scss' +import { getCoreBaseHeaderSelector } from './model/selectors/selectors' +import { getCoreBaseHeader } from './model/services/getCoreBaseHeader' function Header() { const dispatch = useDispatch() const categories = useSelector(selectCategories) + const coreBaseData = useSelector(getCoreBaseHeaderSelector) const displayedCategories = useSelector(selectDisplayedCategories) const aboutUsNode = useMemo( @@ -111,6 +112,10 @@ function Header() { [categories] ) + useEffect(() => { + dispatch(getCoreBaseHeader()) + }, []) + useEffect(() => { dispatch(fetchCategories()) }, [dispatch]) diff --git a/src/components/header/header.module.scss b/src/widgets/Header/header.module.scss similarity index 100% rename from src/components/header/header.module.scss rename to src/widgets/Header/header.module.scss diff --git a/src/widgets/Header/model/selectors/selectors.tsx b/src/widgets/Header/model/selectors/selectors.tsx new file mode 100644 index 00000000..72f8aac3 --- /dev/null +++ b/src/widgets/Header/model/selectors/selectors.tsx @@ -0,0 +1,3 @@ +import { StateSchema } from '@/app/providers/StoreProvider' + +export const getCoreBaseHeaderSelector = (state: StateSchema) => state.coreBaseHeader diff --git a/src/widgets/Header/model/services/getCoreBaseHeader.tsx b/src/widgets/Header/model/services/getCoreBaseHeader.tsx new file mode 100644 index 00000000..3ebef049 --- /dev/null +++ b/src/widgets/Header/model/services/getCoreBaseHeader.tsx @@ -0,0 +1,29 @@ +import { createAsyncThunk } from '@reduxjs/toolkit' + +import { ThunkConfig } from '@/app/providers/StoreProvider/config/StateSchema' +import { apiErrorIdentify } from '@/shared/api/apiErrorIdentify' +import { ApiError, ApiErrorTypes, ApiRoutes } from '@/shared/api/types' + +import { CoreBaseHeaderData } from '../types/types' + +/** + * ассинхронный запрос Api через thunk Redux toolkit + * - формат ожидаемого ответа + * - формат запроса (описан в config StoreProvider) + * - формат ошибки API запроса (описан в типах API) + * первый аргумент - thunkConfig ID action type (отображается в dev tools) + * второй аргумент - асинхронная функция, которая вызовет dispatch в компоненте + */ + +export const getCoreBaseHeader = createAsyncThunk>( + 'core/base_header', + async (_, thunkAPI) => { + const { rejectWithValue, extra } = thunkAPI + try { + const response = await extra.api.get(`api/${ApiRoutes.CORE_BASE}`) + return response.data.header as CoreBaseHeaderData + } catch (error) { + return rejectWithValue(apiErrorIdentify(error, ApiErrorTypes.DATA_EMPTY_ERROR)) + } + } +) diff --git a/src/widgets/Header/model/slice/headerSlice.tsx b/src/widgets/Header/model/slice/headerSlice.tsx new file mode 100644 index 00000000..750e1e95 --- /dev/null +++ b/src/widgets/Header/model/slice/headerSlice.tsx @@ -0,0 +1,45 @@ +import { createSlice } from '@reduxjs/toolkit' + +import { rejectedPayloadHandle } from '@/shared/api/rejectedPayloadHandle' + +import { getCoreBaseHeader } from '../services/getCoreBaseHeader' +import { CoreBaseHeaderSchema } from '../types/types' + +const initialState: CoreBaseHeaderSchema = { + isLoading: false, + header: { + main_logo: { + image: '', + url: '', + title: '' + }, + support: { + callback: '', + phone_number: '' + } + }, + error: undefined +} + +const footerSlice = createSlice({ + name: 'header', + initialState, + reducers: {}, + extraReducers: builder => { + builder + .addCase(getCoreBaseHeader.pending, state => { + state.isLoading = true + state.error = undefined + }) + .addCase(getCoreBaseHeader.fulfilled, (state, { payload }) => { + state.isLoading = false + state.header = payload + }) + .addCase(getCoreBaseHeader.rejected, (state, { payload }) => { + state.isLoading = false + state.error = rejectedPayloadHandle(payload) + }) + } +}) + +export default footerSlice.reducer diff --git a/src/widgets/Header/model/types/types.tsx b/src/widgets/Header/model/types/types.tsx new file mode 100644 index 00000000..8ecb945e --- /dev/null +++ b/src/widgets/Header/model/types/types.tsx @@ -0,0 +1,21 @@ +interface Logo { + image: string + url: string + title: string +} + +interface Support { + callback: string + phone_number: string +} + +export interface CoreBaseHeaderData { + main_logo: Logo + support: Support +} + +export interface CoreBaseHeaderSchema { + isLoading: boolean + header: CoreBaseHeaderData + error?: string | string[] +} From cb0dbb5a1feaaec55b1a24c80c34db2c4b0296a2 Mon Sep 17 00:00:00 2001 From: Artur Khelshtein Date: Mon, 5 Feb 2024 12:55:22 +0300 Subject: [PATCH 8/9] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D0=B8=D0=BC=D0=B5=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=B8=D0=BD=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20=D0=B4=D0=BB=D1=8F=20=D0=B8=D1=81=D0=BA=D0=BB?= =?UTF-8?q?=D1=8E=D1=87=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=81=D0=BE=D0=B2=D0=BF?= =?UTF-8?q?=D0=B0=D0=B4=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BD=D0=B0=D0=B8=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B9=20=D1=81=20hea?= =?UTF-8?q?der?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widgets/Footer/Footer.tsx | 4 ++-- .../services/{getCoreBase.tsx => getCoreBaseFooter.tsx} | 4 ++-- src/widgets/Footer/model/slice/footerSlice.ts | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) rename src/widgets/Footer/model/services/{getCoreBase.tsx => getCoreBaseFooter.tsx} (84%) diff --git a/src/widgets/Footer/Footer.tsx b/src/widgets/Footer/Footer.tsx index 43103958..ed29973e 100644 --- a/src/widgets/Footer/Footer.tsx +++ b/src/widgets/Footer/Footer.tsx @@ -13,7 +13,7 @@ import Paragraph from '@/shared/ui/Paragraph/Paragraph' import styles from './footer.module.scss' import { getCoreBaseFooterSelector } from './model/selectors/selectors' -import { getCoreBase } from './model/services/getCoreBase' +import { getCoreBaseFooter } from './model/services/getCoreBaseFooter' function Footer() { const dispatch = useDispatch() @@ -26,7 +26,7 @@ function Footer() { } useEffect(() => { - dispatch(getCoreBase()) + dispatch(getCoreBaseFooter()) }, []) const onSubmitHandler = () => {} diff --git a/src/widgets/Footer/model/services/getCoreBase.tsx b/src/widgets/Footer/model/services/getCoreBaseFooter.tsx similarity index 84% rename from src/widgets/Footer/model/services/getCoreBase.tsx rename to src/widgets/Footer/model/services/getCoreBaseFooter.tsx index cd45b6fd..e500f43f 100644 --- a/src/widgets/Footer/model/services/getCoreBase.tsx +++ b/src/widgets/Footer/model/services/getCoreBaseFooter.tsx @@ -6,9 +6,9 @@ import { ApiError, ApiErrorTypes, ApiRoutes } from '@/shared/api/types' import { CoreBaseFooterData } from '../types/types' -export const getCoreBase = createAsyncThunk>( +export const getCoreBaseFooter = createAsyncThunk>( //void1- выходные данные, void2- входные данные , thunkConfig- тип store - 'core/base', // action type, первый аргумент + 'core/base_footer', // action type, первый аргумент async (_, thunkAPI) => { // второй аргумент- асинхронная функция , кот вызовет dispatch в компоненте const { rejectWithValue, extra } = thunkAPI diff --git a/src/widgets/Footer/model/slice/footerSlice.ts b/src/widgets/Footer/model/slice/footerSlice.ts index 64c9fb12..8027e05e 100644 --- a/src/widgets/Footer/model/slice/footerSlice.ts +++ b/src/widgets/Footer/model/slice/footerSlice.ts @@ -2,7 +2,7 @@ import { createSlice } from '@reduxjs/toolkit' import { rejectedPayloadHandle } from '@/shared/api/rejectedPayloadHandle' -import { getCoreBase } from '../services/getCoreBase' +import { getCoreBaseFooter } from '../services/getCoreBaseFooter' import { CoreBaseFooterSchema } from '../types/types' const initialState: CoreBaseFooterSchema = { @@ -31,15 +31,15 @@ const footerSlice = createSlice({ reducers: {}, extraReducers: builder => { builder - .addCase(getCoreBase.pending, state => { + .addCase(getCoreBaseFooter.pending, state => { state.isLoading = true state.error = undefined }) - .addCase(getCoreBase.fulfilled, (state, { payload }) => { + .addCase(getCoreBaseFooter.fulfilled, (state, { payload }) => { state.isLoading = false state.footer = payload }) - .addCase(getCoreBase.rejected, (state, { payload }) => { + .addCase(getCoreBaseFooter.rejected, (state, { payload }) => { state.isLoading = false state.error = rejectedPayloadHandle(payload) }) From 0a51451f861ed3d31214198264bf8dba39ea6a8a Mon Sep 17 00:00:00 2001 From: Artur Khelshtein Date: Wed, 7 Feb 2024 19:35:33 +0300 Subject: [PATCH 9/9] rebase --- .../SearchResult/SearchResult.module.scss | 0 .../SearchResult/SearchResult.stories.tsx | 0 src/{widgets => entities}/SearchResult/SearchResult.tsx | 2 +- .../search => entities/SearchResult/icons}/search-icon.svg | 0 src/features/SearchProduct/ui/SearchProduct.tsx | 2 +- src/{assets => shared}/icons/IconCategories.svg | 0 src/{assets => shared}/icons/arrow.svg | 0 .../images/footer => widgets/Footer/icons}/icon-subsc.svg | 0 src/{shared/images/footer => widgets/Footer/icons}/io.svg | 0 .../images/footer => widgets/Footer/icons}/mastercard.svg | 0 src/{shared/images/footer => widgets/Footer/icons}/mir.svg | 0 src/{shared/images/footer => widgets/Footer/icons}/visa.svg | 0 .../images/footer => widgets/Footer/icons}/webmoney.svg | 0 src/widgets/Header/Header.tsx | 6 +++--- .../header => widgets/Header/icons}/all-categories.svg | 0 .../images/header => widgets/Header/icons}/arrow_down.svg | 0 .../images/header => widgets/Header/icons}/catalog.svg | 0 .../images/header => widgets/Header/icons}/icon-catalog.svg | 0 .../images/header => widgets/Header/icons}/lightning.svg | 0 19 files changed, 5 insertions(+), 5 deletions(-) rename src/{widgets => entities}/SearchResult/SearchResult.module.scss (100%) rename src/{widgets => entities}/SearchResult/SearchResult.stories.tsx (100%) rename src/{widgets => entities}/SearchResult/SearchResult.tsx (97%) rename src/{assets/images/search => entities/SearchResult/icons}/search-icon.svg (100%) rename src/{assets => shared}/icons/IconCategories.svg (100%) rename src/{assets => shared}/icons/arrow.svg (100%) rename src/{shared/images/footer => widgets/Footer/icons}/icon-subsc.svg (100%) rename src/{shared/images/footer => widgets/Footer/icons}/io.svg (100%) rename src/{shared/images/footer => widgets/Footer/icons}/mastercard.svg (100%) rename src/{shared/images/footer => widgets/Footer/icons}/mir.svg (100%) rename src/{shared/images/footer => widgets/Footer/icons}/visa.svg (100%) rename src/{shared/images/footer => widgets/Footer/icons}/webmoney.svg (100%) rename src/{assets/images/header => widgets/Header/icons}/all-categories.svg (100%) rename src/{assets/images/header => widgets/Header/icons}/arrow_down.svg (100%) rename src/{assets/images/header => widgets/Header/icons}/catalog.svg (100%) rename src/{assets/images/header => widgets/Header/icons}/icon-catalog.svg (100%) rename src/{assets/images/header => widgets/Header/icons}/lightning.svg (100%) diff --git a/src/widgets/SearchResult/SearchResult.module.scss b/src/entities/SearchResult/SearchResult.module.scss similarity index 100% rename from src/widgets/SearchResult/SearchResult.module.scss rename to src/entities/SearchResult/SearchResult.module.scss diff --git a/src/widgets/SearchResult/SearchResult.stories.tsx b/src/entities/SearchResult/SearchResult.stories.tsx similarity index 100% rename from src/widgets/SearchResult/SearchResult.stories.tsx rename to src/entities/SearchResult/SearchResult.stories.tsx diff --git a/src/widgets/SearchResult/SearchResult.tsx b/src/entities/SearchResult/SearchResult.tsx similarity index 97% rename from src/widgets/SearchResult/SearchResult.tsx rename to src/entities/SearchResult/SearchResult.tsx index f3ec08c3..f6a14a02 100644 --- a/src/widgets/SearchResult/SearchResult.tsx +++ b/src/entities/SearchResult/SearchResult.tsx @@ -1,6 +1,5 @@ import { forwardRef } from 'react' -import SearchIcon from '@/assets/images/search/search-icon.svg' import SearchItem from '@/entities/SearchItem/SearchItem' import { TCategory } from '@/models/CategoryModel' import { Routes } from '@/shared/config/routerConfig/routes' @@ -8,6 +7,7 @@ import { SEARCH_CATEGORY, SEARCH_PRODUCT } from '@/shared/constants/constants' import type { TProduct } from '@/shared/model/types/common' import Link from '@/shared/ui/Link/Link' +import SearchIcon from './icons/search-icon.svg' import styles from './SearchResult.module.scss' type TProps = { diff --git a/src/assets/images/search/search-icon.svg b/src/entities/SearchResult/icons/search-icon.svg similarity index 100% rename from src/assets/images/search/search-icon.svg rename to src/entities/SearchResult/icons/search-icon.svg diff --git a/src/features/SearchProduct/ui/SearchProduct.tsx b/src/features/SearchProduct/ui/SearchProduct.tsx index 487dc392..3cde85d7 100644 --- a/src/features/SearchProduct/ui/SearchProduct.tsx +++ b/src/features/SearchProduct/ui/SearchProduct.tsx @@ -1,12 +1,12 @@ import { useRef, useEffect, useState } from 'react' import { useNavigate } from 'react-router-dom' +import SearchResult from '@/entities/SearchResult/SearchResult' import { searchResponseData } from '@/mockData/searchData' import { Routes } from '@/shared/config/routerConfig/routes' import { TResultData } from '@/shared/model/types/common' import { Button, ButtonDesign, ButtonSize, ButtonTheme } from '@/shared/ui/Button/Button' import { Input, InputSize, InputTheme } from '@/shared/ui/Input/Input' -import SearchResult from '@/widgets/SearchResult/SearchResult' import styles from './SearchProduct.module.scss' diff --git a/src/assets/icons/IconCategories.svg b/src/shared/icons/IconCategories.svg similarity index 100% rename from src/assets/icons/IconCategories.svg rename to src/shared/icons/IconCategories.svg diff --git a/src/assets/icons/arrow.svg b/src/shared/icons/arrow.svg similarity index 100% rename from src/assets/icons/arrow.svg rename to src/shared/icons/arrow.svg diff --git a/src/shared/images/footer/icon-subsc.svg b/src/widgets/Footer/icons/icon-subsc.svg similarity index 100% rename from src/shared/images/footer/icon-subsc.svg rename to src/widgets/Footer/icons/icon-subsc.svg diff --git a/src/shared/images/footer/io.svg b/src/widgets/Footer/icons/io.svg similarity index 100% rename from src/shared/images/footer/io.svg rename to src/widgets/Footer/icons/io.svg diff --git a/src/shared/images/footer/mastercard.svg b/src/widgets/Footer/icons/mastercard.svg similarity index 100% rename from src/shared/images/footer/mastercard.svg rename to src/widgets/Footer/icons/mastercard.svg diff --git a/src/shared/images/footer/mir.svg b/src/widgets/Footer/icons/mir.svg similarity index 100% rename from src/shared/images/footer/mir.svg rename to src/widgets/Footer/icons/mir.svg diff --git a/src/shared/images/footer/visa.svg b/src/widgets/Footer/icons/visa.svg similarity index 100% rename from src/shared/images/footer/visa.svg rename to src/widgets/Footer/icons/visa.svg diff --git a/src/shared/images/footer/webmoney.svg b/src/widgets/Footer/icons/webmoney.svg similarity index 100% rename from src/shared/images/footer/webmoney.svg rename to src/widgets/Footer/icons/webmoney.svg diff --git a/src/widgets/Header/Header.tsx b/src/widgets/Header/Header.tsx index bd846676..b53e4881 100644 --- a/src/widgets/Header/Header.tsx +++ b/src/widgets/Header/Header.tsx @@ -3,9 +3,6 @@ import { useEffect, useMemo } from 'react' import { useDispatch, useSelector } from 'react-redux' import { AppDispatch } from '@/app/providers/StoreProvider/config/store' -import ArrowIcon from '@/assets/icons/arrow.svg' -import IconCategories from '@/assets/icons/IconCategories.svg' -import LightningIcon from '@/assets/images/header/lightning.svg' import CatalogLink from '@/components/CatalogLink/CatalogLink' import ContextMenuElement from '@/components/ContextMenuElement/ContextMenuElement' import HeaderAccount from '@/components/HeaderAccount/HeaderAccount' @@ -16,12 +13,15 @@ import { linkItems } from '@/mockData/catalogListData' import { headerAccountData } from '@/mockData/headerAccountData' import { Routes } from '@/shared/config/routerConfig/routes' import { PHONE_NUMBER } from '@/shared/constants/constants' +import ArrowIcon from '@/shared/icons/arrow.svg' +import IconCategories from '@/shared/icons/IconCategories.svg' import Link from '@/shared/ui/Link/Link' import Logo from '@/shared/ui/logo/Logo' import CatalogNodeItem from '@/widgets/CatalogNodeItem/CatalogNodeItem' import NavigationLink from '@/widgets/NavigationLink/NavigationLink' import styles from './header.module.scss' +import LightningIcon from './icons/lightning.svg' import { getCoreBaseHeaderSelector } from './model/selectors/selectors' import { getCoreBaseHeader } from './model/services/getCoreBaseHeader' diff --git a/src/assets/images/header/all-categories.svg b/src/widgets/Header/icons/all-categories.svg similarity index 100% rename from src/assets/images/header/all-categories.svg rename to src/widgets/Header/icons/all-categories.svg diff --git a/src/assets/images/header/arrow_down.svg b/src/widgets/Header/icons/arrow_down.svg similarity index 100% rename from src/assets/images/header/arrow_down.svg rename to src/widgets/Header/icons/arrow_down.svg diff --git a/src/assets/images/header/catalog.svg b/src/widgets/Header/icons/catalog.svg similarity index 100% rename from src/assets/images/header/catalog.svg rename to src/widgets/Header/icons/catalog.svg diff --git a/src/assets/images/header/icon-catalog.svg b/src/widgets/Header/icons/icon-catalog.svg similarity index 100% rename from src/assets/images/header/icon-catalog.svg rename to src/widgets/Header/icons/icon-catalog.svg diff --git a/src/assets/images/header/lightning.svg b/src/widgets/Header/icons/lightning.svg similarity index 100% rename from src/assets/images/header/lightning.svg rename to src/widgets/Header/icons/lightning.svg