|
@@ -1,10 +1,309 @@
|
|
|
|
+// import { url } from "../../App"
|
|
|
|
+
|
|
|
|
+// import React, { useContext, useState } from 'react';
|
|
|
|
+// import { useHistory, useParams } from 'react-router-dom';
|
|
|
|
+// import { useDispatch, useSelector } from 'react-redux';
|
|
|
|
+
|
|
|
|
+// import { CardContent, Typography, Stack, Avatar, Box, Container, Badge, TextField, InputAdornment, IconButton } from '@mui/material';
|
|
|
|
+// import Button from '@mui/material-next/Button';
|
|
|
|
+// import { PersonRemoveRounded, PersonAddRounded, ManageAccountsRounded, BorderColorRounded, ImageSearchRounded, AccountCircle, HttpsRounded } from '@mui/icons-material';
|
|
|
|
+// import { actionUserPageSubscribing } from "../../redux/thunks";
|
|
|
|
+
|
|
|
|
+// import ModalWindow from '../structure/modal';
|
|
|
|
+// import ChangeData from "./change_data";
|
|
|
|
+// import { ModalForCountsContext, UpdateProfile } from "../../App";
|
|
|
|
+
|
|
|
|
+// import { EditProfile } from ".";
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// // Функция отображения кнопки редактирования своего профиля/отписки или подписки на другого юзера
|
|
|
|
+// function UptadeProfileButton({ data }) {
|
|
|
|
+// // console.log('UserData: ', data)
|
|
|
|
+
|
|
|
|
+// const history = useHistory()
|
|
|
|
+// const { userId } = useParams()
|
|
|
|
+// const dispatch = useDispatch()
|
|
|
|
+
|
|
|
|
+// // отслеживание нажатия кнопки редактирования профиля
|
|
|
|
+// const [isEditProfile, setIsEditProfile] = useContext(EditProfile)
|
|
|
|
+
|
|
|
|
+// // контекст обновления профиля
|
|
|
|
+// const [updateProfile, setUpdateProfile] = useContext(UpdateProfile)
|
|
|
|
+// // console.log('updateProfile: ', updateProfile)
|
|
|
|
+
|
|
|
|
+// // определяем мой id
|
|
|
|
+// const myId = updateProfile?._id
|
|
|
|
+
|
|
|
|
+// // определяем всех моих подписчиков
|
|
|
|
+// const myFollowingList = updateProfile?.following?.map(user => user?._id)
|
|
|
|
+
|
|
|
|
+// // проверка, является ли пользователь моим подписчиком
|
|
|
|
+// const isFollowing = myFollowingList && (myFollowingList)?.some(item => item === (data?.owner?._id || data?._id))
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// // функция подписки/отписки - это чисто кнопка
|
|
|
|
+// function isSubscribing() {
|
|
|
|
+
|
|
|
|
+// // при клике на посте
|
|
|
|
+// const newData = {
|
|
|
|
+// ...updateProfile, following: (isFollowing
|
|
|
|
+// ? updateProfile?.following?.filter(item => item?._id !== (data?.owner?._id || data?._id)) // отписка
|
|
|
|
+// // : [...updateProfile?.following, { _id: (data?.owner?._id || data?._id) }] // подписка
|
|
|
|
+// : updateProfile?.following
|
|
|
|
+// ? [...updateProfile?.following, { _id: (data?.owner?._id || data?._id) }] // подписка если уже есть кто-то в подписках
|
|
|
|
+// : [{ _id: (data?.owner?._id || data?._id) }] // подписка, если это первая подписка
|
|
|
|
+// )
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// dispatch(actionUserPageSubscribing(newData, userId))
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// // функция перехода на редактирование профиля
|
|
|
|
+// function upsertProfile() {
|
|
|
|
+// // history.push('/updateprofile')
|
|
|
|
+// setIsEditProfile(true)
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// return (
|
|
|
|
+// <Box
|
|
|
|
+// onClick={
|
|
|
|
+// (userId === myId && upsertProfile) ||
|
|
|
|
+// (myFollowingList?.includes(userId) && isSubscribing) ||
|
|
|
|
+// ((userId !== myId && !myFollowingList?.includes(userId)) && isSubscribing)}
|
|
|
|
+// >
|
|
|
|
+// <Button
|
|
|
|
+// size="large"
|
|
|
|
+// // variant="elevated"
|
|
|
|
+// variant={
|
|
|
|
+// ((userId === myId) && 'elevated') ||
|
|
|
|
+// ((myFollowingList?.includes(userId)) && 'elevated') ||
|
|
|
|
+// ((userId !== myId && !myFollowingList?.includes(userId)) && 'filledTonal')
|
|
|
|
+// }
|
|
|
|
+// sx={{
|
|
|
|
+// minWidth: '300px'
|
|
|
|
+// }}
|
|
|
|
+// startIcon={
|
|
|
|
+// ((userId === myId) && <ManageAccountsRounded />) ||
|
|
|
|
+// ((myFollowingList?.includes(userId)) && <PersonRemoveRounded />) ||
|
|
|
|
+// ((userId !== myId && !myFollowingList?.includes(userId)) && <PersonAddRounded />)
|
|
|
|
+// }
|
|
|
|
+// disableRipple
|
|
|
|
+// >
|
|
|
|
+// <Typography
|
|
|
|
+// variant='button'
|
|
|
|
+// display='block'
|
|
|
|
+// >
|
|
|
|
+// {(userId === myId) && 'Редактировать аккаунт' ||
|
|
|
|
+// (myFollowingList?.includes(userId)) && 'Отписаться' ||
|
|
|
|
+// (userId !== myId && !myFollowingList?.includes(userId)) && 'Подписаться'
|
|
|
|
+// }
|
|
|
|
+// </Typography>
|
|
|
|
+// </Button>
|
|
|
|
+// </Box>
|
|
|
|
+// )
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// // блок пользовательских данных
|
|
|
|
+// export default function BasicCard({ userData }) {
|
|
|
|
+// // console.log('userData: ', userData)
|
|
|
|
+
|
|
|
|
+// // определяем количество постов пользоваеля
|
|
|
|
+// const userPostsCount = useSelector(state => state?.promise?.UserPostsCount?.payload)
|
|
|
|
+
|
|
|
|
+// // контекст обновления профиля
|
|
|
|
+// const [updateProfile, setUpdateProfile] = useContext(UpdateProfile)
|
|
|
|
+// // console.log('updateProfile: ', updateProfile)
|
|
|
|
+
|
|
|
|
+// // отслеживание нажатия кнопки редактирования профиля
|
|
|
|
+// const [isEditProfile, setIsEditProfile] = useContext(EditProfile)
|
|
|
|
+
|
|
|
|
+// // контекст модального окна
|
|
|
|
+// const [modalName, setModalName, modalArray, setModalArray, openModal, setOpenModal, handleOpenModal, handleCloseModal] = useContext(ModalForCountsContext)
|
|
|
|
+
|
|
|
|
+// // отслеживание статуса изменения пароля
|
|
|
|
+// const [changePassword, setChangePassword] = useState(false)
|
|
|
|
+
|
|
|
|
+// // открытие поля редактирвоания пароля
|
|
|
|
+// function changePasswordButton() {
|
|
|
|
+// setChangePassword(true)
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// function userFollowers() {
|
|
|
|
+// handleOpenModal({
|
|
|
|
+// arr: userData?.followers, name: `Подписчики ${userData?.login}`
|
|
|
|
+// })
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// function userFollowing() {
|
|
|
|
+// handleOpenModal({
|
|
|
|
+// arr: userData?.following, name: `Подписки ${userData?.login}`
|
|
|
|
+// })
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// return (
|
|
|
|
+// <Container sx={{
|
|
|
|
+// display: 'flex',
|
|
|
|
+// alignItems: 'center'
|
|
|
|
+// }}
|
|
|
|
+// >
|
|
|
|
+// <Box
|
|
|
|
+// sx={{
|
|
|
|
+// position: 'relative',
|
|
|
|
+// display: 'inline-block'
|
|
|
|
+// }}>
|
|
|
|
+// <Avatar
|
|
|
|
+// alt={userData?.login}
|
|
|
|
+// src={url + userData?.avatar?.url}
|
|
|
|
+// sx={{
|
|
|
|
+// width: 130,
|
|
|
|
+// height: 130
|
|
|
|
+// }}
|
|
|
|
+// />
|
|
|
|
+// {isEditProfile &&
|
|
|
|
+// <Box
|
|
|
|
+// sx={{
|
|
|
|
+// position: 'absolute',
|
|
|
|
+// top: 0,
|
|
|
|
+// left: 0,
|
|
|
|
+// width: '100%',
|
|
|
|
+// height: '100%',
|
|
|
|
+// display: 'flex',
|
|
|
|
+// justifyContent: 'center',
|
|
|
|
+// alignItems: 'center',
|
|
|
|
+// zIndex: 1,
|
|
|
|
+// '&:before': {
|
|
|
|
+// content: '""',
|
|
|
|
+// position: 'absolute',
|
|
|
|
+// top: 0,
|
|
|
|
+// left: 0,
|
|
|
|
+// width: '100%',
|
|
|
|
+// height: '100%',
|
|
|
|
+// backgroundColor: 'rgba(0,0,0,0.5)',
|
|
|
|
+// zIndex: -1,
|
|
|
|
+// borderRadius: '50%',
|
|
|
|
+// }
|
|
|
|
+// }}
|
|
|
|
+// >
|
|
|
|
+// <IconButton
|
|
|
|
+// color="primary"
|
|
|
|
+// aria-label="upload avatar"
|
|
|
|
+// component="label"
|
|
|
|
+// >
|
|
|
|
+// <input hidden accept="image/*" type="file" />
|
|
|
|
+// <ImageSearchRounded
|
|
|
|
+// sx={{
|
|
|
|
+// color: '#FFF',
|
|
|
|
+// fontSize: '40px'
|
|
|
|
+// }}
|
|
|
|
+// />
|
|
|
|
+// </IconButton>
|
|
|
|
+
|
|
|
|
+// </Box>}
|
|
|
|
+// </Box>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// {!isEditProfile &&
|
|
|
|
+// <Box
|
|
|
|
+// sx={{
|
|
|
|
+// display: 'flex',
|
|
|
|
+// flexDirection: 'column',
|
|
|
|
+// marginLeft: '50px '
|
|
|
|
+// }}
|
|
|
|
+// >
|
|
|
|
+// <CardContent sx={{
|
|
|
|
+// flex: '1 0 auto'
|
|
|
|
+// }}
|
|
|
|
+// >
|
|
|
|
+// <Stack
|
|
|
|
+// sx={{
|
|
|
|
+// justifyContent: 'space-between'
|
|
|
|
+// }}
|
|
|
|
+// direction="row"
|
|
|
|
+// spacing={2}
|
|
|
|
+// >
|
|
|
|
+// <Typography
|
|
|
|
+// component="div"
|
|
|
|
+// variant="h4"
|
|
|
|
+// >
|
|
|
|
+// {userData?.login}
|
|
|
|
+// </Typography>
|
|
|
|
+
|
|
|
|
+// <UptadeProfileButton data={userData} />
|
|
|
|
+// </Stack>
|
|
|
|
+
|
|
|
|
+// <Typography
|
|
|
|
+// variant="subtitle1"
|
|
|
|
+// color="text.secondary"
|
|
|
|
+// component="div"
|
|
|
|
+// >
|
|
|
|
+// {userData?.nick || ''}
|
|
|
|
+// </Typography>
|
|
|
|
+// </CardContent>
|
|
|
|
+
|
|
|
|
+// <Stack
|
|
|
|
+// direction="row"
|
|
|
|
+// spacing={5}
|
|
|
|
+// padding={2}
|
|
|
|
+// paddingTop={1}
|
|
|
|
+// >
|
|
|
|
+// <Typography
|
|
|
|
+// variant="subtitle1"
|
|
|
|
+// >
|
|
|
|
+// {userPostsCount || '0'} публикаций
|
|
|
|
+// </Typography>
|
|
|
|
+
|
|
|
|
+// <Typography
|
|
|
|
+// sx={{
|
|
|
|
+// cursor: 'pointer'
|
|
|
|
+// }}
|
|
|
|
+// variant="subtitle1"
|
|
|
|
+// onClick={userFollowers}
|
|
|
|
+// >
|
|
|
|
+// {userData?.followers?.length || '0'} подписчиков
|
|
|
|
+// </Typography>
|
|
|
|
+
|
|
|
|
+// <Typography
|
|
|
|
+// sx={{
|
|
|
|
+// cursor: 'pointer'
|
|
|
|
+// }}
|
|
|
|
+// variant="subtitle1"
|
|
|
|
+// onClick={userFollowing}
|
|
|
|
+// >
|
|
|
|
+// {userData?.following?.length || '0'} подписок
|
|
|
|
+// </Typography>
|
|
|
|
+// </Stack>
|
|
|
|
+// </Box>}
|
|
|
|
+
|
|
|
|
+// {isEditProfile && <ChangeData />
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// {modalArray && <ModalWindow />}
|
|
|
|
+// </Container>
|
|
|
|
+// )
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
import { url } from "../../App"
|
|
import { url } from "../../App"
|
|
|
|
|
|
-import React, { useContext, useState } from 'react';
|
|
|
|
|
|
+import React, { useContext, useState, useEffect } from 'react';
|
|
import { useHistory, useParams } from 'react-router-dom';
|
|
import { useHistory, useParams } from 'react-router-dom';
|
|
import { useDispatch, useSelector } from 'react-redux';
|
|
import { useDispatch, useSelector } from 'react-redux';
|
|
|
|
|
|
-import { CardContent, Typography, Stack, Avatar, Box, Container, Badge, TextField, InputAdornment } from '@mui/material';
|
|
|
|
|
|
+import { CardContent, Typography, Stack, Avatar, Box, Container, Badge, TextField, InputAdornment, IconButton } from '@mui/material';
|
|
import Button from '@mui/material-next/Button';
|
|
import Button from '@mui/material-next/Button';
|
|
import { PersonRemoveRounded, PersonAddRounded, ManageAccountsRounded, BorderColorRounded, ImageSearchRounded, AccountCircle, HttpsRounded } from '@mui/icons-material';
|
|
import { PersonRemoveRounded, PersonAddRounded, ManageAccountsRounded, BorderColorRounded, ImageSearchRounded, AccountCircle, HttpsRounded } from '@mui/icons-material';
|
|
import { actionUserPageSubscribing } from "../../redux/thunks";
|
|
import { actionUserPageSubscribing } from "../../redux/thunks";
|
|
@@ -12,6 +311,8 @@ import { actionUserPageSubscribing } from "../../redux/thunks";
|
|
import ModalWindow from '../structure/modal';
|
|
import ModalWindow from '../structure/modal';
|
|
import ChangeData from "./change_data";
|
|
import ChangeData from "./change_data";
|
|
import { ModalForCountsContext, UpdateProfile } from "../../App";
|
|
import { ModalForCountsContext, UpdateProfile } from "../../App";
|
|
|
|
+import { UploadedFiles } from "../create_post/uploaded_files";
|
|
|
|
+import { actionFilesUpload } from "../../redux/thunks";
|
|
|
|
|
|
import { EditProfile } from ".";
|
|
import { EditProfile } from ".";
|
|
|
|
|
|
@@ -25,6 +326,24 @@ function UptadeProfileButton({ data }) {
|
|
const { userId } = useParams()
|
|
const { userId } = useParams()
|
|
const dispatch = useDispatch()
|
|
const dispatch = useDispatch()
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
// отслеживание нажатия кнопки редактирования профиля
|
|
// отслеживание нажатия кнопки редактирования профиля
|
|
const [isEditProfile, setIsEditProfile] = useContext(EditProfile)
|
|
const [isEditProfile, setIsEditProfile] = useContext(EditProfile)
|
|
|
|
|
|
@@ -67,76 +386,6 @@ function UptadeProfileButton({ data }) {
|
|
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
- // <React.Fragment>
|
|
|
|
- // {userId === myId && <Box
|
|
|
|
- // onClick={upsertProfile}
|
|
|
|
- // >
|
|
|
|
- // <Button
|
|
|
|
- // size="large"
|
|
|
|
- // variant="elevated"
|
|
|
|
- // sx={{
|
|
|
|
- // minWidth: '300px'
|
|
|
|
- // }}
|
|
|
|
- // startIcon={
|
|
|
|
- // <ManageAccountsRounded />
|
|
|
|
- // }
|
|
|
|
- // disableRipple
|
|
|
|
- // >
|
|
|
|
- // <Typography
|
|
|
|
- // variant='button'
|
|
|
|
- // display='block'
|
|
|
|
- // >
|
|
|
|
- // Редактировать аккаунт
|
|
|
|
- // </Typography>
|
|
|
|
- // </Button>
|
|
|
|
- // </Box>}
|
|
|
|
- // {myFollowingList?.includes(userId) && <Box
|
|
|
|
- // onClick={isSubscribing}
|
|
|
|
- // >
|
|
|
|
- // <Button
|
|
|
|
- // size="large"
|
|
|
|
- // variant="elevated"
|
|
|
|
- // sx={{
|
|
|
|
- // minWidth: '300px'
|
|
|
|
- // }}
|
|
|
|
- // startIcon={
|
|
|
|
- // <PersonRemoveRounded />
|
|
|
|
- // }
|
|
|
|
- // disableRipple
|
|
|
|
- // >
|
|
|
|
- // <Typography
|
|
|
|
- // variant='button'
|
|
|
|
- // display='block'
|
|
|
|
- // >
|
|
|
|
- // Отписаться
|
|
|
|
- // </Typography>
|
|
|
|
- // </Button>
|
|
|
|
- // </Box>}
|
|
|
|
- // {(userId !== myId && !myFollowingList?.includes(userId)) && <Box
|
|
|
|
- // onClick={isSubscribing}
|
|
|
|
- // >
|
|
|
|
- // <Button
|
|
|
|
- // size="large"
|
|
|
|
- // variant="filledTonal"
|
|
|
|
- // sx={{
|
|
|
|
- // minWidth: '300px'
|
|
|
|
- // }}
|
|
|
|
- // startIcon={
|
|
|
|
- // <PersonAddRounded />
|
|
|
|
- // }
|
|
|
|
- // disableRipple
|
|
|
|
- // >
|
|
|
|
- // <Typography
|
|
|
|
- // variant='button'
|
|
|
|
- // display='block'
|
|
|
|
- // >
|
|
|
|
- // Подписаться
|
|
|
|
- // </Typography>
|
|
|
|
- // </Button>
|
|
|
|
- // </Box>}
|
|
|
|
- // </React.Fragment>
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<Box
|
|
<Box
|
|
onClick={
|
|
onClick={
|
|
(userId === myId && upsertProfile) ||
|
|
(userId === myId && upsertProfile) ||
|
|
@@ -180,22 +429,89 @@ function UptadeProfileButton({ data }) {
|
|
// блок пользовательских данных
|
|
// блок пользовательских данных
|
|
export default function BasicCard({ userData }) {
|
|
export default function BasicCard({ userData }) {
|
|
// console.log('userData: ', userData)
|
|
// console.log('userData: ', userData)
|
|
|
|
+ const dispatch = useDispatch()
|
|
|
|
|
|
// определяем количество постов пользоваеля
|
|
// определяем количество постов пользоваеля
|
|
const userPostsCount = useSelector(state => state?.promise?.UserPostsCount?.payload)
|
|
const userPostsCount = useSelector(state => state?.promise?.UserPostsCount?.payload)
|
|
|
|
|
|
// контекст обновления профиля
|
|
// контекст обновления профиля
|
|
const [updateProfile, setUpdateProfile] = useContext(UpdateProfile)
|
|
const [updateProfile, setUpdateProfile] = useContext(UpdateProfile)
|
|
- // console.log('updateProfile: ', updateProfile)
|
|
|
|
|
|
+ // console.log('updateProfile AVATAR: ', updateProfile)
|
|
|
|
|
|
// отслеживание нажатия кнопки редактирования профиля
|
|
// отслеживание нажатия кнопки редактирования профиля
|
|
const [isEditProfile, setIsEditProfile] = useContext(EditProfile)
|
|
const [isEditProfile, setIsEditProfile] = useContext(EditProfile)
|
|
|
|
+ console.log('isEditProfile: ', isEditProfile)
|
|
|
|
|
|
// контекст модального окна
|
|
// контекст модального окна
|
|
const [modalName, setModalName, modalArray, setModalArray, openModal, setOpenModal, handleOpenModal, handleCloseModal] = useContext(ModalForCountsContext)
|
|
const [modalName, setModalName, modalArray, setModalArray, openModal, setOpenModal, handleOpenModal, handleCloseModal] = useContext(ModalForCountsContext)
|
|
|
|
|
|
// отслеживание статуса изменения пароля
|
|
// отслеживание статуса изменения пароля
|
|
const [changePassword, setChangePassword] = useState(false)
|
|
const [changePassword, setChangePassword] = useState(false)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // отслеживаем добавление файлов
|
|
|
|
+ const [selectedFile, setSelectedFile] = useState(null)
|
|
|
|
+ // console.log('selectedFile: ', selectedFile)
|
|
|
|
+
|
|
|
|
+ // установка урла аватара
|
|
|
|
+ const [userAvatarUrl, setUserAvatarUrl] = useState(url + userData?.avatar?.url);
|
|
|
|
+ // console.log('userAvatarUrl: ', userAvatarUrl)
|
|
|
|
+
|
|
|
|
+ // функция загрузки файлов с компа
|
|
|
|
+ const handleFileSelect = (event) => {
|
|
|
|
+ const file = event.target.files[0];
|
|
|
|
+ setSelectedFile(file);
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ // отправляем все на бек когда добавили с компа
|
|
|
|
+ useEffect(() => {
|
|
|
|
+ if (selectedFile) {
|
|
|
|
+ // const res = await dispatch(actionFilesUpload(selectedFile))
|
|
|
|
+ dispatch(actionFilesUpload(selectedFile)).then((res) => {
|
|
|
|
+
|
|
|
|
+ // console.log('res: ', res)
|
|
|
|
+
|
|
|
|
+ // ставим на аватар после загрузки
|
|
|
|
+ const newAvatarUrl = url + res?.url;
|
|
|
|
+ setUserAvatarUrl(newAvatarUrl)
|
|
|
|
+
|
|
|
|
+ setUpdateProfile({ ...updateProfile, avatar: { _id: res?._id } })
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }, [selectedFile])
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // меняем аватарку, если переходим между пользователями или отменяем изменения
|
|
|
|
+ useEffect(() => {
|
|
|
|
+ setUserAvatarUrl(url + userData?.avatar?.url)
|
|
|
|
+ }, [userData, isEditProfile])
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
// открытие поля редактирвоания пароля
|
|
// открытие поля редактирвоания пароля
|
|
function changePasswordButton() {
|
|
function changePasswordButton() {
|
|
@@ -222,26 +538,6 @@ export default function BasicCard({ userData }) {
|
|
alignItems: 'center'
|
|
alignItems: 'center'
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
- {/* <Avatar
|
|
|
|
- alt={userData?.login}
|
|
|
|
- src={url + userData?.avatar?.url}
|
|
|
|
- sx={{
|
|
|
|
- width: 130,
|
|
|
|
- height: 130
|
|
|
|
- }}
|
|
|
|
- // children={
|
|
|
|
- // <BorderColorRounded />
|
|
|
|
- // }
|
|
|
|
- >
|
|
|
|
- <BorderColorRounded sx={{
|
|
|
|
- color: 'black',
|
|
|
|
- zIndex: 999
|
|
|
|
- }} />
|
|
|
|
- </Avatar> */}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
<Box
|
|
<Box
|
|
sx={{
|
|
sx={{
|
|
position: 'relative',
|
|
position: 'relative',
|
|
@@ -249,7 +545,8 @@ export default function BasicCard({ userData }) {
|
|
}}>
|
|
}}>
|
|
<Avatar
|
|
<Avatar
|
|
alt={userData?.login}
|
|
alt={userData?.login}
|
|
- src={url + userData?.avatar?.url}
|
|
|
|
|
|
+ // src={url + userData?.avatar?.url}
|
|
|
|
+ src={userAvatarUrl}
|
|
sx={{
|
|
sx={{
|
|
width: 130,
|
|
width: 130,
|
|
height: 130
|
|
height: 130
|
|
@@ -280,12 +577,46 @@ export default function BasicCard({ userData }) {
|
|
}
|
|
}
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
- <ImageSearchRounded
|
|
|
|
- sx={{
|
|
|
|
- color: '#FFF',
|
|
|
|
- fontSize: '40px'
|
|
|
|
- }}
|
|
|
|
- />
|
|
|
|
|
|
+ {/* <IconButton
|
|
|
|
+ color="primary"
|
|
|
|
+ aria-label="upload avatar"
|
|
|
|
+ component="label"
|
|
|
|
+ >
|
|
|
|
+ <input
|
|
|
|
+ hidden
|
|
|
|
+ accept="image/*"
|
|
|
|
+ type="file"
|
|
|
|
+ className='getphoto'
|
|
|
|
+ onFiles={files => dispatch(actionFilesUpload(files))}
|
|
|
|
+ />
|
|
|
|
+ <ImageSearchRounded
|
|
|
|
+ sx={{
|
|
|
|
+ color: '#FFF',
|
|
|
|
+ fontSize: '40px'
|
|
|
|
+ }}
|
|
|
|
+ />
|
|
|
|
+ </IconButton> */}
|
|
|
|
+ <IconButton
|
|
|
|
+ color="primary"
|
|
|
|
+ aria-label="upload avatar"
|
|
|
|
+ component="label"
|
|
|
|
+ // onClick={handleFileUpload}
|
|
|
|
+ >
|
|
|
|
+ <input
|
|
|
|
+ hidden
|
|
|
|
+ accept="image/*"
|
|
|
|
+ type="file"
|
|
|
|
+ className='getphoto'
|
|
|
|
+ onChange={handleFileSelect}
|
|
|
|
+ />
|
|
|
|
+ <ImageSearchRounded
|
|
|
|
+ sx={{
|
|
|
|
+ color: '#FFF',
|
|
|
|
+ fontSize: '40px'
|
|
|
|
+ }}
|
|
|
|
+ />
|
|
|
|
+ </IconButton>
|
|
|
|
+
|
|
</Box>}
|
|
</Box>}
|
|
</Box>
|
|
</Box>
|
|
|
|
|
|
@@ -364,126 +695,6 @@ export default function BasicCard({ userData }) {
|
|
</Box>}
|
|
</Box>}
|
|
|
|
|
|
{isEditProfile && <ChangeData />
|
|
{isEditProfile && <ChangeData />
|
|
- // <Box
|
|
|
|
- // sx={{
|
|
|
|
- // display: 'flex',
|
|
|
|
- // flexDirection: 'column',
|
|
|
|
- // marginLeft: '50px '
|
|
|
|
- // }}
|
|
|
|
- // >
|
|
|
|
- // {/* <CardContent sx={{
|
|
|
|
- // flex: '1 0 auto'
|
|
|
|
- // }}
|
|
|
|
- // > */}
|
|
|
|
- // <Stack
|
|
|
|
- // sx={{
|
|
|
|
- // justifyContent: 'space-between',
|
|
|
|
- // marginBottom: '10px'
|
|
|
|
- // }}
|
|
|
|
- // direction="row"
|
|
|
|
- // spacing={2}
|
|
|
|
- // >
|
|
|
|
- // <Box
|
|
|
|
- // sx={{
|
|
|
|
- // display: 'flex',
|
|
|
|
- // alignItems: 'flex-end'
|
|
|
|
- // }}>
|
|
|
|
- // <AccountCircle
|
|
|
|
- // sx={{
|
|
|
|
- // color: 'action.active',
|
|
|
|
- // mr: 1, my: 0.5
|
|
|
|
- // }} />
|
|
|
|
- // <TextField
|
|
|
|
- // id="input-new-login"
|
|
|
|
- // label="Новый логин"
|
|
|
|
- // variant="standard" />
|
|
|
|
- // </Box>
|
|
|
|
-
|
|
|
|
- // <Box
|
|
|
|
- // sx={{
|
|
|
|
- // display: 'flex',
|
|
|
|
- // alignItems: 'flex-end'
|
|
|
|
- // }}>
|
|
|
|
- // <AccountCircle
|
|
|
|
- // sx={{
|
|
|
|
- // color: 'action.active',
|
|
|
|
- // mr: 1, my: 0.5
|
|
|
|
- // }} />
|
|
|
|
- // <TextField
|
|
|
|
- // id="input-new-nick"
|
|
|
|
- // label="Новый ник-нейм"
|
|
|
|
- // variant="standard" />
|
|
|
|
- // </Box>
|
|
|
|
- // </Stack>
|
|
|
|
-
|
|
|
|
- // <Stack
|
|
|
|
- // sx={{
|
|
|
|
- // justifyContent: 'space-between',
|
|
|
|
- // marginBottom: '10px'
|
|
|
|
- // }}
|
|
|
|
- // direction="row"
|
|
|
|
- // spacing={2}
|
|
|
|
- // >
|
|
|
|
- // <Box
|
|
|
|
- // onClick={changePasswordButton}
|
|
|
|
- // >
|
|
|
|
- // <Button
|
|
|
|
- // sx={{
|
|
|
|
- // padding: '5px 20px'
|
|
|
|
- // }}
|
|
|
|
- // size="small"
|
|
|
|
- // variant="text"
|
|
|
|
- // >
|
|
|
|
- // Редактировать пароль
|
|
|
|
- // </Button>
|
|
|
|
- // </Box>
|
|
|
|
-
|
|
|
|
- // {changePassword &&
|
|
|
|
- // <React.Fragment>
|
|
|
|
- // <Box
|
|
|
|
- // sx={{
|
|
|
|
- // display: 'flex',
|
|
|
|
- // alignItems: 'flex-end'
|
|
|
|
- // }}>
|
|
|
|
- // <HttpsRounded
|
|
|
|
- // sx={{
|
|
|
|
- // color: 'action.active',
|
|
|
|
- // mr: 1, my: 0.5
|
|
|
|
- // }} />
|
|
|
|
- // <TextField
|
|
|
|
- // id="input-new-login"
|
|
|
|
- // label="Старый пароль"
|
|
|
|
- // variant="standard" />
|
|
|
|
- // </Box>
|
|
|
|
-
|
|
|
|
- // <Box
|
|
|
|
- // sx={{
|
|
|
|
- // display: 'flex',
|
|
|
|
- // alignItems: 'flex-end'
|
|
|
|
- // }}>
|
|
|
|
- // <HttpsRounded
|
|
|
|
- // sx={{
|
|
|
|
- // color: 'action.active',
|
|
|
|
- // mr: 1, my: 0.5
|
|
|
|
- // }} />
|
|
|
|
- // <TextField
|
|
|
|
- // id="input-new-nick"
|
|
|
|
- // label="Новый пароль"
|
|
|
|
- // variant="standard" />
|
|
|
|
- // </Box>
|
|
|
|
- // </React.Fragment>}
|
|
|
|
- // </Stack>
|
|
|
|
-
|
|
|
|
- // <Button
|
|
|
|
- // size="medium"
|
|
|
|
- // variant="filledTonal"
|
|
|
|
- // sx={{
|
|
|
|
- // maxWidth: '300px'
|
|
|
|
- // }}
|
|
|
|
- // >
|
|
|
|
- // Сохранить изменения
|
|
|
|
- // </Button>
|
|
|
|
- // </Box>
|
|
|
|
}
|
|
}
|
|
|
|
|
|
{modalArray && <ModalWindow />}
|
|
{modalArray && <ModalWindow />}
|