Skip to content

Commit

Permalink
Merge branch 'development-195-category-list-api' of github.com:Studio…
Browse files Browse the repository at this point in the history
…-Yandex-Practicum/maxboom_frontend into development-195-category-list-api
  • Loading branch information
Kseniya committed May 13, 2024
2 parents 64eb696 + 2509c44 commit fb2eb71
Show file tree
Hide file tree
Showing 432 changed files with 16,464 additions and 5,981 deletions.
2 changes: 1 addition & 1 deletion .babelrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
"@babel/preset-react"
],
"plugins": []
}
}
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ Frontend часть проекта для сайта maxboom. Онлайн ма
- Axios
- SCSS module

## Принят следующий порядок импортов:

- Импорты библиотек (from 'react')
- Импорты абсолютные (from '@/...')
- Импорты относительные внутрь (from './...') и наружу (from '../...') при этом импорты наружу не рекомендуются и следует использовать абсолютные импорты
(SCSS не относится к правилу порядка импортов)

каждая группа импортов сортируется по алфавиту (hint используй «npx eslint 'путь к файлу' --fix»)

## Работа с git:

1. Участник клонирует проект
Expand Down
1 change: 0 additions & 1 deletion config/storybook/decorators/StoreDecorator.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ export const StoreDecorator = (initialState) => (Story) =>
( <StoreProvider initialState={initialState}>
<Story/>
</StoreProvider>);

7,781 changes: 4,209 additions & 3,572 deletions package-lock.json

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,18 @@
},
"dependencies": {
"@reduxjs/toolkit": "1.9.5",
"@storybook/test": "^8.0.0",
"axios": "^1.6.2",
"classnames": "^2.3.2",
"focus-trap": "^7.5.4",
"formik": "^2.4.5",
"leaflet": "^1.9.4",
"normalize-scss": "7.0.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-input-mask": "^2.0.4",
"react-leaflet": "^4.2.1",
"react-loading-skeleton": "^3.4.0",
"react-redux": "8.1.2",
"react-router": "6.15.0",
"react-router-dom": "6.15.0",
Expand All @@ -59,14 +63,15 @@
"@storybook/react-webpack5": "^7.5.1",
"@storybook/testing-library": "^0.2.2",
"@svgr/webpack": "^8.1.0",
"@types/react": "18.2.20",
"@types/leaflet": "^1.9.8",
"@types/react": "^18.2.64",
"@types/react-dom": "18.2.7",
"@types/react-input-mask": "^3.0.5",
"@types/react-router-dom": "5.3.3",
"@typescript-eslint/eslint-plugin": "6.4.1",
"@typescript-eslint/parser": "6.4.1",
"babel-loader": "9.1.3",
"css-loader": "6.8.1",
"css-loader": "^6.8.1",
"dotenv": "16.3.1",
"eslint": "8.47.0",
"eslint-config-prettier": "9.0.0",
Expand All @@ -80,7 +85,7 @@
"sass": "1.66.1",
"sass-loader": "13.3.2",
"storybook": "^7.5.1",
"style-loader": "3.3.3",
"style-loader": "^3.3.3",
"stylelint": "15.10.3",
"stylelint-config-prettier-scss": "1.0.0",
"stylelint-config-standard-scss": "10.0.0",
Expand Down
3 changes: 3 additions & 0 deletions src/app/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useEffect } from 'react'
import { RouterProvider } from 'react-router-dom'

import { getCart } from '@/entities/CartEntity/model/slice/cartEntitySlice'
import { loginActions } from '@/features/login/model/slice/loginSlice'
import { $api } from '@/shared/api/api'
import { tokenFromStorageGet } from '@/shared/libs/helpers/localStorageHandler'
Expand All @@ -17,6 +18,8 @@ function App() {
dispatch(loginActions.initAuth(token))
$api.addToken(token)
}

dispatch(getCart())
}, [dispatch])
return <RouterProvider router={router} />
}
Expand Down
29 changes: 28 additions & 1 deletion src/app/providers/StoreProvider/config/StateSchema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CategorySchema } from '@/entities/Category/types/types'
import { CategoryId, CategorySlug, CategorySchema } from '@/entities/Category/types/types'
import { SearchResultSchema } from '@/features/SearchProduct/types/types'
import { LoginSchema } from '@/features/login/model/types/types'
import { BrandSchema } from '@/widgets/BrandBlock/types/types'
Expand All @@ -7,18 +7,45 @@ 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 { IStoriesSchema } from '@/widgets/StoriesBlock/model/types/types'
import { CoreBaseHeaderSchema } from '@/widgets/Header/model/types/types'
import { TProductSchema } from '@/pages/ProductPage/model/types/productTypes'
import { CategoryListSchema } from '@/widgets/CategoryGrid/model/types/types'
import { ICategoryProductsSchema } from '@/pages/ProductsPage/types/types'
import { IFeedbackSchema } from '@/pages/FeedbackPage/model/types/types'
import { ICategorySchema, IMainCategorySchema } from '@/widgets/CategoryList/types/types'
import { ICategoryFiltersSchema } from '@/components/Dropdown/types/types'
import type { IFeedbackFormSchema } from '@/widgets/FeedbackForm/model/scheme/feedbackFormSliceSchema'
import { ICartEntitySchema } from '@/entities/CartEntity/model/types/types'
import { IAboutUsSchema } from '@/pages/AboutUsPage/model/types/types'
import { ICartSchema } from '@/pages/CartPage/model/types'
import { IProductAmountStateSchema } from '@/features/CartEdit/model/types'

