Skip to content

Commit

Permalink
Merge pull request #54 from Sokilskill/fix/profilePage
Browse files Browse the repository at this point in the history
fix formik, slice, operations, selectors
  • Loading branch information
Sokilskill authored Jan 20, 2024
2 parents 9dd57c1 + 47383c1 commit ab9dfb9
Show file tree
Hide file tree
Showing 8 changed files with 525 additions and 247 deletions.
14 changes: 6 additions & 8 deletions src/components/UserCard/UserCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ import 'react-toastify/dist/ReactToastify.css';
import { updatedUserAvatar } from '../../redux/profileSettings/operations';

import sprite from '../../assets/sprite.svg';
import {
selectCurrentUser,
selectUserProfile,
} from '../../redux/profileSettings/selectors';
import {
ActivityShower,
AvatarContainer,
Expand Down Expand Up @@ -38,18 +34,20 @@ import {
WrapperLogOut,
} from './UserCard.styled';
import { LogOutBtn } from '../../helperComponents/LogOutBtn/LogOutBtn';
import { selectUser } from '../../redux/auth/auth-selectors';
import { selectProfileName } from '../../redux/profileSettings/selectors';

export const UserCard = ({ time }) => {
const dispatch = useDispatch();
const userProfile = useSelector(selectUserProfile);
const userProfile = useSelector(selectUser);
const [avatarPreviewURL, setAvatarPreviewURL] = useState(
userProfile.avatarURL
);
const [showPreview, setShowPreview] = useState(true);
const [previewStyle, setPreviewStyle] = useState({});
const [avatarStyle, setAvatarStyle] = useState({});
const [loading, setLoading] = useState(false);
const user = useSelector(selectCurrentUser);
const userName = useSelector(selectProfileName);

const handleAvatarChange = async (e) => {
const newAvatarFile = e.target.files[0];
Expand Down Expand Up @@ -118,7 +116,7 @@ export const UserCard = ({ time }) => {
</div>
</WrapperAvatar>
<NameUserWrapper>
<UserName>{user.name}</UserName>
{/* <UserName>{userName}</UserName> */}
<UserNameDescription>User</UserNameDescription>
</NameUserWrapper>

Expand All @@ -130,7 +128,7 @@ export const UserCard = ({ time }) => {
</FoodSvg>
<TextCalorie>Daily calorie intake</TextCalorie>
</WrapperIntakeFood>
<Span>{Math.round(userProfile.bmr)}</Span>
{/* <Span>{Math.round(userProfile.bmr)}</Span> */}
{/* <SpanIntake>0</SpanIntake> */}
</CalorieShower>
<ActivityShower>
Expand Down
Loading

0 comments on commit ab9dfb9

Please sign in to comment.