Quellcode durchsuchen

Finished feature 701

feature/701
djordjemitrovic00 vor 3 Jahren
Ursprung
Commit
41fb5cfd4d
43 geänderte Dateien mit 417 neuen und 212 gelöschten Zeilen
  1. 5
    2
      src/components/Cards/ChatCard/ChatCard.js
  2. 2
    0
      src/components/Cards/ChatCard/ChatCard.styled.js
  3. 10
    2
      src/components/Cards/CreateOfferCard/CreateOffer.styled.js
  4. 1
    0
      src/components/Cards/CreateOfferCard/ThirdPart/ThirdPartCreateOffer.styled.js
  5. 29
    29
      src/components/Cards/ItemDetailsCard/ItemDetailsCard.js
  6. 38
    20
      src/components/Cards/ItemDetailsCard/ItemDetailsCard.styled.js
  7. 22
    23
      src/components/Cards/ItemDetailsCard/OfferDetails/OfferDetails.js
  8. 11
    6
      src/components/Cards/ItemDetailsCard/OfferDetails/OfferDetails.styled.js
  9. 6
    1
      src/components/Cards/MiniChatCard/MiniChatCard.js
  10. 3
    1
      src/components/Cards/MiniChatCard/MiniChatCard.styled.js
  11. 4
    3
      src/components/Cards/ProfileCard/BigProfileCard/BigProfileCard.js
  12. 53
    0
      src/components/Cards/ProfileCard/BlockedProfile/BlockedProfile.js
  13. 48
    0
      src/components/Cards/ProfileCard/BlockedProfile/BlockedProfile.styled.js
  14. 17
    21
      src/components/Cards/ProfileCard/ProfileCard.js
  15. 2
    40
      src/components/Cards/ProfileCard/ProfileCard.styled.js
  16. 4
    3
      src/components/Cards/ProfileCard/ProfileContact/ProfileContact.styled.js
  17. 22
    10
      src/components/Cards/ProfileCard/ProfileMainInfo/ProfileMainInfo.js
  18. 1
    1
      src/components/Cards/ProfileCard/ProfileMainInfo/ProfileMainInfo.styled.js
  19. 2
    0
      src/components/Cards/UserReviewsCard/UserReviewsCard.js
  20. 2
    1
      src/components/Cards/UserReviewsCard/UserReviewsSingleCard/UserReviewsSingleCard.js
  21. 14
    6
      src/components/DirectChat/DirectChatContent/DirectChatContentHeader/DirectChatContentHeader.js
  22. 2
    2
      src/components/DirectChat/DirectChatHeader/DirectChatHeader.js
  23. 9
    0
      src/components/DirectChat/DirectChatNewMessage/DirectChatNewMessage.js
  24. 10
    2
      src/components/DirectChat/DirectChatNewMessage/NotAllowedChat/NotAllowedChat.js
  25. 1
    0
      src/components/ItemDetails/SkeletonItemDetails/SkeletonItemDetails.styled.js
  26. 6
    0
      src/components/Modals/DeleteCategory/DeleteCategory.js
  27. 10
    3
      src/components/Popovers/HeaderPopover/HeaderPopover.styled.js
  28. 1
    0
      src/components/UserReviews/UserReviews.js
  29. 10
    8
      src/components/UserReviews/UserReviews.styled.js
  30. 1
    0
      src/constants/adminTypeConstants.js
  31. 3
    0
      src/i18n/resources/rs.js
  32. 2
    2
      src/layouts/ChatGridLayout/ChatGridLayout.js
  33. 1
    1
      src/layouts/ChatGridLayout/ChatGridLayout.styled.js
  34. 3
    3
      src/layouts/ItemDetailsLayout/ItemDetailsLayout.js
  35. 20
    7
      src/layouts/ItemDetailsLayout/ItemDetailsLayout.styled.js
  36. 3
    3
      src/layouts/ProfileLayout/ProfileLayout.js
  37. 9
    8
      src/layouts/ProfileLayout/ProfileLayout.styled.js
  38. 6
    2
      src/pages/AdminHomePage/AdminUsersPage/AdminSingleUserPage/AdminSingleUserPage.styled.js
  39. 1
    1
      src/pages/ItemDetailsPage/ItemDetailsPage.styled.js
  40. 1
    0
      src/request/apiEndpoints.js
  41. 6
    0
      src/request/profileRequest.js
  42. 12
    1
      src/store/saga/adminSaga.js
  43. 4
    0
      src/store/selectors/profileSelectors.js

+ 5
- 2
src/components/Cards/ChatCard/ChatCard.js Datei anzeigen

