Sfoglia il codice sorgente

final fixed project

Alex 2 anni fa
parent
commit
cf0f6b60a2

+ 41 - 0
src/actions/ActionCategory.js

@@ -1,6 +1,7 @@
 import {actionPromise} from "../reducers/PromiseReducer";
 import {gql} from "./PathDB";
 import {actionCategoryChange, actionCategoryCreate} from "../reducers/CategoryReducer";
+import {actionSearchResult} from "../reducers/SearchReducer";
 
 //CategoryFind -- parent: null
 export const actionRootCats = () => {
@@ -98,3 +99,43 @@ export const actionFullAllCategory = () =>
             dispatch(actionCategoryCreate(value))
         }
     }
+
+//CategoryFind -- search
+export const actionSearchCategory = (text) => {
+    return actionPromise('searchCategory', gql(`
+        query searchCategory($query: String){
+          CategoryFind(query: $query){
+            _id,
+            name,
+            createdAt,
+            goods {
+                _id name 
+            },
+            subCategories{
+              _id,
+              name,
+              createdAt,
+              goods {
+                _id name 
+              },
+              subCategories{
+                _id,
+                name,
+                createdAt,
+                goods {
+                   _id name 
+                },
+              }
+            }
+          }
+        }`, {query: JSON.stringify([{name: `/${text}/`}])}
+        )
+    )
+}
+export const actionFullSearchCategory = (text) =>
+    async dispatch => {
+        let value = await dispatch(actionSearchCategory(text))
+        if (value){
+            dispatch(actionSearchResult(value))
+        }
+    }

+ 10 - 15
src/components/CPRoute.jsx

@@ -20,20 +20,15 @@ const ProtectedRoute =({ fallback='/',
                          component: Component,
                          ...routeProps}) => {
     const WrapperComponent = (componentProps) => {
-        let acl = auth?.payload?.sub?.acl
-        if (localStorage?.authToken && acl && Array.isArray(acl) && acl.length > 0) {
-            acl = acl.filter(item => {
-                if(roles.includes(item)) return item
-            })
-            if (acl.length > 0){
-                return <Component {...componentProps}/>
-            }
-        }
-        else if (localStorage?.authToken){
-            return <Component {...componentProps}/>
-        }
-        return <Redirect to={fallback}/>
-    }
-    return <CRRoute {...routeProps} component={WrapperComponent}/>
+        const acl = auth?.payload?.sub?.acl || ['anon']
+        const unity = roles.some(item => acl.includes(item))
+        return(
+            unity ?
+                <Component {...componentProps} />
+                :
+                <Redirect to="/my-account" />
+        )
+    };
+    return <CRRoute {...routeProps} component={WrapperComponent} />;
 }
 export const CPRoute = connect(state => ({auth: state.auth}))(ProtectedRoute)

+ 2 - 2
src/components/Title.jsx

