diff --git a/src/assets/icons/iconCategory.svg b/src/assets/icons/iconCategory.svg new file mode 100644 index 00000000..9557b4b7 --- /dev/null +++ b/src/assets/icons/iconCategory.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/images/sideBarMenu/IconArrowDown.svg b/src/assets/images/sideBarMenu/IconArrowDown.svg new file mode 100644 index 00000000..3025b2c5 --- /dev/null +++ b/src/assets/images/sideBarMenu/IconArrowDown.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/images/sideBarMenu/iconCategory.svg b/src/assets/images/sideBarMenu/iconCategory.svg new file mode 100644 index 00000000..e49cbebf --- /dev/null +++ b/src/assets/images/sideBarMenu/iconCategory.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/entities/Category/selectors/categorySelectors.ts b/src/entities/Category/selectors/categorySelectors.ts index 7b939f51..66b7d092 100644 --- a/src/entities/Category/selectors/categorySelectors.ts +++ b/src/entities/Category/selectors/categorySelectors.ts @@ -6,3 +6,5 @@ export const selectDisplayedCategories = (state: RootState) => state.category.di export const selectCategoryId = (state: RootState) => state.categoryId.categoryId export const selectCategorySlug = (state: RootState) => state.categorySlug.categorySlug + +export const getLoading = (state: RootState) => state.category.isLoading diff --git a/src/entities/Category/slice/categorySlice.ts b/src/entities/Category/slice/categorySlice.ts index 60c465e4..0df9227e 100644 --- a/src/entities/Category/slice/categorySlice.ts +++ b/src/entities/Category/slice/categorySlice.ts @@ -8,6 +8,7 @@ import { ApiError, ApiErrorTypes, ApiRoutes } from '@/shared/api/types' import type { Category, CategorySchema } from '../types/types' const initialState: CategorySchema = { + isLoading: false, categories: [], displayedCategories: [], error: undefined @@ -34,13 +35,16 @@ const categorySlice = createSlice({ extraReducers: builder => { builder .addCase(fetchCategories.pending, state => { + state.isLoading = true state.error = undefined }) .addCase(fetchCategories.fulfilled, (state, action) => { + state.isLoading = false state.categories = action.payload state.displayedCategories = action.payload.filter((c: Category) => c.is_visible_on_main === true) }) .addCase(fetchCategories.rejected, (state, { payload }) => { + state.isLoading = false state.error = rejectedPayloadHandle(payload) }) } diff --git a/src/entities/Category/types/types.ts b/src/entities/Category/types/types.ts index dc802b6d..fd8605e2 100644 --- a/src/entities/Category/types/types.ts +++ b/src/entities/Category/types/types.ts @@ -1,4 +1,5 @@ export interface CategorySchema { + isLoading: boolean categories: Category[] displayedCategories: Category[] error?: string | string[] diff --git a/src/entities/Payments/Payments.tsx b/src/entities/Payments/Payments.tsx index a966e37d..7ffaf681 100644 --- a/src/entities/Payments/Payments.tsx +++ b/src/entities/Payments/Payments.tsx @@ -10,22 +10,19 @@ type TPayments = { type Logo = { image: string - title: string url: string } /** платежная система - * @param {string} image - путь к картинке - * @param {string} title - название - * @param {string} url - путь к сайту + * @param {url: string, image: string} data[] массив платежных систем */ const Payments: FC = ({ data }) => { return (