export interface StateSchema {
aboutUs: IAboutUsSchema
login: LoginSchema
storeReviews: StoreReviewsSchema
category: CategorySchema
categoryList: CategoryListSchema
coreBaseFooter: CoreBaseFooterSchema
coreBaseHeader: CoreBaseHeaderSchema
brand: BrandSchema
searchResult: SearchResultSchema
shopNews: ShopNewsSchema
stories: IStoriesSchema
blogPosts: IBlogPostsSchema
product: TProductSchema
categoryProduct: ICategoryProductsSchema
feedback: IFeedbackSchema
feedbackForm: IFeedbackFormSchema
categoryId: CategoryId
categorySlug: CategorySlug
categoryBranches: ICategorySchema
getCategories: IMainCategorySchema
cart: ICartSchema
cartEntity: ICartEntitySchema
categoryFilters: ICategoryFiltersSchema
productAmount: IProductAmountStateSchema
}

export interface ThunkExtraArg {
Expand Down
34 changes: 31 additions & 3 deletions src/app/providers/StoreProvider/config/store.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { configureStore, ReducersMapObject } from '@reduxjs/toolkit'

import { loginReducer } from '@/features/login/model/slice/loginSlice'
import { $api } from '@/shared/api/api'
import categorySlice from '@/entities/Category/slice/categorySlice'
Expand All @@ -8,14 +7,29 @@ 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 { storiesReducer } from '@/widgets/StoriesBlock/model/slice/storiesSlice'
import { blogPostsReducer } from '@/widgets/BlogBlock/model/slice/blogPostsSlice'
import headerSlice from '@/widgets/Header/model/slice/headerSlice'

import { StateSchema, ThunkExtraArg } from './StateSchema'
import { productSliceReducer } from '@/pages/ProductPage/model/slice/productSlice'
import categoryGridSlice from '@/widgets/CategoryGrid/model/slice/categoryGridSlice'
import { categoriesProductsReducer } from '@/pages/ProductsPage/slice/productsOfCategorySlice'
import { categoryIdSliceReducer } from '@/entities/Category/slice/categoryIdSlice'
import { categorySlugSliceReducer } from '@/entities/Category/slice/categorySlugSlice'
import { categoryBranchesReducer } from '@/widgets/CategoryList/slice/pageCategoryBranchesSlice'
import { getCategoriesReducer } from '@/widgets/CategoryList/slice/pageCategoriesSlice'
import { feedbackReducer } from '@/pages/FeedbackPage/model/slice/feedbackSlice'
import { categoryFiltersSliceReducer } from '@/components/Dropdown/slice/filtersSlice'
import { feedbackFormReducer } from '@/widgets/FeedbackForm/model/slice/feedbackFormSlice'
import { aboutUsReducer } from '@/pages/AboutUsPage/model/slice/aboutUsSlice'
import { cartReducer } from '@/pages/CartPage/model/slice'
import { cartEntityReducer } from '@/entities/CartEntity/model/slice/cartEntitySlice'
import { productAmountReducer } from '@/features/CartEdit/model/slice/productAmountSlice'

export type RootState = StateSchema

const rootReducer: ReducersMapObject<RootState> = {
aboutUs: aboutUsReducer,
login: loginReducer,
category: categorySlice,
coreBaseHeader: headerSlice,
Expand All @@ -24,7 +38,21 @@ const rootReducer: ReducersMapObject<RootState> = {
searchResult: searchProductSlice,
storeReviews: storeReviewsReducer,
shopNews: shopNewsReducer,
blogPosts: blogPostsReducer
stories: storiesReducer,
blogPosts: blogPostsReducer,
product: productSliceReducer,
categoryProduct: categoriesProductsReducer,
categoryList: categoryGridSlice,
feedback: feedbackReducer,
feedbackForm: feedbackFormReducer,
categoryId: categoryIdSliceReducer,
categorySlug: categorySlugSliceReducer,
categoryBranches: categoryBranchesReducer,
getCategories: getCategoriesReducer,
cartEntity: cartEntityReducer,
cart: cartReducer,
categoryFilters: categoryFiltersSliceReducer,
productAmount: productAmountReducer
}

export function createReduxStore(initialState: RootState) {
Expand Down
87 changes: 77 additions & 10 deletions src/app/router/AppRouter/ui/AppRouter.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import { createBrowserRouter } from 'react-router-dom'

import AboutUsPage from '@/pages/AboutUsPage/AboutUsPage'
import BlogPage from '@/pages/BlogPage/BlogPage'
import CartPage from '@/pages/CartPage/CartPage'
import { CategoryPage } from '@/pages/CategoryPage/CategoryPage'
import ComparePage from '@/pages/ComparePage/ComparePage'
import ContactsPage from '@/pages/ContactsPage/ContactsPage'
import DeliveryPage from '@/pages/DeliveryPage/DeliveryPage'
import ErrorPage from '@/pages/ErrorPage/ErrorPage'
import FavoritesPage from '@/pages/FavoritesPage/FavoritesPage'
import { FavoritesPage } from '@/pages/FavoritesPage/FavoritesPage'
import { FeedbackPage } from '@/pages/FeedbackPage/FeedbackPage'
import FormReturnPage from '@/pages/FormReturnPage/FormReturnPage'
import HelpPage from '@/pages/HelpPage/HelpPage'
import LoginPage from '@/pages/LoginPage/LoginPage'
import MainPage from '@/pages/MainPage/MainPage'
import { ProductPage } from '@/pages/ProductPage/ProductPage'
import { ProductsPage } from '@/pages/ProductsPage/ProductsPage'
import RootPage from '@/pages/RootPage/RootPage'
import SearchResultsPage from '@/pages/SearchResultsPage/SearchResultsPage'
import VouchersPage from '@/pages/VouchersPage/VouchersPage'
import { Routes } from '@/shared/config/routerConfig/routes'

export const AppRouter = createBrowserRouter([
Expand All @@ -23,43 +31,102 @@ export const AppRouter = createBrowserRouter([
path: '',
element: <MainPage />
},
{
path: Routes.ABOUT,
element: <AboutUsPage />
},
{
path: Routes.BLOG,
element: <BlogPage />
},
{
path: Routes.PRODUCTS_ID,
element: <ProductsPage />
path: Routes.BRANDS,
element: <ProductsPage /> // временная заглушка нужна страница со всеми брендами
},
// Добавил как временную заглушку пока не будет страницы категории
{
path: Routes.CATEGORIES + '/all',
element: <CategoryPage />
},
{
path: Routes.CATEGORIES + '/:slug',
element: <ProductsPage /> // временная заглушка нужна страница категорий
path: Routes.CART,
element: <CartPage />
},
{
path: Routes.LOGIN,
element: <LoginPage />
path: Routes.CATEGORIES + '/:slug',
element: <ProductsPage /> // временная заглушка нужна страница категорий
},
{
path: Routes.COMPARE,
element: <ComparePage />
},
{
path: Routes.DELIVERY,
element: <DeliveryPage />
},
{
path: Routes.FAVORITES,
element: <FavoritesPage />
},
{
path: Routes.CART,
element: <CartPage />
path: Routes.LOGIN,
element: <LoginPage />
},
{
path: Routes.NEWS,
element: <ProductsPage /> // временная заглушка нужна страница с новостями
},
{
path: Routes.PRIVACY,
element: <ProductsPage /> // временная заглушка нужна страница с политикой безопасности
},
{
path: Routes.PRODUCTS,
element: <ProductsPage /> // временная заглушка нужна страница со всеми товарами категории или подкатегории
},
{
path: Routes.PRODUCTS_ID,
element: <ProductsPage />
},
{
path: Routes.REVIEWS,
element: <FeedbackPage />
},
{
path: Routes.SEARCH,
element: <SearchResultsPage />
},
{
path: Routes.HELP,
element: <HelpPage />
},
{
path: Routes.STORE_REVIEWS,
element: <ProductsPage /> // временная заглушка нужна страница с отзывами о магазине
},
{
path: Routes.TERMS,
element: <ProductsPage /> // временная заглушка нужна страница с условиями соглашения
},
{
path: Routes.ADD_RETURN,
element: <FormReturnPage />
},
{
path: Routes.VOUCHERS,
element: <VouchersPage />
},
{
path: Routes.PRODUCT + '/:slug',
element: <ProductPage />
},
{
path: Routes.CONTACTS,
element: <ContactsPage />
}
/* {
path: Routes.CERTIFICATE,
element: <Certificate />
} */
]
}
])
12 changes: 12 additions & 0 deletions src/assets/icons/ArrowRightNextPage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/IconArrowDown.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/IconArrowUp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/icons/YMap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/iconCategory.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/assets/icons/iconMenu.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/assets/icons/iconSearch.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/banner/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/assets/images/cart/arrow-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit fb2eb71

Please sign in to comment.