|
@@ -1,23 +1,33 @@
|
|
|
-import {CUpdateForm} from "./index";
|
|
|
+import {CUpdateForm, CUsersList, SearchUserInput} from "./index";
|
|
|
import {gql, urlUpload, actionPromise, actionGoodCard, getGoods,
|
|
|
actionUserFindOne, updateImgAction} from "../reducers";
|
|
|
import {createStore, combineReducers, applyMiddleware, bindActionCreators} from 'redux';
|
|
|
import { connect } from "react-redux";
|
|
|
import { useEffect, useState, useRef } from "react";
|
|
|
|
|
|
+import {BrowserRouter as Router, Route, Link, Switch, Redirect, useHistory} from 'react-router-dom';
|
|
|
+
|
|
|
|
|
|
const YourProfile = ({state, data, getData, match:{params:{login}}}) => {
|
|
|
useEffect(() => getData(`${login}`),[login])
|
|
|
const date = new Date(data ? +data.createdAt : 0);
|
|
|
const [showUpdate, onShow] = useState(false);
|
|
|
- const [isUpdate, onUpdate] = useState(false);
|
|
|
+ const [searchInput, changeValue] = useState("Пошук");
|
|
|
+ const history = useHistory();
|
|
|
//console.log(data)
|
|
|
if(data){
|
|
|
return (
|
|
|
<>
|
|
|
+ <div className = "userSearch">
|
|
|
+ <input type = "text" placeholder = "Пошук юзера" onChange = {e => changeValue(e.target.value)} onKeyDown = {(e) => e.keyCode == 13 && history.push(`/searchUser/${searchInput}`)}/>
|
|
|
+ <Link to = {"/searchUser/" + searchInput}>
|
|
|
+ <button>Пошук</button>
|
|
|
+ </Link>
|
|
|
+ </div>
|
|
|
+
|
|
|
<div className = "profilePage">
|
|
|
<h2>Привіт, {data.nick || "людино"}!</h2>
|
|
|
- <img src={data.avatar ? data.avatar : 'https://pngicon.ru/file/uploads/picca-1.png'} />
|
|
|
+ <img src={data.avatar ? `${urlUpload}/${data.avatar.url}`: 'https://pngicon.ru/file/uploads/picca-1.png'} />
|
|
|
<span>
|
|
|
Сторінку створено {`${date.getDate()}. ${date.getMonth() + 1}. ${date.getFullYear()} о ${date.getHours()}: ${date.getMinutes()}: ${date.getSeconds()} `}
|
|
|
</span>
|
|
@@ -48,21 +58,12 @@ const mapStateToProps = state => ({
|
|
|
data: state.promiseRed && state.promiseRed.user &&
|
|
|
state.promiseRed.user.payload && state.promiseRed.user.payload.data &&
|
|
|
state.promiseRed.user.payload.data.UserFindOne
|
|
|
- // basket: state.basket,
|
|
|
- // GoodsArr: arrFromObj(ObjFilter(state.basket, "price")),
|
|
|
- // order: orderArr(arrFromObj(ObjFilter(state.basket, "price"))),
|
|
|
- // orderDone: state.promiseRed && state.promiseRed.order &&
|
|
|
- // state.promiseRed.order.payload &&
|
|
|
- // state.promiseRed.order.payload.data.OrderUpsert
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const mapDispatchToProps = dispatch => bindActionCreators({
|
|
|
getData: actionUserFindOne,
|
|
|
- // onDel: actionCartDelete,
|
|
|
- // onClear: actionCartClear,
|
|
|
- // onOrder: actionOrder
|
|
|
}, dispatch);
|
|
|
|
|
|
const CYourProfile = connect(mapStateToProps, mapDispatchToProps)
|