maryluis 3 anos atrás
pai
commit
f79897aa8b

BIN
shop/public/favicon.ico


+ 1 - 1
shop/public/index.html

@@ -2,7 +2,7 @@
 <html lang="en">
   <head>
     <meta charset="utf-8" />
-    <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
+    <link rel="icon" src="/public/favicon.ico" />
     <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
     <meta name="viewport" content="width=device-width, initial-scale=1" />
     <meta name="theme-color" content="#000000" />

+ 6 - 2
shop/src/App.css

@@ -8,6 +8,9 @@ a {
   text-decoration: none;
   color: rgb(229, 229, 243);
 }
+a:hover {
+  color: rgb(229, 229, 243);
+}
 input {
   background-color: rgb(229, 229, 243);
   border-radius: 10%;
@@ -357,7 +360,7 @@ button {
   border-color:rgb(229, 229, 243);
   border-radius: 5%;
   width: 400px;
-  height: 250px;
+  height: 280px;
 }
 
 .basketNoGoods {
@@ -372,7 +375,7 @@ button {
   border-color:rgb(229, 229, 243);
   border-radius: 5%;
   width: 400px;
-  height: 250px;
+  height: 280px;
 }
 
 
@@ -577,6 +580,7 @@ button {
 
 .basketNoGoods {
   width: 100%;
+  height: auto;
 }
 
 

+ 3 - 2
shop/src/App.js

@@ -1,9 +1,10 @@
 
 import './App.css';
+import history from "./reducers/history"
 import {Provider, connect} from 'react-redux';
 import {Header, Footer, actionCatalogCard, Main, SearchInput} from "./components/index"
 import {BrowserRouter as Router, Route, Link, Switch, Redirect} from 'react-router-dom';
-import createHistory from "history/createBrowserHistory";
+// import createHistory from "history/createBrowserHistory";
 import {Catalog, UpdateForm} from "./components/"
 import {createStore, combineReducers, applyMiddleware, compose} from 'redux';
 import thunk from 'redux-thunk';
@@ -22,7 +23,7 @@ function App() {
   return (
     <>
       <Provider store={store}>
-        <Router history = {createHistory}>
+        <Router history = {history}>
           <Header/>
           <Main/>
           <Footer/>

+ 37 - 7
shop/src/components/Main.js

@@ -1,5 +1,5 @@
 import {BrowserRouter as Router, Route, Link, Switch, Redirect, useHistory} from 'react-router-dom';
-import createHistory from "history/createBrowserHistory";
+// import createHistory from "history/createBrowserHistory";
 import { useState } from 'react';
 import {Provider, connect} from 'react-redux';
 import {createStore, combineReducers, applyMiddleware} from 'redux';
@@ -33,7 +33,7 @@ const Main = ({className = "MainImg" }) => {
 
                 <content>
                     <Switch>
-                        <Route path = "/" component = {MainMag} exact/>
+                        <Route path = "/" component = {About} exact/>
                         <Route path = "/catalog/" component={MainCatalog} exact/>
                         <Route path = "/catalog/:id" component= {({match}) => <CGoodsCategory id = {match.params.id} /> }/>
                         <Route path = "/search/:name" component = {({match}) => <CGoodsSearch name = {match.params.name}/>}/>
@@ -45,7 +45,7 @@ const Main = ({className = "MainImg" }) => {
                         <Route path = "/user/:_id" component = {CYourProfile}/>
                         <Route path = "/basket" component = {CBasketPage}/>
                         <Route path="/about" component = {About} exact/>
-                        <Route path = "/post" component = {Post} exact/>
+                        {/* <Route path = "/post" component = {Post} exact/> */}
                         <Route path = "/contacts" component = {Contacts} />
                         <Route path = "/loginError" component={LoginError} />
                         <Route component = { NotFound } exact/>
@@ -73,11 +73,41 @@ const LoginError = () => {
         </>
     )}
 const MainMag = () => <div>Я тут кароче самый главный страниц</div>
-const About = () => <div>Мы крутой магазин, бла-бла</div>
-const NotFound = () => <div> <h5 className = "profilePage">Ой, щось пішло не так. Мабудь цієї сторінки немає, або сталася помилка. Спробуйте ще.</h5></div>
-const MainCatalog = () => <div>Chose</div>
+const About = () => 
+    <div className = "basketNoGoods">
+
+            <h4>Ласкаво просимо до нашого магазину!</h4>
+            <p>
+                Серед наших товарів ви знайдете що пожувати, де сховати залишки продуктів, та на чому подивитись кіно.
+            </p>
+            <p>
+                Так, саме так, у нас є техніка та смаколики, бо ми хазяйновиті та любимо смачно поїсти.
+            </p>
+            <p>
+                Щоб зробити замовлення перейдіть до каталогу, або скористуйтеся пошуком.
+            </p>
+
+    </div>
+const NotFound = () => {
+    return(
+        <>
+            <div className = "basketNoGoods">
+                <h4>Упс, сторінку не знайдено, або сталася помилка</h4>
+            </div>
+        </>
+    )
+}
+{/* <div> <h5 className = "profilePage">Ой, щось пішло не так. Мабудь цієї сторінки немає, або сталася помилка. Спробуйте ще.</h5></div> */}
+const MainCatalog = () => <div></div>
 const Post = () => <div className = "post">Точно не знаю зачем это, возможно потом уберу. Но в некоторых магазинах есть такое</div>
-const Contacts = () => <div className = "contacts">Тут будет адрес, номер телефона и соцсети</div>
+const Contacts = () => 
+    <div className = "order">
+        <h4>Як ви нас зможете знайти:</h4>
+        <p>Номер телефону: + 38 068 811 3262</p>
+        <p>Ми в instagram: <a href = "https://www.instagram.com/alevelua/?hl=ru" target="_blank">alevelua </a> </p>
+        <p>Ми у Facebook: <a href = "https://www.facebook.com/alevelukraine" target="_blank"> https://www.facebook.com/alevelukraine </a></p>
+        <p>Адреса: пл. Павловская 6, 2й этаж Харьков, Харьковская область, Украина 61022</p>
+    </div>
   
 
 export default Main;

+ 7 - 5
shop/src/components/catalog.js

@@ -10,7 +10,7 @@ const CatalogSubLink = ({name, arr}) => {
     const [show, changeValue] = useState(false);
     return(
         <li><span  onClick = {() =>changeValue(!show)}>{name} </span>{<ul className="subCatalog">{ show && arr.map(key =>
-            <Links className = {"subLink"} key={key._id} url={`/catalog/` + key._id} text={key.name}> </Links>)}</ul>}</li>
+            <Links className = {"subLink"} key={`${key._id}${Math.random()}`} url={`/catalog/` + key._id} text={key.name}> </Links>)}</ul>}</li>
 
     )
 }
@@ -21,19 +21,21 @@ const Catalog = ({ state, categories = [], getData = () => console.log("no") })
 
 
     return (
-        <>
+        
             <ul className="catalog">
                 {categories.map(category =>
+                
                     category.subCategories == null ?
-                        <Links key={category._id} url={`/catalog/` + category._id} text={category.name}> </Links> :
+                    
+                        <Links key={`${category._id}${Math.random()}`} url={`/catalog/` + category._id} text={category.name}> </Links> :
 
-                         <CatalogSubLink name = {category.name} arr = {category.subCategories}/>
+                         <CatalogSubLink name = {category.name} key = {`${category.subCategories._id}${Math.random()}`}arr = {category.subCategories}/>
 
 
 
                 )}
             </ul>
-        </>
+        
     )
 }
 

+ 5 - 5
shop/src/components/goodCard.js

@@ -1,5 +1,5 @@
 import { connect } from "react-redux";
-import {gql, urlUpload, actionPromise, actionGoodCard, getGoods, actionCartAdd} from "../reducers";
+import {gql, urlUpload, actionPromise, actionGoodCard, getData, actionCartAdd} from "../reducers";
 import {createStore, combineReducers, applyMiddleware, bindActionCreators} from 'redux';
 import { useEffect, useState } from 'react';
 import {BrowserRouter as Router, Route, Link, Switch, Redirect, useHistory} from 'react-router-dom';
@@ -11,11 +11,11 @@ import {BrowserRouter as Router, Route, Link, Switch, Redirect, useHistory} from
   const mapStateToProps = state => ({
     state: state,
     basket: state.basket,
-    goodCard: getGoods(state, "goodCard", "GoodFindOne")
+    goodCard: getData(state, "goodCard", "GoodFindOne")
   });
   
   const mapDispatchToProps = dispatch => bindActionCreators({
-    getData: actionGoodCard,
+    getGood: actionGoodCard,
     onAdd: actionCartAdd
 
   }, dispatch);
@@ -26,9 +26,9 @@ import {BrowserRouter as Router, Route, Link, Switch, Redirect, useHistory} from
 
 
 
-  const GoodCard = ({id, goodCard = null, state, onAdd, getData, className = "goodCard"}) => {
+  const GoodCard = ({id, goodCard = null, getGood, state, onAdd, getData, className = "goodCard"}) => {
     const history = useHistory();
-    useEffect(() =>  getData(id), [id]);
+    useEffect(() =>  getGood(id), [id]);
     //console.log(state)
 
 

+ 2 - 2
shop/src/components/goodsCategory.js

@@ -2,7 +2,7 @@ import {Provider, connect} from 'react-redux';
 import {createStore, combineReducers, applyMiddleware, bindActionCreators} from 'redux';
 import thunk from 'redux-thunk';
 import {actionPromise} from "./index"
-import {gql, actionGoods, getGoods, actionCartAdd} from "../reducers/index";
+import {gql, actionGoods, getData, actionCartAdd} from "../reducers/";
 import { useEffect } from 'react';
 import {OneGood, CGoodsList} from "./index";
 
@@ -10,7 +10,7 @@ import {OneGood, CGoodsList} from "./index";
   
   const mapStateToProps = state => ({
     state: state,
-    goods: getGoods(state, "goods", "GoodFind"),
+    goods: getData(state, "goods", "GoodFind"),
 
   });
   

+ 9 - 9
shop/src/components/goodsList.js

@@ -1,12 +1,12 @@
 import {OneGood, GoodsNotFound} from "./index";
 import {createStore, combineReducers, applyMiddleware, bindActionCreators} from 'redux';
-import {getData, getGoods, actionGoods, urlUpload} from "../reducers";
+import {getData, actionGoods, urlUpload} from "../reducers/index";
 import {Provider, connect} from 'react-redux';
 
 
   const mapStateToProps = state => ({
     state: state,
-    arr: getGoods(state),
+    arr: getData(state),
     // search: getGoods(state)
   });
   
@@ -29,14 +29,14 @@ const GoodsList = ({arr = [], className = "goods", onAdd}) => {
   return (
     <div className = {className}>          
       {arr.map((good) => 
-      <>
-      <div className = "oneGood">
-      <OneGood key = {good._id} id = {good._id} name = {good.name} price = {good.price} image = {good.images ? `${urlUpload}/${good.images[0].url}` : `https://images.ua.prom.st/2259265311_korobka-syurpriz-dlya.jpg`}/>
-      <div>
+      
+      <div key = {`${Math.random}${good._id}`}className = "oneGood">
+        <OneGood  id = {good._id} name = {good.name} price = {good.price} image = {good.images ? `${urlUpload}/${good.images[0].url}` : `https://images.ua.prom.st/2259265311_korobka-syurpriz-dlya.jpg`}/>
+        <div>
             <button onClick = {() => onAdd(good.name, good.price, good._id,  good.description, good.images)}>В кошик</button>
-          </div>
-          </div>
-      </>
+        </div>
+      </div>
+      
       )}
 
     </div>

+ 2 - 2
shop/src/components/goodsListSearch.js

@@ -1,12 +1,12 @@
 import {OneGood} from "./index";
 import {createStore, combineReducers, applyMiddleware, bindActionCreators} from 'redux';
-import {getData, getGoods, actionGoods, getSearchedGoods, actionSearch} from "../reducers";
+import {getData, actionGoods, getSearchedGoods, actionSearch} from "../reducers";
 import {Provider, connect} from 'react-redux';
 import {GoodsNotFound } from "./index";
 
 const mapStateToProps = state => ({
     state: state,
-    search: getGoods(state, "search")
+    search: getData(state, "search")
   });
   
   const mapDispatchToProps = dispatch => bindActionCreators({

+ 2 - 2
shop/src/components/goodsSearch.js

@@ -2,14 +2,14 @@ import {Provider, connect} from 'react-redux';
 import {createStore, combineReducers, applyMiddleware, bindActionCreators} from 'redux';
 import thunk from 'redux-thunk';
 import {actionPromise} from "./index"
-import {gql, actionGoods, getGoods, actionSearch, actionCartAdd} from "../reducers/index";
+import {gql, actionGoods, getData, actionSearch, actionCartAdd} from "../reducers/index";
 import { useEffect } from 'react';
 import {OneGood, CGoodsList} from "./index";
 
 
 const mapStateToProps = state => ({
     state: state,
-    search: getGoods(state, "search", "GoodFind")
+    search: getData(state, "search", "GoodFind")
   });
   
   const mapDispatchToProps = dispatch => bindActionCreators({

+ 2 - 2
shop/src/components/header.js

@@ -2,7 +2,7 @@ import {Footer, Links} from "./index"
 import {BrowserRouter as Router, Route, Link, Switch, Redirect, useHistory} from 'react-router-dom';
 import {Provider, connect} from 'react-redux';
 import React, {Component, useState, useEffect} from 'react';
-import createHistory from "history/createBrowserHistory";
+// import createHistory from "history/createBrowserHistory";
 import {actionAuthLogout} from "../reducers"
 import {createStore, combineReducers, applyMiddleware} from 'redux';
 import thunk from 'redux-thunk';
@@ -21,7 +21,7 @@ const StandartMenu = ({className = "standartMenu", getCat = null}) => {
 
                 <Links url = {"/catalog"} text = {"Каталог"}/>
                 <Links url = {"/about"} text = {"Про нас"}/>
-                <Links url = {"/post"} text = {"Оплата і доставка"}/>
+                {/* <Links url = {"/post"} text = {"Оплата і доставка"}/> */}
                 <Links url = {"/contacts"} text = {"Контакти"}></Links>
 
             </ul>

+ 1 - 1
shop/src/components/index.js

@@ -1,6 +1,6 @@
 import React, { useState } from 'react';
 import {BrowserRouter as Router, Route, Link, Switch, Redirect} from 'react-router-dom';
-import createHistory from "history/createBrowserHistory";
+// import createHistory from "history/createBrowserHistory";
 import {createStore, combineReducers, applyMiddleware} from 'redux';
 import Header from "./header";
 import Footer from "./footer";

+ 1 - 1
shop/src/components/links.js

@@ -4,7 +4,7 @@ import {BrowserRouter as Router, Route, Link, Switch, Redirect} from 'react-rout
 const Links = ({url, text, className = "links"}) => {
     return (
 
-            <Link className = {className} to={url}><li>{text}</li></Link>
+            <Link className = {className} to={url}><li key = {`${url}${Math.random() || Math.random()}`}>{text}</li></Link>
 
     )
 }

+ 1 - 1
shop/src/components/oneGood.js

@@ -1,6 +1,6 @@
 import {BrowserRouter as Router, Route, Link, Switch, Redirect} from 'react-router-dom';
 
-const OneGood = ({className = "oneGoodInner", image, name, price, id}) => {
+const OneGood = ({className = "oneGoodInner", image,  name, price, id}) => {
 
     return (
       <>

Diferenças do arquivo suprimidas por serem muito extensas
+ 24 - 34
shop/src/components/profilePage.js


Diferenças do arquivo suprimidas por serem muito extensas
+ 5 - 5
shop/src/components/usersList.js


+ 1 - 1
shop/src/reducers/actionUserUpdate.js

@@ -9,7 +9,7 @@ const actionUserUpdate = (data) => {
                 user: data
             }
         )
-        await dispatch(actionPromise('user', gql(
+        await dispatch(actionPromise('NewUser', gql(
             `mutation updateMe($user:UserInput){
                 UserUpsert(user: $user){
                   _id

+ 2 - 2
shop/src/reducers/getGoods.js

@@ -1,7 +1,7 @@
 
 
 
-  const getGoods = (state, key, funk) => {
+  const getData = (state, key, funk) => {
   //debugger
     if(state.promiseRed[key] && state.promiseRed[key].payload) {
         return state.promiseRed[key].payload.data[funk]
@@ -10,4 +10,4 @@
     return [];
   };
 
-  export default getGoods;
+  export default getData;

+ 3 - 0
shop/src/reducers/history.js

@@ -0,0 +1,3 @@
+import {createBrowserHistory} from "history";
+
+export default createBrowserHistory();

+ 2 - 2
shop/src/reducers/index.js

@@ -3,7 +3,7 @@ import thunk from 'redux-thunk';
 import actionPromise from "./actionPromise";
 import {gql, urlUpload} from "./gql";
 import actionGoods from "./actionGoods"
-import getGoods from "./getGoods";
+import getData from "./getData";
 import {actionSearch} from "./actionsearch";
 import actionLogin from "./actionLogin";
 import authReducer from "./authReducer";
@@ -38,7 +38,7 @@ function promiseReducer(state={}, action){
       basket: cartReducer
   }), compose(applyMiddleware(thunk)))
 
-export {actionPromise, gql, actionGoods, getGoods, promiseReducer, store, actionSearch,
+export {actionPromise, gql, actionGoods, getData, promiseReducer, store, actionSearch,
    actionLogin, authReducer, actionAuthLogin, actionAuthLogout, urlUpload, actionGoodCard, 
    updateImgAction, actionCartAdd, actionCartDelete, actionCartClear, actionOrder,
     actionReg, actionUserFindOne, actionUserUpdate, actionSearchUser};