@@ -10,6 +10,7 @@ import {
import MobileOfferDetails from "./MobileOfferDetails/MobileOfferDetails";
import useIsMobile from "../../../hooks/useIsMobile";
import { getImageUrl, variants } from "../../../util/helpers/imageUrlGetter";
import BlockedProfile from "../ProfileCard/BlockedProfile/BlockedProfile";

// Chat card is shown only on mobile phones (route /messages)
const ChatCard = (props) => {
@@ -34,8 +35,10 @@ const ChatCard = (props) => {
)}
/>
</UserImgWrapper>

<ChatInfo>
<ChatInfo isBlocked={props.chat.interlocutorData?._blocked}>
{props.chat.interlocutorData?._blocked && (
<BlockedProfile redText chatCard shortText aboveTitle hideIcon />
)}
<UserName>{chat?.interlocutorData?.name}</UserName>
<MobileOfferDetails chat={chat} />
</ChatInfo>

+ 2
- 0
src/components/Cards/ChatCard/ChatCard.styled.js Datei anzeigen

@@ -58,6 +58,8 @@ export const ChatInfo = styled(Box)`
display: flex;
flex-direction: column;
justify-content: space-between;
position: relative;
top: ${props => props.isBlocked && `-12px`};
`;
export const UserName = styled(Typography)`
margin-bottom: 12px;

+ 10
- 2
src/components/Cards/CreateOfferCard/CreateOffer.styled.js Datei anzeigen

@@ -1,5 +1,5 @@
import { Box, Container, Typography } from "@mui/material";
import styled from "styled-components";
import styled, { css } from "styled-components";
import selectedTheme from "../../../themes";
import { PrimaryButton } from "../../Buttons/PrimaryButton/PrimaryButton";
import { Label } from "../../CheckBox/Label";
@@ -144,7 +144,15 @@ export const CreateOfferDescription = styled(Typography)`
export const CreateOfferFormContainer = styled(Box)`
width: 335px;
height: 700px;
${(props) => props.currentStep === 3 && `width: 120%; height: 420px;`}
${(props) =>
props.currentStep === 3 &&
css`
width: 120%;
border-radius: 4px;
height: 420px;
border: 1px solid ${selectedTheme.colors.borderNormal};
margin-top: 40px;
`}
`;
export const RegisterAltText = styled(Typography)`
font-family: ${selectedTheme.fonts.altText};

+ 1
- 0
src/components/Cards/CreateOfferCard/ThirdPart/ThirdPartCreateOffer.styled.js Datei anzeigen

@@ -10,6 +10,7 @@ export const CreateOfferFormContainer = styled(Box)`
`;
export const PreviewCard = styled(ItemDetailsCard)`
width: auto;
border: 0;
`;
export const PublishButton = styled(PrimaryAnimatedButton)`
width: 332px;

+ 29
- 29
src/components/Cards/ItemDetailsCard/ItemDetailsCard.js Datei anzeigen

@@ -16,7 +16,8 @@ import {
EditIcon,
RemoveIconContainer,
RemoveIcon,
EditDeleteButtons,
ButtonContainer,
// EditDeleteButtons,
} from "./ItemDetailsCard.styled";
import selectedTheme from "../../../themes";
import { useDispatch, useSelector } from "react-redux";
@@ -24,9 +25,7 @@ import { selectLatestChats } from "../../../store/selectors/chatSelectors";
import { increaseCounter } from "../../../store/actions/counter/counterActions";
import _ from "lodash";
import { selectUserId } from "../../../store/selectors/loginSelectors";
import {
formatDateLocale,
} from "../../../util/helpers/dateHelpers";
import { formatDateLocale } from "../../../util/helpers/dateHelpers";
import { startChat } from "../../../util/helpers/chatHelper";
import Information from "./Information/Information";
import { useTranslation } from "react-i18next";
@@ -120,32 +119,33 @@ const ItemDetailsCard = (props) => {
singleOffer={props.singleOffer}
previewCard={props.previewCard}
/>
<DateButtonsContainer>
{props.isMyOffer && (
<ButtonsContainer>
<EditDeleteButtons>
<EditIconContainer onClick={() => setShowModalEdit(true)}>
<EditIcon />
</EditIconContainer>
<RemoveIconContainer onClick={() => setShowModalRemove(true)}>
<RemoveIcon />
</RemoveIconContainer>
</EditDeleteButtons>
</ButtonsContainer>
)}
</DateButtonsContainer>

{!props.halfwidth && props.showExchangeButton && (
<CheckButton
variant={props.sponsored ? "contained" : "outlined"}
buttoncolor={selectedTheme.colors.primaryPurple}
textcolor={
props.sponsored ? "white" : selectedTheme.colors.primaryPurple
}
onClick={startExchange}
disabled={props.isMyOffer}
>
{t("itemDetailsCard.startExchangeButton")}
</CheckButton>
<ButtonContainer>
<DateButtonsContainer>
{props.isMyOffer && (
<ButtonsContainer>
<EditIconContainer onClick={() => setShowModalEdit(true)}>
<EditIcon />
</EditIconContainer>
<RemoveIconContainer onClick={() => setShowModalRemove(true)}>
<RemoveIcon />
</RemoveIconContainer>
</ButtonsContainer>
)}
</DateButtonsContainer>
<CheckButton
variant={props.sponsored ? "contained" : "outlined"}
buttoncolor={selectedTheme.colors.primaryPurple}
textcolor={
props.sponsored ? "white" : selectedTheme.colors.primaryPurple
}
onClick={startExchange}
disabled={props.isMyOffer}
>
{t("itemDetailsCard.startExchangeButton")}
</CheckButton>
</ButtonContainer>
)}
</ItemDetailsCardContainer>
{showModalRemove && (

+ 38
- 20
src/components/Cards/ItemDetailsCard/ItemDetailsCard.styled.js Datei anzeigen

@@ -28,7 +28,7 @@ export const ItemDetailsCardContainer = styled(Container)`
max-width: 2000px;
position: relative;
width: auto;
${(props) => !props.previewCard && `height: 654px;`}
/* ${(props) => !props.previewCard && `height: 654px;`} */
/* height: 654px; */
/* padding-bottom: 70px; */

@@ -54,7 +54,7 @@ export const ItemDetailsCardContainer = styled(Container)`
}

@media (max-height: 708px) {
height: 400px;
/* height: 400px; */
}
`;
export const OfferInfo = styled(Box)`
@@ -72,25 +72,28 @@ export const OfferInfo = styled(Box)`
`;
export const ButtonsContainer = styled(Box)`
display: flex;
align-items: center;
gap: 18px;

@media screen and (max-width: 600px) {

/* @media screen and (max-width: 600px) {
position: absolute;
top: 75px;
right: 143px;
}
top: 0;
right: 0;
} */
`;

export const EditDeleteButtons = styled(Box)`
display: flex;

@media screen and (max-width: 600px) {
/* @media screen and (max-width: 600px) {
position: absolute;
}
} */
`;
export const EditIconContainer = styled(IconButton)`
width: 40px;
height: 40px;
position: relative;
top: 4px;
background-color: ${selectedTheme.colors.primaryIconBackgroundColor};
border-radius: 100%;
padding-top: 2px;
@@ -99,6 +102,7 @@ export const EditIconContainer = styled(IconButton)`

@media screen and (max-width: 600px) {
width: 32px;
top: 0;
height: 32px;
}
`;
@@ -115,14 +119,17 @@ export const EditIcon = styled(Edit)`
export const RemoveIconContainer = styled(IconButton)`
width: 40px;
height: 40px;
position: relative;
top: 4px;
background-color: ${selectedTheme.colors.primaryIconBackgroundColor};
border-radius: 100%;
padding-top: 2px;
text-align: center;
margin-left: 18px;
/* margin-left: 18px; */

@media screen and (max-width: 600px) {
width: 32px;
top: 0;
height: 32px;
}
`;
@@ -139,14 +146,12 @@ export const RemoveIcon = styled(Remove)`

export const DateButtonsContainer = styled(Box)`
display: flex;
align-items: center;
position: absolute;
right: 220px;
bottom: 22px;

@media screen and (max-width: 600px) {
top: 0;
right: -10px;
position: absolute;
bottom: initial;
top: 58px;
right: 12px;
}
`;

@@ -285,9 +290,7 @@ export const DetailText = styled(Typography)`
export const CheckButton = styled(PrimaryButton)`
width: 180px;
height: 48px;
position: absolute;
bottom: 9px;
right: 12px;

font-weight: 600;
&:hover button {
color: white !important;
@@ -298,6 +301,9 @@ export const CheckButton = styled(PrimaryButton)`
}
@media (max-width: 600px) {
height: 44px;
position: absolute;
bottom: 9px;
right: 9px;
}
`;
// export const OfferImage = styled.img`
@@ -323,3 +329,15 @@ export const EyeIcon = styled(Eye)`
width: 18px;
height: 20px;
`;
export const ButtonContainer = styled(Box)`
position: absolute;
bottom: 18px;
right: 18px;
display: flex;
flex-direction: row;
justify-content: flex-end;
gap: 18px;
@media (max-width: 600px) {
position: static;
}
`

+ 22
- 23
src/components/Cards/ItemDetailsCard/OfferDetails/OfferDetails.js Datei anzeigen

@@ -13,7 +13,6 @@ import {
DesciprtionPostDate,
} from "./OfferDetails.styled";
import { useTranslation } from "react-i18next";
import useScreenDimensions from "../../../../hooks/useScreenDimensions";
import { formatDateLocale } from "../../../../util/helpers/dateHelpers";
import useIsMobile from "../../../../hooks/useIsMobile";
import { getImageUrl, variants } from "../../../../util/helpers/imageUrlGetter";
@@ -24,7 +23,6 @@ import ImagesCarousel from "../ImagesCarousel/ImagesCarousel";
const OfferDetails = (props) => {
const offer = props.offer;
const { t } = useTranslation();
const dimension = useScreenDimensions();
const { isMobile } = useIsMobile();
const [images, setImages] = useState([]);
const [imagesCarouselModal, setImagesCarouselModal] = useState(false);
@@ -64,27 +62,7 @@ const OfferDetails = (props) => {
singleOffer={props.singleOffer}
previewCard={props.previewCard}
>
{dimension.width <= 600 || !props.singleOffer ? (
<ScrollerHorizontal>
{props?.offer?.offer?.images.map((item, index) => {
if (!item) return;
return (
<OfferImage
src={
props.createOffer
? images[index]
: getImageUrl(item, variants.offerCard, isMobile)
}
key={item}
previewCard={props.previewCard}
onClick={() =>
!props.previewCard && setImagesCarouselModal(true)
}
/>
);
})}
</ScrollerHorizontal>
) : (
{!isMobile && props.singleOffer && (
<ScrollerVertical>
{props?.offer?.offer?.images.map((item, index) => (
<OfferImage
@@ -109,6 +87,27 @@ const OfferDetails = (props) => {
<OfferTitle singleOffer={props.singleOffer}>
{offer?.offer?.name}
</OfferTitle>
{isMobile && (
<ScrollerHorizontal>
{props?.offer?.offer?.images.map((item, index) => {
if (!item) return;
return (
<OfferImage
src={
props.createOffer
? images[index]
: getImageUrl(item, variants.offerCard, isMobile)
}
key={item}
previewCard={props.previewCard}
onClick={() =>
!props.previewCard && setImagesCarouselModal(true)
}
/>
);
})}
</ScrollerHorizontal>
)}
<OfferLittleDetails
singleOffer={props.singleOffer}
previewCard={props.previewCard}

+ 11
- 6
src/components/Cards/ItemDetailsCard/OfferDetails/OfferDetails.styled.js Datei anzeigen

@@ -14,6 +14,7 @@ export const Details = styled(Box)`
${(props) => props.hasScrollBar && !props.exchange && `height: 340px;`}
/* overflow-y: auto; */
overflow-y: hidden;
padding-bottom: 50px;
/* ::-webkit-scrollbar {
width: 5px;
}
@@ -23,7 +24,7 @@ export const Details = styled(Box)`
} */

@media screen and (max-width: 600px) {
flex-direction: column-reverse;
flex-direction: column;
margin-top: 15px;
min-height: 300px;
${(props) =>
@@ -46,6 +47,10 @@ export const OfferTitle = styled(Typography)`
@media screen and (max-width: 600px) {
padding: 0 8px;
font-size: 18px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 240px;
}
`;
export const OfferLittleDetails = styled(Box)`
@@ -56,7 +61,7 @@ export const OfferLittleDetails = styled(Box)`
padding: ${(props) => (props.singleOffer ? 0 : "0 60px")};
margin-top: 10px;
padding-right: 18px;
overflow-y: auto;
overflow-y: ${props => !props.previewCard && `auto`};
${(props) =>
!props.singleOffer &&
`
@@ -66,11 +71,11 @@ export const OfferLittleDetails = styled(Box)`
`}
@media (max-width: 600px) {
padding: 0 8px;
position: absolute;
top: 270px;
/* position: absolute; */
/* top: 270px; */
justify-content: start;
height: 300px;
${(props) => props.previewCard && `height: 100px;`};
/* height: 300px; */
${(props) => props.previewCard && `height: 100px;`}
width: 97%;
}
`;

+ 6
- 1
src/components/Cards/MiniChatCard/MiniChatCard.js Datei anzeigen

@@ -14,6 +14,7 @@ import { getImageUrl, variants } from "../../../util/helpers/imageUrlGetter";
import history from "../../../store/utils/history";
import { replaceInRoute } from "../../../util/helpers/routeHelpers";
import { CHAT_MESSAGE_PAGE } from "../../../constants/pages";
import BlockedProfile from "../ProfileCard/BlockedProfile/BlockedProfile";

const MiniChatCard = (props) => {
const { t } = useTranslation();
@@ -25,6 +26,7 @@ const MiniChatCard = (props) => {
})
);
};
console.log(props);
return (
<MiniChatCardContainer selected={props.selected} onClick={changeChat}>
<ProfileImage
@@ -34,7 +36,10 @@ const MiniChatCard = (props) => {
isMobile
)}
/>
<ProfileDetails>
<ProfileDetails isBlocked={props.chat.interlocutorData?._blocked}>
{props.chat.interlocutorData?._blocked && (
<BlockedProfile redText chatCard shortText aboveTitle hideIcon />
)}
<ProfileName selected={props.selected}>
{props?.chat?.interlocutorData?.name}
</ProfileName>

+ 3
- 1
src/components/Cards/MiniChatCard/MiniChatCard.styled.js Datei anzeigen

@@ -7,7 +7,7 @@ export const MiniChatCardContainer = styled(Box)`
border-radius: 4px;
display: flex;
flex-direction: row;
height: 108px;
min-height: 108px;
margin-bottom: 18px;
padding: 18px;
cursor: pointer;
@@ -29,6 +29,8 @@ export const ProfileName = styled(Typography)`
font-weight: 600;
font-family: ${selectedTheme.fonts.textFont};
color: ${props => props.selected ? selectedTheme.colors.primaryYellow : selectedTheme.colors.primaryPurple};
max-height: 38px;
height: 38px;
`;
export const ProfileProduct = styled(Typography)`
margin-top: 9px;

+ 4
- 3
src/components/Cards/ProfileCard/BigProfileCard/BigProfileCard.js Datei anzeigen

@@ -27,6 +27,7 @@ import { replaceInRoute } from "../../../../util/helpers/routeHelpers";
import { ADMIN_SINGLE_USER_PAGE } from "../../../../constants/pages";
import DeleteCategory from "../../../Modals/DeleteCategory/DeleteCategory";
import UserLabeledCard from "../../LabeledCard/User/UserLabeledCard";
import { USERS_BLOCK_TYPE, USERS_DELETE_TYPE, USERS_UNBLOCK_TYPE } from "../../../../constants/adminTypeConstants";

const BigProfileCard = (props) => {
const { t } = useTranslation();
@@ -42,20 +43,20 @@ const BigProfileCard = (props) => {
const removeUser = () => {
setDeleteOrEditModal({
show: true,
type: "deleteUser",
type: USERS_DELETE_TYPE,
});
};
// console.log(props.profile);
const blockUser = () => {
setDeleteOrEditModal({
show: true,
type: "blockUser",
type: USERS_BLOCK_TYPE,
});
};
const unblockUser = () => {
setDeleteOrEditModal({
show: true,
type: "unblockUser",
type: USERS_UNBLOCK_TYPE,
});
};
const goToUser = () => {

+ 53
- 0
src/components/Cards/ProfileCard/BlockedProfile/BlockedProfile.js Datei anzeigen

@@ -0,0 +1,53 @@
import React from "react";
import PropTypes from "prop-types";
import {
BlockedContainer,
BlockedIcon,
BlockedIconContainer,
BlockedProfileText,
BlockedProfileTextContainer,
} from "./BlockedProfile.styled";
import { useTranslation } from "react-i18next";

const BlockedProfile = (props) => {
const { t } = useTranslation();
return (
<BlockedContainer
aboveTitle={props.aboveTitle}
isAdmin={props.isAdmin}
chatCard={props.chatCard}
>
<BlockedProfileTextContainer
aboveTitle={props.aboveTitle}
chatCard={props.chatCard}
>
<BlockedProfileText redText={props.redText}>
{props.chatCard
? t("messages.chatCardBlocked")
: props.shortText
? t("profile.blockedProfileShort")
: t("profile.blockedProfile")}
</BlockedProfileText>
</BlockedProfileTextContainer>
{!props.hideIcon && (
<BlockedIconContainer
aboveTitle={props.aboveTitle}
chatCard={props.chatCard}
>
<BlockedIcon />
</BlockedIconContainer>
)}
</BlockedContainer>
);
};

BlockedProfile.propTypes = {
aboveTitle: PropTypes.bool,
hideIcon: PropTypes.bool,
isAdmin: PropTypes.bool,
redText: PropTypes.bool,
shortText: PropTypes.bool,
chatCard: PropTypes.bool,
};

export default BlockedProfile;

+ 48
- 0
src/components/Cards/ProfileCard/BlockedProfile/BlockedProfile.styled.js Datei anzeigen

@@ -0,0 +1,48 @@
import { Box, Typography } from "@mui/material";
import styled from "styled-components";
import { ReactComponent as Block } from "../../../../assets/images/svg/block.svg";
import selectedTheme from "../../../../themes";

export const BlockedProfileTextContainer = styled(Box)`
display: flex;
flex-direction: column;
height: ${(props) => !props.aboveTitle && `40px`};
justify-content: center;
`;
export const BlockedProfileText = styled(Typography)`
font-style: italic;
font-weight: 400;
font-size: 12px;
line-height: 16px;
font-family: ${selectedTheme.fonts.textFont};
color: ${(props) =>
props.redText ? selectedTheme.colors.blockedColor : "white"};
`;
export const BlockedContainer = styled(Box)`
display: flex;
flex-direction: ${(props) =>
props.aboveTitle && !props.chatCard ? "row-reverse" : "row"};
margin-bottom: ${(props) =>
props.isAdmin ? "4px" : props.chatCard ? "0px" : "18px"};
gap: 9px;
`;
export const BlockedIconContainer = styled(Box)`
display: flex;
flex-direction: column;
height: ${(props) => !props.aboveTitle && `40px`};
justify-content: center;
`;
export const BlockedIcon = styled(Block)`
/* position: relative;
top: 3px;
left: 2px; */
width: 18px;
height: 18px;
@media (max-width: 600px) {
top: 0;
left: -2px;
}
& path {
stroke: white;
}
`;

+ 17
- 21
src/components/Cards/ProfileCard/ProfileCard.js Datei anzeigen

@@ -19,11 +19,6 @@ import {
ProfileInfoAndContactContainer,
UnblockButton,
UnblockIcon,
BlockedProfileText,
BlockedIcon,
BlockedProfileTextContainer,
BlockedIconContainer,
BlockedContainer,
} from "./ProfileCard.styled";
import PersonOutlineIcon from "@mui/icons-material/PersonOutline";
import { useRouteMatch } from "react-router-dom";
@@ -48,6 +43,8 @@ import DeleteCategory from "../../Modals/DeleteCategory/DeleteCategory";
import UserLabeledCard from "../LabeledCard/User/UserLabeledCard";
import history from "../../../store/utils/history";
import { HOME_PAGE } from "../../../constants/pages";
import useIsMobile from "../../../hooks/useIsMobile";
import BlockedProfile from "./BlockedProfile/BlockedProfile";

const ProfileCard = (props) => {
const [editProfileModal, setEditProfileModal] = useState(false);
@@ -58,6 +55,7 @@ const ProfileCard = (props) => {
const isLoading = useSelector(selectIsLoadingByActionType(PROFILE_SCOPE));
const routeMatch = useRouteMatch();
const dispatch = useDispatch();
const { isMobile } = useIsMobile();
const profileFromRedux = useSelector(selectProfile);
const userId = useSelector(selectUserId);
const idProfile = useMemo(() => {
@@ -157,21 +155,10 @@ const ProfileCard = (props) => {
<ProfileCardWrapper
variant="outlined"
isMyProfile={isMyProfile}
blocked={profile?._blocked}
blocked={!props.isAdmin && profile?._blocked}
>
<ButtonsContainer>
{profile?._blocked && (
<BlockedContainer>
<BlockedProfileTextContainer>
<BlockedProfileText>
{t("profile.blockedProfile")}
</BlockedProfileText>
</BlockedProfileTextContainer>
<BlockedIconContainer>
<BlockedIcon />
</BlockedIconContainer>
</BlockedContainer>
)}
{profile?._blocked && !isMobile && <BlockedProfile />}
{props.isAdmin && (
<>
{profile?._blocked ? (
@@ -203,17 +190,25 @@ const ProfileCard = (props) => {
)}
</ButtonsContainer>
<ProfileInfoContainer>
<ProfileInfoAndContactContainer>
<ProfileInfoAndContactContainer isAdmin={props.isAdmin}>
{profile?._blocked && !props.isAdmin && isMobile && (
<BlockedProfile aboveTitle isAdmin={props.isAdmin} />
)}

{/* Profile Main Info */}
<ProfileMainInfo
isAdmin={props.isAdmin}
profile={profile}
isMyProfile={isMyProfile}
isBlocked={profile?._blocked}
isBlocked={!props.isAdmin && profile?._blocked}
/>
{/* Profile Contact */}
<ProfileContact
profile={profile}
isMyProfile={profile?._blocked || isMyProfile}
isAdmin={props.isAdmin}
isMyProfile={
(!props.isAdmin && profile?._blocked) || isMyProfile
}
/>
</ProfileInfoAndContactContainer>
{/* Profile Stats */}
@@ -236,6 +231,7 @@ const ProfileCard = (props) => {
)}
{deleteOrEditModal.show && (
<DeleteCategory
customId={profile?._id}
setOpenedDeleteModal={closeModalHandler}
type={deleteOrEditModal.type}
customLabeledCard={<UserLabeledCard user={profile} />}

+ 2
- 40
src/components/Cards/ProfileCard/ProfileCard.styled.js Datei anzeigen

@@ -93,45 +93,7 @@ export const BlockLabelIcon = styled(Block)`
stroke: ${selectedTheme.colors.iconYellowColor};
}
`;
export const BlockedProfileTextContainer = styled(Box)`
display: flex;
flex-direction: column;
height: 40px;
justify-content: center;
`;
export const BlockedProfileText = styled(Typography)`
font-style: italic;
font-weight: 400;
font-size: 12px;
line-height: 16px;
font-family: ${selectedTheme.fonts.textFont};
color: white;
`;
export const BlockedContainer = styled(Box)`
display: flex;
flex-direction: row;
gap: 9px;
`;
export const BlockedIconContainer = styled(Box)`
display: flex;
flex-direction: column;
height: 40px;
justify-content: center;
`;
export const BlockedIcon = styled(Block)`
/* position: relative;
top: 3px;
left: 2px; */
width: 18px;
height: 18px;
@media (max-width: 600px) {
top: 0;
left: -2px;
}
& path {
stroke: white;
}
`;


export const BlockButton = styled(Box)`
width: 40px;
@@ -382,7 +344,7 @@ export const ProfileInfoAndContactContainer = styled(Box)`
flex-direction: column;
@media (max-width: 600px) {
padding-bottom: 18px;
flex-direction: row;
flex-direction: ${props => props.isAdmin ? "row" : "column"};
}
`;


+ 4
- 3
src/components/Cards/ProfileCard/ProfileContact/ProfileContact.styled.js Datei anzeigen

@@ -7,10 +7,11 @@ import selectedTheme from "../../../../themes";

export const ProfileContactContainer = styled(Grid)`
padding-top: ${(props) => (props.isAdmin ? `20px` : `2rem`)};
padding-bottom: ${(props) => (props.isAdmin ? "0" : "2rem")};
padding-bottom: 2rem;
@media (max-width: 600px) {
padding-bottom: 1rem;
padding-top: 88px;
${props => props.isAdmin && `overflow: hidden;`}
padding-top: ${props => props.isAdmin && "88px"};
padding-bottom: ${props => props.isAdmin ? "1rem" : "0"};
gap: 5px;
width: calc(100vw - 216px);
}

+ 22
- 10
src/components/Cards/ProfileCard/ProfileMainInfo/ProfileMainInfo.js Datei anzeigen

@@ -20,6 +20,7 @@ import {
replaceInRoute,
} from "../../../../util/helpers/routeHelpers";
import { ADMIN_SINGLE_USER_PAGE } from "../../../../constants/pages";
import BlockedProfile from "../BlockedProfile/BlockedProfile";

const ProfileMainInfo = (props) => {
const { t } = useTranslation();
@@ -34,9 +35,9 @@ const ProfileMainInfo = (props) => {
);
}
};
if (props.profile?.blocked) console.log(props.profile);
console.log(props);
return (
<ProfileMainInfoContainer>
<ProfileMainInfoContainer isAdmin={props.isAdmin}>
<AvatarImageContainer>
<AvatarImage
isAdmin={props.isAdmin}
@@ -48,13 +49,21 @@ const ProfileMainInfo = (props) => {
/>
</AvatarImageContainer>
<ProfileMainInfoGrid>
{props.bigProfileCard && (props.profile?._deleted ? (
<BlockedProfileText>{t("profile.deletedProfile")}</BlockedProfileText>
) : props.profile?._blocked ? (
<BlockedProfileText>{t("profile.blockedProfile")}</BlockedProfileText>
) : (
<></>
))}
{props.bigProfileCard &&
(props.profile?._deleted ? (
<BlockedProfileText>
{t("profile.deletedProfile")}
</BlockedProfileText>
) : props.profile?._blocked ? (
<BlockedProfileText>
{t("profile.blockedProfile")}
</BlockedProfileText>
) : (
<></>
))}
{props.profile?._blocked && props.isAdmin && (
<BlockedProfile hideIcon redText aboveTitle isAdmin />
)}
<ProfileName
isAdmin={props.isAdmin}
isMyProfile={props.isMyProfile}
@@ -66,7 +75,10 @@ const ProfileMainInfo = (props) => {
</ProfileName>
<ProfilePIBContainer>
<PocketIcon />
<ProfilePIB isMyProfile={props?.isBlocked || props.isMyProfile} variant="subtitle2">
<ProfilePIB
isMyProfile={props?.isBlocked || props.isMyProfile}
variant="subtitle2"
>
{t("profile.PIB")} {props.profile?.company?.PIB}
</ProfilePIB>
</ProfilePIBContainer>

+ 1
- 1
src/components/Cards/ProfileCard/ProfileMainInfo/ProfileMainInfo.styled.js Datei anzeigen

@@ -9,7 +9,7 @@ export const ProfileMainInfoContainer = styled(Grid)`
align-items: start;
flex-direction: row;
@media (max-width: 600px) {
flex-direction: column-reverse;
flex-direction: ${(props) => (props.isAdmin ? `column-reverse` : `row`)};
gap: 18px;
max-width: 108px;
}

+ 2
- 0
src/components/Cards/UserReviewsCard/UserReviewsCard.js Datei anzeigen

@@ -64,6 +64,7 @@ const UserReviewsCard = (props) => {
handleRemove={handleRemove}
hasGivenReview={props.hasGivenReview}
rightReviews={props.rightReviews}
isAdmin={props.isAdmin}
/>
{removeModalOpened && (
<DeleteReview
@@ -86,6 +87,7 @@ UserReviewsCard.propTypes = {
showRemoveIcon: PropTypes.bool,
hasGivenReview: PropTypes.bool,
rightReviews: PropTypes.bool,
isAdmin: PropTypes.bool,
};
UserReviewsCard.defaultProps = {
isProfileReviews: false,

+ 2
- 1
src/components/Cards/UserReviewsCard/UserReviewsSingleCard/UserReviewsSingleCard.js Datei anzeigen

@@ -15,7 +15,7 @@ const UserReviewsSingleCard = (props) => {

return (
<ReviewContainer>
{!props.rightReviews && (
{props.isAdmin && !props.rightReviews && (
<GivenReviewsHeader
hasGivenReview={props.hasGivenReview}
userWhoReceived={props.review?.userWhoReceived}
@@ -56,6 +56,7 @@ UserReviewsSingleCard.propTypes = {
hasGivenReview: PropTypes.bool,
userWhoReceived: PropTypes.any,
rightReviews: PropTypes.bool,
isAdmin: PropTypes.bool,
};

export default UserReviewsSingleCard;

+ 14
- 6
src/components/DirectChat/DirectChatContent/DirectChatContentHeader/DirectChatContentHeader.js Datei anzeigen

@@ -19,11 +19,14 @@ import useIsMobile from "../../../../hooks/useIsMobile";
import history from "../../../../store/utils/history";
import { replaceInRoute } from "../../../../util/helpers/routeHelpers";
import { PROFILE_PAGE } from "../../../../constants/pages";
import { selectAmIBlocked } from "../../../../store/selectors/profileSelectors";
import { useSelector } from "react-redux";

const DirectChatContentHeader = (props) => {
const [showPhonePopover, setShowPhonePopover] = useState(false);
const [phonePopoverAnchorEl, setPhonePopoverAnchorEl] = useState(null);
const { isMobile } = useIsMobile();
const mineProfileBlocked = useSelector(selectAmIBlocked);

const togglePhonePopover = (event) => {
if (props.interlucator?.telephone) {
@@ -35,11 +38,12 @@ const DirectChatContentHeader = (props) => {
}
};
const routeToUser = () => {
history.push(
replaceInRoute(PROFILE_PAGE, {
idProfile: props?.interlucator?.userId,
})
);
if (!props?.interlucator?._blocked)
history.push(
replaceInRoute(PROFILE_PAGE, {
idProfile: props?.interlucator?.userId,
})
);
};
return (
<DirectChatContentHeaderContainer>
@@ -66,7 +70,11 @@ const DirectChatContentHeader = (props) => {
</DirectChatContentHeaderFlexContainer>
<DirectChatContentHeaderFlexContainer>
<PhoneIconContainer
disabled={!props.interlucator?.telephone}
disabled={
mineProfileBlocked ||
props?.interlucator?._blocked ||
!props.interlucator?.telephone
}
onClick={togglePhonePopover}
>
<PhoneIcon />

+ 2
- 2
src/components/DirectChat/DirectChatHeader/DirectChatHeader.js Datei anzeigen

@@ -66,10 +66,10 @@ const DirectChatHeader = (props) => {
<OfferCard
offer={props.offer}
aboveChat
disabledReviews={isDisabledReviews}
disabledReviews={props.interlocutor?._blocked || isDisabledReviews}
makeReview={makeReview}
dontShowViews
disabledCheckButton={props?.offer?._deleted}
disabledCheckButton={props.interlocutor?._blocked || props?.offer?._deleted}
/>
</DirectChatHeaderContainer>
);

+ 9
- 0
src/components/DirectChat/DirectChatNewMessage/DirectChatNewMessage.js Datei anzeigen

@@ -20,12 +20,14 @@ import { selectExchange } from "../../../store/selectors/exchangeSelector";
import { validateExchange } from "../../../store/actions/exchange/exchangeActions";
import NotAllowedChat from "./NotAllowedChat/NotAllowedChat";
import { convertLocalDateToUTCDate } from "../../../util/helpers/dateHelpers";
import { selectAmIBlocked } from "../../../store/selectors/profileSelectors";

const DirectChatNewMessage = (props) => {
const [typedValue, setTypedValue] = useState("");
const [isFocused, setIsFocused] = useState(false);
const exchange = useSelector(selectExchange);
const dispatch = useDispatch();
const mineProfileBlocked = useSelector(selectAmIBlocked);
const { t } = useTranslation();
const location = useLocation();
const history = useHistory();
@@ -85,9 +87,16 @@ const DirectChatNewMessage = (props) => {
})
);
};
console.log("newm", props);
if (mineProfileBlocked) {
return <NotAllowedChat mineProfileBlocked />;
}
if (props?.chat?.offer?.offer?._deleted) {
return <NotAllowedChat />;
}
if (props?.chat?.interlocutor?._blocked) {
return <NotAllowedChat blocked />;
}
return (
<>
<DirectChatNewMessageContainer>

+ 10
- 2
src/components/DirectChat/DirectChatNewMessage/NotAllowedChat/NotAllowedChat.js Datei anzeigen

@@ -6,17 +6,25 @@ import {
} from "./NotAllowedChat.styled";
import { useTranslation } from "react-i18next";

const NotAllowedChat = () => {
const NotAllowedChat = (props) => {
const { t } = useTranslation();
return (
<NotAllowedChatContainer>
<NotAllowedChatText>{t("messages.notAllowedChat")}</NotAllowedChatText>
<NotAllowedChatText>
{props.mineProfileBlocked
? t("profile.mineProfileBlocked")
: props.blocked
? t("profile.blockedProfile")
: t("messages.notAllowedChat")}
</NotAllowedChatText>
</NotAllowedChatContainer>
);
};

NotAllowedChat.propTypes = {
children: PropTypes.node,
blocked: PropTypes.bool,
mineProfileBlocked: PropTypes.bool,
};

export default NotAllowedChat;

+ 1
- 0
src/components/ItemDetails/SkeletonItemDetails/SkeletonItemDetails.styled.js Datei anzeigen

@@ -212,6 +212,7 @@ export const SkeletonItemDetailsMainContainer = styled(Box)`
display: flex;
flex-direction: column;
margin-left: 20px;
overflow: hidden;
width: 100%;

@media (max-width: 600px) {

+ 6
- 0
src/components/Modals/DeleteCategory/DeleteCategory.js Datei anzeigen

@@ -17,6 +17,9 @@ import selectedTheme from "../../../themes";
import { useDispatch } from "react-redux";
import { fetchAdminMethod } from "../../../store/actions/admin/adminActions";
import { DELETE_TYPE } from "../../../constants/adminMethodConstants";
import { dynamicRouteMatches } from "../../../util/helpers/routeHelpers";
import { ADMIN_SINGLE_USER_PAGE } from "../../../constants/pages";
import { fetchProfile } from "../../../store/actions/profile/profileActions";

const DeleteCategory = (props) => {
const dispatch = useDispatch();
@@ -30,6 +33,9 @@ const DeleteCategory = (props) => {
}, [props, t]);

const handleApiResponseSuccess = () => {
if (dynamicRouteMatches(ADMIN_SINGLE_USER_PAGE)) {
dispatch(fetchProfile(props.customId))
}
handleCancel();
};


+ 10
- 3
src/components/Popovers/HeaderPopover/HeaderPopover.styled.js Datei anzeigen

@@ -53,11 +53,13 @@ export const PopoverListItemTextContainer = styled(ListItemText)`
font-weight: 700;
color: ${selectedTheme.colors.primaryPurple};
cursor: pointer;
max-width: 170px;
display: inline-block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
& p {
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
max-height: 32px;
font-size: 0.81rem;
@@ -103,6 +105,11 @@ export const PopoverAddItemButton = styled(Typography)`
export const NameOfProduct = styled(Typography)`
font-size: 12px;
font-weight: 700;
max-width: 100px;
display: inline-block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-family: ${selectedTheme.fonts.textFont};
letter-spacing: 0.02em;
color: ${selectedTheme.colors.primaryDarkText};

+ 1
- 0
src/components/UserReviews/UserReviews.js Datei anzeigen

@@ -152,6 +152,7 @@ const UserReviews = (props) => {
showRemoveIcon={props.isAdmin}
review={review}
key={index}
isAdmin={props.isAdmin}
hasGivenReview={sortRef.current?.hasGivenReview}
givingReview={props.givingReview}
rightReviews={props.rightReviews}

+ 10
- 8
src/components/UserReviews/UserReviews.styled.js Datei anzeigen

@@ -1,4 +1,4 @@
import styled from "styled-components";
import styled, { css } from "styled-components";
import { List, Box, Typography, Grid } from "@mui/material";
import ThumbUpIcon from "@mui/icons-material/ThumbUp";
import ThumbDownIcon from "@mui/icons-material/ThumbDown";
@@ -9,16 +9,18 @@ export const UserReviewsContainer = styled(Box)``;

export const ReviewsBox = styled(Box)`
width: 100%;
min-width: 290px;
min-width: 350px;
${(props) =>
props.profile &&
`
position: relative;
top: -15px;
`}
margin-top: ${(props) => (props.profile ? "60px" : "0")};
css`
height: calc(100vh - 100px);
position: relative;
top: -15px;
`}
/* margin-top: ${(props) => (props.profile ? "60px" : "0")}; */
@media (max-width: 600px) {
position: relative;
min-width: 290px;
top: -45px;
overflow: hidden;
max-height: ${(props) =>
@@ -28,7 +30,7 @@ export const ReviewsBox = styled(Box)`
? "450px"
: "350px"};
padding: 0;
margin: 0 ${props => props.isAdmin ? "18px" : "0"};
margin: 0 ${(props) => (props.isAdmin ? "18px" : "0")};
margin-top: 60px;
}
`;

+ 1
- 0
src/constants/adminTypeConstants.js Datei anzeigen

@@ -4,4 +4,5 @@ export const USERS_TYPE = "users";
export const LOCATIONS_TYPE = "locations";
export const REVIEW_TYPE = "reviews";
export const USERS_BLOCK_TYPE = "blockUser";
export const USERS_UNBLOCK_TYPE = "unblockUser";
export const USERS_DELETE_TYPE = "deleteUser"

+ 3
- 0
src/i18n/resources/rs.js Datei anzeigen

@@ -233,6 +233,7 @@ export default {
messages: {
headerTitle: "Moje Ćaskanje",
cardProduct: "Proizvod: ",
chatCardBlocked: "(blokiran korisnik)",
miniChatHeaderTitle: "Moje Poruke",
send: "Pošalji",
sendPlaceholder: "Poruka...",
@@ -301,6 +302,8 @@ export default {
myOffers: "Moje objave",
profileOffers: "Objave kompanije",
blockedProfile: "Trenutno blokiran profil",
blockedProfileShort: "Blokiran profil",
mineProfileBlocked: "Vaš profil je trenutno blokiran.",
deletedProfile: "Obrisan profil"
},
about: {

+ 2
- 2
src/layouts/ChatGridLayout/ChatGridLayout.js Datei anzeigen

@@ -12,10 +12,10 @@ export const ChatGridLayout = (props) => {
<ChatGridLayoutContainer>
{props.children}
<GridContainer container maxHeight="xl" spacing={2}>
<GridLeftCard item xs={0} lg={3} xl={2.4} md={4}>
<GridLeftCard item xs={0} lg={3} xl={3} md={4}>
{props.leftCard}
</GridLeftCard>
<GridContent item xs={12} lg={9} xl={9.6} md={8}>
<GridContent item xs={12} lg={9} xl={9} md={8}>
{props.content}
</GridContent>
</GridContainer>

+ 1
- 1
src/layouts/ChatGridLayout/ChatGridLayout.styled.js Datei anzeigen

@@ -13,7 +13,7 @@ export const ChatGridLayoutContainer = styled(Box)`
}
`;
export const GridContainer = styled(Grid)`
max-width: none;
`
export const GridContent = styled(Grid)`
`

+ 3
- 3
src/layouts/ItemDetailsLayout/ItemDetailsLayout.js Datei anzeigen

@@ -14,9 +14,9 @@ const ItemDetailsLayout = (props) => {
profile={props.profile}
>
{props.children}
<ContentRightCardContainer>
<Content lg={5} item>{props.content}</Content>
<RightCard lg={7} item singleOffer={props.singleOffer} profile={props.profile}>
<ContentRightCardContainer container spacing={2} >
<Content sm={12} md={7} lg={7} item>{props.content}</Content>
<RightCard sm={0} md={5} lg={5} item singleOffer={props.singleOffer} profile={props.profile}>
{props.rightCard}
</RightCard>
</ContentRightCardContainer>

+ 20
- 7
src/layouts/ItemDetailsLayout/ItemDetailsLayout.styled.js Datei anzeigen

@@ -1,39 +1,52 @@
import { Container, Grid, Box } from "@mui/material";
import { Container, Grid } from "@mui/material";
import styled from "styled-components";

export const ItemDetailsLayoutContainer = styled(Container)`
margin: 0;
padding: 0;
padding-left: 20px;
padding-right: 54px;
max-width: 100vw;
position: relative;
height: 100%;
@media (max-width: 600px) {
padding: 0;
}
`;

export const ContentRightCardContainer = styled(Box)`
display: flex;

@media screen and (max-width: 600px) {
flex-direction: column;
}
export const ContentRightCardContainer = styled(Grid)`
margin: 0;
width: 100%;
`;

export const RightCard = styled(Grid)`
margin-top: 0;
margin-left: 0;
padding-right: 18px;
padding-left: 0;
${(props) => props.profile && `min-width: 350px;`}
margin-bottom: 18px;

@media screen and (min-width: 600px) {
margin-top: 34px;
/* margin-left: ${(props) => (props.profile ? "0" : "36px")}; */
/* padding-left: ${(props) => (props.singleOffer ? "36px" : 0)}; */
border-top-right-radius: 4px;
min-width: 0;
${(props) => props.singleOffer && `width: 100%`}
}

@media screen and (max-width: 1200px) {
margin-left: 0;
}
@media (max-width: 600px) {
width: 100%;

}
`;
export const Content = styled(Grid)`
width: 100%;
@media (max-width: 600px) {
padding-right: 16px;
}
`;

+ 3
- 3
src/layouts/ProfileLayout/ProfileLayout.js Datei anzeigen

@@ -14,9 +14,9 @@ const ProfileLayout = (props) => {
profile={props.profile}
>
{props.children}
<ContentRightCardContainer>
<Content item>{props.content}</Content>
<RightCard item singleOffer={props.singleOffer} profile={props.profile}>
<ContentRightCardContainer container spacing={2}>
<Content sm={12} md={9} lg={9} item>{props.content}</Content>
<RightCard sm={0} md={3} lg={3} item singleOffer={props.singleOffer} profile={props.profile}>
{props.rightCard}
</RightCard>
</ContentRightCardContainer>

+ 9
- 8
src/layouts/ProfileLayout/ProfileLayout.styled.js Datei anzeigen

@@ -1,4 +1,4 @@
import { Container, Grid, Box } from "@mui/material";
import { Container, Grid } from "@mui/material";
import styled from "styled-components";

export const ProfileLayoutContainer = styled(Container)`
@@ -20,12 +20,9 @@ export const ProfileLayoutContainer = styled(Container)`
}
`;

export const ContentRightCardContainer = styled(Box)`
display: flex;

@media screen and (max-width: 600px) {
flex-direction: column;
}
export const ContentRightCardContainer = styled(Grid)`
margin: 0;
width: 100%;
`;

export const RightCard = styled(Grid)`
@@ -34,17 +31,21 @@ export const RightCard = styled(Grid)`
padding-left: 0;
${(props) => props.profile && `min-width: 350px;`}

@media screen and (min-width: 600px) {
margin-top: 34px;
margin-left: ${(props) => (props.profile ? "0" : "36px")};
padding-left: ${(props) => (props.singleOffer ? "36px" : 0)};
border-top-right-radius: 4px;
min-width: 0;
${(props) => props.singleOffer && `width: 100%`}
}

@media screen and (max-width: 1200px) {
margin-left: 0;
}
@media (max-width: 600px) {
min-width: 0;
}
`;
export const Content = styled(Grid)`
width: 100%;

+ 6
- 2
src/pages/AdminHomePage/AdminUsersPage/AdminSingleUserPage/AdminSingleUserPage.styled.js Datei anzeigen

@@ -4,18 +4,22 @@ import Profile from "../../../../components/Profile/Profile";
import UserReviews from "../../../../components/UserReviews/UserReviews";

export const AdminSingleUserPageContainer = styled(Box)`
margin: 0 20px;
@media (max-width: 600px) {
margin: 0;
margin-top: 90px;

}
`;
export const AdminSingleUserPageProfile = styled(Profile)`
margin-bottom: 5px;
`;
export const AdminSingleUserPageReviews = styled(UserReviews)`
padding: 0 50px;
padding: 0;
padding-right: 33px;
@media (max-width: 600px) {
padding: 0;
width: calc(100% - 36px);
width: 100%;
& > div {
margin-top: 0;
height: 500px;

+ 1
- 1
src/pages/ItemDetailsPage/ItemDetailsPage.styled.js Datei anzeigen

@@ -4,7 +4,7 @@ import selectedTheme from "../../themes";
export const ItemDetailsPageContainer = styled(Container)`
padding: 0;
margin: 0;
margin-top: 80px;
margin-top: 72px;
height: 100%;
width: 100%;
max-width: none;

+ 1
- 0
src/request/apiEndpoints.js Datei anzeigen

@@ -125,6 +125,7 @@ export default {
getAllProfilesAsAdmin: "admin/users",
deleteProfileAsAdmin: "admin/users/{userId}",
blockProfileAsAdmin: "admin/users/{userId}/block",
unblockProfileAsAdmin: "admin/users/{userId}/unblock",
},
applications: {
application: "/applications/{applicationUid}",

+ 6
- 0
src/request/profileRequest.js Datei anzeigen

@@ -38,3 +38,9 @@ export const attemptBlockProfileAsAdmin = (payload) =>
userId: payload.userId,
})
);
export const attemptUnblockProfileAsAdmin = (payload) =>
patchRequest(
replaceInUrl(apiEndpoints.users.unblockProfileAsAdmin, {
userId: payload.userId,
})
);

+ 12
- 1
src/store/saga/adminSaga.js Datei anzeigen

@@ -10,6 +10,7 @@ import {
SUBCATEGORIES_TYPE,
USERS_BLOCK_TYPE,
USERS_DELETE_TYPE,
USERS_UNBLOCK_TYPE,
} from "../../constants/adminTypeConstants";
import {
attemptAddNewCategory,
@@ -24,7 +25,7 @@ import {
attemptDeleteLocation,
attemptEditLocation,
} from "../../request/locationsRequest";
import { attemptBlockProfileAsAdmin, attemptDeleteProfileAsAdmin } from "../../request/profileRequest";
import { attemptBlockProfileAsAdmin, attemptDeleteProfileAsAdmin, attemptUnblockProfileAsAdmin } from "../../request/profileRequest";
// import { attemptAddNewCategory } from "../../request/categoriesRequest";
import { ADMIN_FETCH } from "../actions/admin/adminActionConstants";
import {
@@ -157,6 +158,14 @@ function* blockUser(payload) {
yield call(console.log, e);
}
}
function* unblockUser(payload) {
try {
yield call(attemptUnblockProfileAsAdmin, { userId: payload.id });
yield put(fetchAllProfilesAsAdmin());
} catch (e) {
yield call(console.log, e);
}
}

function* fetchAdminMethod({ payload }) {
try {
@@ -204,6 +213,8 @@ function* fetchAdminMethod({ payload }) {
yield call(deleteUser, { id: payload.id });
} else if (payload.type === USERS_BLOCK_TYPE) {
yield call(blockUser, { id: payload.id });
} else if (payload.type === USERS_UNBLOCK_TYPE) {
yield call(unblockUser, {id: payload.id})
}
if (payload.handleApiResponseSuccess)
yield call(payload.handleApiResponseSuccess);

+ 4
- 0
src/store/selectors/profileSelectors.js Datei anzeigen

@@ -26,3 +26,7 @@ export const selectTotalProfiles = createSelector(
profileSelector,
state => state.allProfiles?.total
)
export const selectAmIBlocked = createSelector(
profileSelector,
state => state?.mineProfile?._blocked
)

Laden…
Abbrechen
Speichern