@@ -18,7 +18,7 @@ const Title = ({subtitle, title}) => {
                 marginLeft='5px'
                 marginBottom='10px'
             >
-                {subtitle || 'subtitle'}
+                {subtitle}
             </Typography>
             <img
                 style={{
@@ -36,7 +36,7 @@ const Title = ({subtitle, title}) => {
                 marginLeft='5px'
                 marginTop='10px'
             >
-                {title || 'title'}
+                {title}
             </Typography>
         </Box>
     )

+ 8 - 5
src/pages/AdminPage/AdminPage.jsx

@@ -22,9 +22,9 @@ import {CClients} from "./ClientsTab/ClientsTab";
 import {CGoodEdit} from "./GoodsTab/GoodEdit";
 import {CFindGoodEdit} from "./GoodsTab/FindGoodEdit";
 import {CCategoryEdit} from "./CategoriesTab/CategoryEdit";
-import {CCategoryEditTree, CCCategoryEditTree} from "./CategoriesTab/CCategoryEditTree";
 import {actionClearPromise} from "../../reducers/PromiseReducer";
 import {connect} from "react-redux";
+import {CFindCategoryEdit} from "./CategoriesTab/FindCategoryEdit";
 
 const defaultTabs = [
     {icon: PersonIcon, text: 'clients'},
@@ -109,7 +109,9 @@ const SelectBlock = ({Block, FindBlock, actionClear}) => {
         </>
     )
 }
-const CSelectBlock = connect(null, {actionClear: actionClearPromise})(SelectBlock)
+const CSelectBlock = connect(null, {
+    actionClear: actionClearPromise})
+(SelectBlock)
 
 const FullWidthTabs = () => {
     const theme = useTheme();
@@ -164,18 +166,19 @@ const FullWidthTabs = () => {
                 onChangeIndex={handleChangeIndex}
             >
                 <TabPanel value={value} index={0} dir={theme.direction}>
-                    {/*<CClients/>*/}
+                    <CClients/>
                 </TabPanel>
                 <TabPanel value={value} index={1} dir={theme.direction}>
-                    <CSelectBlock Block={CCategoryEdit} FindBlock={CCCategoryEditTree}/>
+                    <CSelectBlock Block={CCategoryEdit} FindBlock={CFindCategoryEdit}/>
                 </TabPanel>
                 <TabPanel value={value} index={2} dir={theme.direction}>
-                    {/*<CSelectBlock Block={CGoodEdit} FindBlock={CFindGoodEdit}/>*/}
+                    <CSelectBlock Block={CGoodEdit} FindBlock={CFindGoodEdit}/>
                 </TabPanel>
             </SwipeableViews>
         </Box>
     );
 }
+
 const AdminPage = () => {
     const matches = useMediaQuery('(max-width:768px)')
 

+ 3 - 3
src/pages/AdminPage/CategoriesTab/CCategoryEditTree.jsx

@@ -1,7 +1,6 @@
 import * as React from "react";
 import {TreeViewComponent} from "@syncfusion/ej2-react-navigations";
 import {connect} from "react-redux";
-import {actionFullRootCats} from "../../../actions/ActionCategory";
 
 export class CCategoryEditTree extends React.Component {
     constructor(category, onGetCategory) {
@@ -67,5 +66,6 @@ export class CCategoryEditTree extends React.Component {
         );
     }
 }
-
-export const CCCategoryEditTree = connect(state => ({category: state.category}))(CCategoryEditTree)
+export const CCCategoryEditTree = connect(state => ({
+    category: state.category})
+)(CCategoryEditTree)

+ 14 - 10
src/pages/AdminPage/CategoriesTab/CategoryEdit.jsx

@@ -1,14 +1,12 @@
 import {useEffect, useState} from "react";
 import Typography from "@mui/material/Typography";
-import {Button, Checkbox, Grid, Switch, TextField} from "@mui/material";
+import {Button, Grid, Switch, TextField} from "@mui/material";
 import {connect} from "react-redux";
 import {actionCategoryCount, actionCategoryUpsert, actionFullRootCats} from "../../../actions/ActionCategory";
 import {actionAllGoodFind} from "../../../actions/ActionGoodFind";
 import * as React from "react";
 import Autocomplete from "@mui/material/Autocomplete";
 import Box from "@mui/material/Box";
-import CheckCircleOutlineIcon from "@mui/icons-material/CheckCircleOutline";
-import {AccordionItem} from "../../MyOrdersPage/AccordionItem";
 
 const AddSubCategory = ({goods, onCreate}) => {
     const [subCategory, setSubCategory] = useState({});
@@ -27,7 +25,6 @@ const AddRootCategory = ({goods, onCreate}) => {
     const [name, setName] = useState('');
     const [products, setProducts] = useState([]);
     const [addSub, setAddSub] = useState(false);
-    const [addCat, setAddCat] = useState(false);
     const [subCategory, setSubCategory] = useState({});
 
     useEffect(() => {
@@ -125,7 +122,7 @@ const AddRootCategory = ({goods, onCreate}) => {
     )
 }
 
-const CategoryEdit = ({category,
+const CategoryEdit = ({   category,
                           categoryCount,
                           goods,
                           actionRootCat,
@@ -197,8 +194,15 @@ const CategoryEdit = ({category,
         </>
     )
 }
-export const CCategoryEdit = connect(state => ({category: state.category,
-    categoryCount: state.promise['categoryCount'], goods: state.promise['goodAllFind'],
-        categoryUpsert: state.promise['categoryUpsert'] }),
-    {actionRootCat: actionFullRootCats, onCountCategory: actionCategoryCount,
-        onGoodFind: actionAllGoodFind, onCreateCategory: actionCategoryUpsert})(CategoryEdit)
+
+export const CCategoryEdit = connect(state => ({
+        category: state.category,
+        categoryCount: state.promise['categoryCount'],
+        goods: state.promise['goodAllFind'],
+        categoryUpsert: state.promise['categoryUpsert']}),
+    {
+        actionRootCat: actionFullRootCats,
+        onCountCategory: actionCategoryCount,
+        onGoodFind: actionAllGoodFind,
+        onCreateCategory: actionCategoryUpsert})
+(CategoryEdit)

+ 101 - 0
src/pages/AdminPage/CategoriesTab/CategoryFound.jsx

@@ -0,0 +1,101 @@
+import {useState} from "react";
+import {Button} from "@mui/material";
+import Box from "@mui/material/Box";
+import Typography from "@mui/material/Typography";
+import {CCategoryEdit} from "./CategoryEdit";
+import {timeCalc} from "../../ProductPage/timeCalc";
+
+export const CategoryFound = ({item}) => {
+    let [state, setState] = useState(false)
+    let formattedTime = 0;
+    if (['createdAt'] in item) {
+        formattedTime = timeCalc(+item.createdAt);
+    }
+
+    return (
+        !state ?
+            <Button
+                fullWidth
+                sx={{
+                    display: 'flex',
+                    justifyContent:'center',
+                    alignItems: 'center',
+                    marginBottom: '20px',
+                    border: '1px dashed #616161',
+                    borderRadius: '20px',
+                    padding: '20px'
+                }}
+                onClick={() => setState(true)}
+            >
+                <Box sx={{
+                    display: 'flex',
+                    flexDirection: 'column',
+                    justifyContent: 'space-between',
+                    alignItems: 'flex-start'
+                }}>
+                    <Typography
+                        color='#000'
+                        letterSpacing='1px'
+                        fontFamily='sarif'
+                        fontWeight='600'
+                        variant='h6'
+                    >
+                        {item?.name || 'no name'}
+                    </Typography>
+                    <Typography
+                        letterSpacing='1px'
+                        variant='body1'
+                        fontWeight='300'
+                        color='#616161'
+                        margin='10px 0'
+                    >
+                        { formattedTime
+                            ? `Time of creation: ${formattedTime}`
+                            : ''
+                        }
+                    </Typography>
+                    <Typography
+                        color='#000'
+                        letterSpacing='1px'
+                        variant='body1'
+                        fontWeight='600'
+                    >
+                        { item?.goods?.length
+                            ? `Count of goods: ${item?.goods?.length}`
+                            : ''
+                        }
+                    </Typography>
+                    <Typography
+                        color='#000'
+                        letterSpacing='1px'
+                        variant='body1'
+                        fontWeight='600'
+                    >
+                        { item?.subCategories?.length
+                            ? `Count of sub categories: ${item?.subCategories?.length}`
+                            : ''
+                        }
+                    </Typography>
+                </Box>
+            </Button>
+            :
+            <Box
+                sx={{
+                    marginBottom: '30px',
+                    border: '1px solid #616161',
+                    borderRadius: '10px',
+                    padding: '30px 20px'
+                }}
+            >
+                <CCategoryEdit entity={{...item}}/>
+                <Button
+                    variant='outlined'
+                    sx={{marginTop: '30px'}}
+                    fullWidth
+                    onClick={() => setState(false)}
+                >
+                    Cansel
+                </Button>
+            </Box>
+    )
+}

+ 86 - 0
src/pages/AdminPage/CategoriesTab/FindCategoryEdit.jsx

@@ -0,0 +1,86 @@
+import {useState} from "react";
+import {CircularProgress, Container, IconButton, InputAdornment, TextField} from "@mui/material";
+import Typography from "@mui/material/Typography";
+import SearchIcon from "@material-ui/icons/Search";
+import {NotFound} from "../GoodsTab/NotFound";
+import {connect} from "react-redux";
+import {actionSearchRemove} from "../../../reducers/SearchReducer";
+import {actionFullSearchCategory} from "../../../actions/ActionCategory";
+import {CategoryFound} from "./CategoryFound";
+
+const FindCategoryEdit = ({searchResult, onSearch, onSearchRemove}) => {
+    const [value, setValue] = useState('')
+    const [click, setClick] = useState(false)
+
+    return (
+        <>
+            <Container maxWidth="md">
+                <Typography
+                    variant='h5'
+                    fontFamily='sarif'
+                    letterSpacing='3px'
+                    marginBottom='30px'
+                    marginTop='30px'
+                    textAlign='center'
+                >
+                    WHICH ITEM TO EDIT?
+                </Typography>
+                <TextField
+                    color={'primary'}
+                    fullWidth
+                    variant="standard"
+                    value={value}
+                    placeholder="Start typing..."
+                    onChange={(event) => {
+                        setClick(false);
+                        setValue(event.target.value);
+                        onSearchRemove()
+                    }}
+                    InputProps={{
+                        sx: {
+                            padding: '10px',
+                            outline:'none',
+                            color: '#616161',
+                            fontWeight: '300',
+                            letterSpacing: '1px',
+                            marginBottom: '50px'
+                        },
+                        endAdornment: (
+                            <InputAdornment position="end">
+                                <IconButton
+                                    onClick={() => {
+                                        setClick(true);
+                                        onSearchRemove();
+                                        onSearch(value)
+                                    }}
+                                >
+                                    <SearchIcon />
+                                </IconButton>
+                            </InputAdornment>
+                        )
+                    }}
+                />
+                {(value !== '' && click) && (searchResult?.searchResult ?
+                        Object.values(searchResult.searchResult).length > 0  ?
+                            Object.values(searchResult.searchResult)
+                                .map(item =>
+                                    <CategoryFound
+                                        key={item?._id}
+                                        item={item}
+                                    />
+                                )
+                            :
+                            <NotFound/>
+                        :
+                        <CircularProgress color="inherit"/>
+                )}
+            </Container>
+        </>
+    )
+}
+export const CFindCategoryEdit = connect(state=> ({
+        searchResult: state.search}),
+    {
+        onSearch: actionFullSearchCategory,
+        onSearchRemove: actionSearchRemove})
+(FindCategoryEdit)

+ 0 - 1
src/pages/AdminPage/ClientsTab/ClientsCart.jsx

@@ -1,4 +1,3 @@
-import Typography from "@mui/material/Typography";
 import {Avatar, Card, CardContent, CardHeader, Collapse} from "@mui/material";
 import {backURL} from "../../../actions/PathDB";
 import userDefault from "../../../img/header/userDefault.png";

+ 6 - 2
src/pages/AdminPage/ClientsTab/ClientsTab.jsx

@@ -93,6 +93,10 @@ const Clients = ({usersArr, usersCount, getAllClients, getCountUser}) => {
         </>
     )
 }
-export const CClients = connect(state => ({usersArr: state.promise['allUsers'],
+export const CClients = connect(state => ({
+        usersArr: state.promise['allUsers'],
         usersCount: state.promise['usersCount']}),
-    {getAllClients: actionUserFind, getCountUser: actionUserCount})(Clients)
+    {
+        getAllClients: actionUserFind,
+        getCountUser: actionUserCount})
+(Clients)

+ 7 - 2
src/pages/AdminPage/GoodsTab/FindGoodEdit.jsx

@@ -77,5 +77,10 @@ const FindGoodEdit = ({searchResult, onSearch, onSearchRemove}) => {
         </>
     )
 }
-export const CFindGoodEdit = connect(state=>({searchResult: state.search}),
-    {onSearch: actionFullGoodFind, onSearchRemove: actionSearchRemove})(FindGoodEdit)
+
+export const CFindGoodEdit = connect(state=> ({
+        searchResult: state.search}),
+    {
+        onSearch: actionFullGoodFind,
+        onSearchRemove: actionSearchRemove})
+(FindGoodEdit)

+ 13 - 5
src/pages/AdminPage/GoodsTab/GoodEdit.jsx

@@ -13,7 +13,7 @@ import {connect} from "react-redux";
 import {actionAllCategory} from "../../../actions/ActionCategory";
 import {actionGoodUpsert} from "../../../actions/ActionCreateGood";
 import {actionGoodCount} from "../../../actions/ActionGoodFind";
-import {actionUploadFile, actionUploadFiles} from "../../../actions/ActionUploadFile";
+import {actionUploadFiles} from "../../../actions/ActionUploadFile";
 import {actionClearPromise} from "../../../reducers/PromiseReducer";
 
 const GoodEdit = ({entity={images: [], categories: []},
@@ -393,7 +393,15 @@ const GoodEdit = ({entity={images: [], categories: []},
     )
 }
 
-export const CGoodEdit = connect(state => ({fileStatus: state.promise['uploadFile'],
-        categoryState: state.promise['allCategory'], goods: state.promise['goodCount'], result: state.promise['goodUpsert']}),
-    {actionRootCat: actionAllCategory, onSave: actionGoodUpsert, goodCount:  actionGoodCount,
-        onFileDrop: actionUploadFiles, actionClear: actionClearPromise})(GoodEdit)
+export const CGoodEdit = connect(state => ({
+        fileStatus: state.promise['uploadFile'],
+        categoryState: state.promise['allCategory'],
+        goods: state.promise['goodCount'],
+        result: state.promise['goodUpsert']}),
+    {
+        actionRootCat: actionAllCategory,
+        onSave: actionGoodUpsert,
+        goodCount:  actionGoodCount,
+        onFileDrop: actionUploadFiles,
+        actionClear: actionClearPromise})
+(GoodEdit)

+ 24 - 5
src/pages/CartPage/CartPage.jsx

@@ -15,7 +15,16 @@ import {CBlockTotal} from "./BlockTotal";
 import {AccordionItem} from "../MyOrdersPage/AccordionItem";
 import {actionOrderFindOne} from "../../actions/ActionOrderFind";
 
-const CartPage = ({order, cart, finalOrder, onCardChange, onCartClear, onCartRemove, onOrderUpsert, actionClearOrder, onOrderFind}) => {
+const CartPage = ({   order,
+                      cart,
+                      finalOrder,
+                      onCardChange,
+                      onCartClear,
+                      onCartRemove,
+                      onOrderUpsert,
+                      actionClearOrder,
+                      onOrderFind}) => {
+
     const matches = useMediaQuery('(max-width:768px)')
     const [showDetails, setShowDetails] = useState(false)
 
@@ -23,6 +32,7 @@ const CartPage = ({order, cart, finalOrder, onCardChange, onCartClear, onCartRem
     for (const key of Object.values(cart)) {
         rows.push(key)
     }
+
     useEffect(() => {
         if (order && Object.entries(order).length > 0) {
             actionClearOrder('order')
@@ -33,7 +43,7 @@ const CartPage = ({order, cart, finalOrder, onCardChange, onCartClear, onCartRem
     return (
         <>
             <Breadcrumb links={['cart']}/>
-            {Object.values(cart).length > 0 || order ?
+            {cart && Object.values(cart).length > 0 || order ?
                 <main
                     style={{
                         backgroundColor: "#f3f3f3",
@@ -174,7 +184,16 @@ const CartPage = ({order, cart, finalOrder, onCardChange, onCartClear, onCartRem
         </>
     )
 }
-export const CCartPage = connect(state => ({cart: state.cart, order: state.promise?.order,
+
+export const CCartPage = connect(state => ({
+        cart: state.cart,
+        order: state.promise?.order,
         finalOrder: state.promise['orderFindOne']}),
-    {onCardChange: actionCardChange, onCartClear: actionCardClear, onCartRemove: actionCardRemove,
-        onOrderUpsert: ActionFullOrder, actionClearOrder: actionClearPromise, onOrderFind: actionOrderFindOne})(CartPage)
+    {
+        onCardChange: actionCardChange,
+        onCartClear: actionCardClear,
+        onCartRemove: actionCardRemove,
+        onOrderUpsert: ActionFullOrder,
+        actionClearOrder: actionClearPromise,
+        onOrderFind: actionOrderFindOne})
+(CartPage)

+ 6 - 3
src/pages/Catalog/CatalogPage.jsx

@@ -2,7 +2,7 @@ import {Container, Grid, useMediaQuery} from "@mui/material";
 import {useEffect} from "react";
 import Breadcrumb from "../../components/Breadcrumbs";
 import {connect} from "react-redux";
-import {actionFullAllCategory, actionFullRootCats} from "../../actions/ActionCategory";
+import {actionFullRootCats} from "../../actions/ActionCategory";
 import {CategoryAside} from "./CategoryAside";
 import {Products} from "./Goods";
 
@@ -36,5 +36,8 @@ const CatalogPage = ({category={}, actionRootCat}) => {
         </>
     )
 }
-export const CCatalogPage = connect(state => ({category: state.category}),
-    {actionRootCat: actionFullRootCats})(CatalogPage)
+export const CCatalogPage = connect(state => ({
+        category: state.category}),
+    {
+        actionRootCat: actionFullRootCats})
+(CatalogPage)

+ 14 - 6
src/pages/Catalog/Goods.jsx

@@ -137,9 +137,16 @@ const GoodCard = ({good:{_id, name, description, price, images}={},
         </Grid>
     )
 }
-const CGoodCard = connect(state => ({wishlist: state.wishlist, cart: state.cart}),
-    {onCartAdd: actionCartAdd, onWishListAdd: actionWishListAdd, onCartRemove: actionCardRemove,
-        onWishListRemove: actionWishListRemove})(GoodCard)
+
+const CGoodCard = connect(state => ({
+        wishlist: state.wishlist,
+        cart: state.cart}),
+    {
+        onCartAdd: actionCartAdd,
+        onWishListAdd: actionWishListAdd,
+        onCartRemove: actionCardRemove,
+        onWishListRemove: actionWishListRemove})
+(GoodCard)
 
 const Goods = ({_id, category={}}) => {
     const itemsPerPage = 9
@@ -191,8 +198,9 @@ const Goods = ({_id, category={}}) => {
                     else if(Array.isArray(subItem['subCategories'])) {
                         let arr = subItem['subCategories'].map(subSubItem => {
                             if (subSubItem['_id'] === _id) {
-                                if (Array.isArray(subSubItem?.goods && subSubItem?.goods.length > 0)) {
+                                if (Array.isArray(subSubItem?.goods) && subSubItem?.goods.length > 0) {
                                     setCount(Math.ceil(subSubItem.goods.length / itemsPerPage))
+                                    console.log(subSubItem.goods)
                                     return subSubItem.goods
                                 }
                             }
@@ -217,7 +225,7 @@ const Goods = ({_id, category={}}) => {
 
     return (
         <>
-            {(goods.length > 0 ?
+            {(goods.length > 0 && goods[0] !== undefined ?
                 <Box
                     sx={{height:'100%',
                         display: 'flex',
@@ -236,7 +244,7 @@ const Goods = ({_id, category={}}) => {
                             color='#616161'
                             letterSpacing='1px'
                         >
-                            SHOWING {goods[0].length > itemsPerPage ? `${((page-1) * itemsPerPage)+1}-
+                            SHOWING {goods[0].length > itemsPerPage ? `${((page-1) * itemsPerPage)+1} -
                             ${page * itemsPerPage > goods[0].length ? goods[0].length : page * itemsPerPage}` :
                             goods[0].length} OF {goods[0].length} RESULTS
                         </Typography>

+ 10 - 3
src/pages/MyAccountPage/MyAccountPage.jsx

@@ -94,8 +94,15 @@ const MyAccountPage = ({auth, promise, user, onLogin, onRegister, onClear}) => {
         </>
     )
 }
-const CLoginForm = connect(state => ({auth: state.auth, promise: state.promise, user: state.user}),
-    {onLogin: actionFullLogin, onRegister: actionFullRegister,
-        onClear: actionClearPromise})(MyAccountPage)
+
+const CLoginForm = connect(state => ({
+        auth: state.auth,
+        promise: state.promise,
+        user: state.user}),
+    {
+        onLogin: actionFullLogin,
+        onRegister: actionFullRegister,
+        onClear: actionClearPromise})
+(MyAccountPage)
 
 export default CLoginForm

+ 10 - 4
src/pages/MyOrdersPage/MainOrders.jsx

@@ -86,7 +86,13 @@ const MainOrders = ({itemsPerPage=100,
         </>
     )
 }
-export const CMainOrders = connect(state => ({orders: state.myorders,
-        ordersPreload: state.promise['orderFind'], orderCount: state.promise['orderCount']}),
-    {onFindOrders: actionFullOrderFind, onOrdersClear: actionMyOrderClear,
-        onGetCountOrder: actionOrderCount})(MainOrders)
+
+export const CMainOrders = connect(state => ({
+        orders: state.myorders,
+        ordersPreload: state.promise['orderFind'],
+        orderCount: state.promise['orderCount']}),
+    {
+        onFindOrders: actionFullOrderFind,
+        onOrdersClear: actionMyOrderClear,
+        onGetCountOrder: actionOrderCount})
+(MainOrders)

+ 5 - 2
src/pages/ProductPage/AddToCart.jsx

@@ -50,5 +50,8 @@ const AddToCart = ({cart, good, addToCart}) => {
         </Box>
     )
 }
-export const CAddToCart = connect(state=>({cart: state.cart}),
-    {addToCart: actionCardChange})(AddToCart)
+export const CAddToCart = connect(state=> ({
+        cart: state.cart}),
+    {
+        addToCart: actionCardChange})
+(AddToCart)

+ 7 - 2
src/pages/ProductPage/AddToWishList.jsx

@@ -37,5 +37,10 @@ const AddToWishList = ({good={}, wishlist ,onAddToWishList, onWishListRemove}) =
         </Button>
     )
 }
-export const CAddToWishList = connect(state => ({wishlist: state.wishlist}),
-    {onAddToWishList: actionWishListAdd, onWishListRemove: actionWishListRemove})(AddToWishList)
+
+export const CAddToWishList = connect(state => ({
+        wishlist: state.wishlist}),
+    {
+        onAddToWishList: actionWishListAdd,
+        onWishListRemove: actionWishListRemove})
+(AddToWishList)

+ 2 - 1
src/pages/ProductPage/BlockProduct.jsx

@@ -27,4 +27,5 @@ const BlockProduct = ({match:{params:{_id}}, getData}) => {
     )
 }
 export const CBlockProduct = connect(null,
-    {getData: actionGoodFindOne})(BlockProduct)
+    {getData: actionGoodFindOne})
+(BlockProduct)

+ 5 - 2
src/pages/ProfilePage/FormUpload.jsx

@@ -108,5 +108,8 @@ const FormUpload = ({user, setStatus, setUserUpsert, setImage}) => {
     )
 }
 export const CFormUpload = connect(null,
-    {setUserUpsert: actionSetUserUpsert,
-        setImage: actionSetAvatar, userUpdate: actionFullUserFindOne})(FormUpload)
+    {
+        setUserUpsert: actionSetUserUpsert,
+        setImage: actionSetAvatar,
+        userUpdate: actionFullUserFindOne})
+(FormUpload)

+ 8 - 2
src/pages/ProfilePage/ProfilePage.jsx

@@ -174,6 +174,12 @@ const ProfilePage = ({user = {}, promise, authLogOut, userLogOut}) => {
         </>
     )
 }
-export const CProfilePage = connect(state => ({user: state.user, promise: state.promise}),
-    {authLogOut: actionAuthLogout, userLogOut: actionUserRemove})(ProfilePage)
+
+export const CProfilePage = connect(state => ({
+        user: state.user,
+        promise: state.promise}),
+    {
+        authLogOut: actionAuthLogout,
+        userLogOut: actionUserRemove})
+(ProfilePage)
 

+ 1 - 1
src/pages/SearchPage/ItemFound.jsx

@@ -60,7 +60,7 @@ export const ItemFound = ({item:{_id, name, price, images, description}}) => {
                     margin='10px 0'
                 >
                     {
-                        description.length > 60 ?
+                        description && description.length > 60 ?
                             'Lorem ipsum dolor sit amet, consectetur adipisicing elit.'
                             : description
                     }

+ 7 - 2
src/pages/SearchPage/SearchPage.jsx

@@ -84,6 +84,11 @@ const SearchPage = ({searchResult, onSearch, onSearchRemove}) => {
         </>
     )
 }
-const CSearchPage = connect(state => ({searchResult: state.search}),
-    {onSearch: actionFullGoodFind, onSearchRemove: actionSearchRemove})(SearchPage)
+const CSearchPage = connect(state => ({
+        searchResult: state.search}),
+    {
+        onSearch: actionFullGoodFind,
+        onSearchRemove: actionSearchRemove})
+(SearchPage)
+
 export default CSearchPage

+ 7 - 2
src/pages/WishListPage/MainWishList.jsx

@@ -67,5 +67,10 @@ const MainWishList = ({wishlist, addToCart, onWishListRemove, color='#f3f3f3'})
         </>
     )
 }
-export const CMainWishList = connect(state => ({wishlist: state.wishlist}),
-    {addToCart: actionCardChange, onWishListRemove: actionWishListRemove})(MainWishList)
+
+export const CMainWishList = connect(state => ({
+        wishlist: state.wishlist}),
+    {
+        addToCart: actionCardChange,
+        onWishListRemove: actionWishListRemove})
+(MainWishList)