| import MobileOfferDetails from "./MobileOfferDetails/MobileOfferDetails"; | import MobileOfferDetails from "./MobileOfferDetails/MobileOfferDetails"; | ||||
| import useIsMobile from "../../../hooks/useIsMobile"; | import useIsMobile from "../../../hooks/useIsMobile"; | ||||
| import { getImageUrl, variants } from "../../../util/helpers/imageUrlGetter"; | import { getImageUrl, variants } from "../../../util/helpers/imageUrlGetter"; | ||||
| import BlockedProfile from "../ProfileCard/BlockedProfile/BlockedProfile"; | |||||
| // Chat card is shown only on mobile phones (route /messages) | // Chat card is shown only on mobile phones (route /messages) | ||||
| const ChatCard = (props) => { | const ChatCard = (props) => { | ||||
| )} | )} | ||||
| /> | /> | ||||
| </UserImgWrapper> | </UserImgWrapper> | ||||
| <ChatInfo> | |||||
| <ChatInfo isBlocked={props.chat.interlocutorData?._blocked}> | |||||
| {props.chat.interlocutorData?._blocked && ( | |||||
| <BlockedProfile redText chatCard shortText aboveTitle hideIcon /> | |||||
| )} | |||||
| <UserName>{chat?.interlocutorData?.name}</UserName> | <UserName>{chat?.interlocutorData?.name}</UserName> | ||||
| <MobileOfferDetails chat={chat} /> | <MobileOfferDetails chat={chat} /> | ||||
| </ChatInfo> | </ChatInfo> |
| display: flex; | display: flex; | ||||
| flex-direction: column; | flex-direction: column; | ||||
| justify-content: space-between; | justify-content: space-between; | ||||
| position: relative; | |||||
| top: ${props => props.isBlocked && `-12px`}; | |||||
| `; | `; | ||||
| export const UserName = styled(Typography)` | export const UserName = styled(Typography)` | ||||
| margin-bottom: 12px; | margin-bottom: 12px; |
| import { Box, Container, Typography } from "@mui/material"; | import { Box, Container, Typography } from "@mui/material"; | ||||
| import styled from "styled-components"; | |||||
| import styled, { css } from "styled-components"; | |||||
| import selectedTheme from "../../../themes"; | import selectedTheme from "../../../themes"; | ||||
| import { PrimaryButton } from "../../Buttons/PrimaryButton/PrimaryButton"; | import { PrimaryButton } from "../../Buttons/PrimaryButton/PrimaryButton"; | ||||
| import { Label } from "../../CheckBox/Label"; | import { Label } from "../../CheckBox/Label"; | ||||
| export const CreateOfferFormContainer = styled(Box)` | export const CreateOfferFormContainer = styled(Box)` | ||||
| width: 335px; | width: 335px; | ||||
| height: 700px; | 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)` | export const RegisterAltText = styled(Typography)` | ||||
| font-family: ${selectedTheme.fonts.altText}; | font-family: ${selectedTheme.fonts.altText}; |
| `; | `; | ||||
| export const PreviewCard = styled(ItemDetailsCard)` | export const PreviewCard = styled(ItemDetailsCard)` | ||||
| width: auto; | width: auto; | ||||
| border: 0; | |||||
| `; | `; | ||||
| export const PublishButton = styled(PrimaryAnimatedButton)` | export const PublishButton = styled(PrimaryAnimatedButton)` | ||||
| width: 332px; | width: 332px; |
| EditIcon, | EditIcon, | ||||
| RemoveIconContainer, | RemoveIconContainer, | ||||
| RemoveIcon, | RemoveIcon, | ||||
| EditDeleteButtons, | |||||
| ButtonContainer, | |||||
| // EditDeleteButtons, | |||||
| } from "./ItemDetailsCard.styled"; | } from "./ItemDetailsCard.styled"; | ||||
| import selectedTheme from "../../../themes"; | import selectedTheme from "../../../themes"; | ||||
| import { useDispatch, useSelector } from "react-redux"; | import { useDispatch, useSelector } from "react-redux"; | ||||
| import { increaseCounter } from "../../../store/actions/counter/counterActions"; | import { increaseCounter } from "../../../store/actions/counter/counterActions"; | ||||
| import _ from "lodash"; | import _ from "lodash"; | ||||
| import { selectUserId } from "../../../store/selectors/loginSelectors"; | 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 { startChat } from "../../../util/helpers/chatHelper"; | ||||
| import Information from "./Information/Information"; | import Information from "./Information/Information"; | ||||
| import { useTranslation } from "react-i18next"; | import { useTranslation } from "react-i18next"; | ||||
| singleOffer={props.singleOffer} | singleOffer={props.singleOffer} | ||||
| previewCard={props.previewCard} | 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 && ( | {!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> | </ItemDetailsCardContainer> | ||||
| {showModalRemove && ( | {showModalRemove && ( |
| max-width: 2000px; | max-width: 2000px; | ||||
| position: relative; | position: relative; | ||||
| width: auto; | width: auto; | ||||
| ${(props) => !props.previewCard && `height: 654px;`} | |||||
| /* ${(props) => !props.previewCard && `height: 654px;`} */ | |||||
| /* height: 654px; */ | /* height: 654px; */ | ||||
| /* padding-bottom: 70px; */ | /* padding-bottom: 70px; */ | ||||
| } | } | ||||
| @media (max-height: 708px) { | @media (max-height: 708px) { | ||||
| height: 400px; | |||||
| /* height: 400px; */ | |||||
| } | } | ||||
| `; | `; | ||||
| export const OfferInfo = styled(Box)` | export const OfferInfo = styled(Box)` | ||||
| `; | `; | ||||
| export const ButtonsContainer = styled(Box)` | export const ButtonsContainer = styled(Box)` | ||||
| display: flex; | display: flex; | ||||
| align-items: center; | |||||
| gap: 18px; | |||||
| @media screen and (max-width: 600px) { | |||||
| /* @media screen and (max-width: 600px) { | |||||
| position: absolute; | position: absolute; | ||||
| top: 75px; | |||||
| right: 143px; | |||||
| } | |||||
| top: 0; | |||||
| right: 0; | |||||
| } */ | |||||
| `; | `; | ||||
| export const EditDeleteButtons = styled(Box)` | export const EditDeleteButtons = styled(Box)` | ||||
| display: flex; | display: flex; | ||||
| @media screen and (max-width: 600px) { | |||||
| /* @media screen and (max-width: 600px) { | |||||
| position: absolute; | position: absolute; | ||||
| } | |||||
| } */ | |||||
| `; | `; | ||||
| export const EditIconContainer = styled(IconButton)` | export const EditIconContainer = styled(IconButton)` | ||||
| width: 40px; | width: 40px; | ||||
| height: 40px; | height: 40px; | ||||
| position: relative; | |||||
| top: 4px; | |||||
| background-color: ${selectedTheme.colors.primaryIconBackgroundColor}; | background-color: ${selectedTheme.colors.primaryIconBackgroundColor}; | ||||
| border-radius: 100%; | border-radius: 100%; | ||||
| padding-top: 2px; | padding-top: 2px; | ||||
| @media screen and (max-width: 600px) { | @media screen and (max-width: 600px) { | ||||
| width: 32px; | width: 32px; | ||||
| top: 0; | |||||
| height: 32px; | height: 32px; | ||||
| } | } | ||||
| `; | `; | ||||
| export const RemoveIconContainer = styled(IconButton)` | export const RemoveIconContainer = styled(IconButton)` | ||||
| width: 40px; | width: 40px; | ||||
| height: 40px; | height: 40px; | ||||
| position: relative; | |||||
| top: 4px; | |||||
| background-color: ${selectedTheme.colors.primaryIconBackgroundColor}; | background-color: ${selectedTheme.colors.primaryIconBackgroundColor}; | ||||
| border-radius: 100%; | border-radius: 100%; | ||||
| padding-top: 2px; | padding-top: 2px; | ||||
| text-align: center; | text-align: center; | ||||
| margin-left: 18px; | |||||
| /* margin-left: 18px; */ | |||||
| @media screen and (max-width: 600px) { | @media screen and (max-width: 600px) { | ||||
| width: 32px; | width: 32px; | ||||
| top: 0; | |||||
| height: 32px; | height: 32px; | ||||
| } | } | ||||
| `; | `; | ||||
| export const DateButtonsContainer = styled(Box)` | export const DateButtonsContainer = styled(Box)` | ||||
| display: flex; | display: flex; | ||||
| align-items: center; | |||||
| position: absolute; | |||||
| right: 220px; | |||||
| bottom: 22px; | |||||
| @media screen and (max-width: 600px) { | @media screen and (max-width: 600px) { | ||||
| top: 0; | |||||
| right: -10px; | |||||
| position: absolute; | |||||
| bottom: initial; | |||||
| top: 58px; | |||||
| right: 12px; | |||||
| } | } | ||||
| `; | `; | ||||
| export const CheckButton = styled(PrimaryButton)` | export const CheckButton = styled(PrimaryButton)` | ||||
| width: 180px; | width: 180px; | ||||
| height: 48px; | height: 48px; | ||||
| position: absolute; | |||||
| bottom: 9px; | |||||
| right: 12px; | |||||
| font-weight: 600; | font-weight: 600; | ||||
| &:hover button { | &:hover button { | ||||
| color: white !important; | color: white !important; | ||||
| } | } | ||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| height: 44px; | height: 44px; | ||||
| position: absolute; | |||||
| bottom: 9px; | |||||
| right: 9px; | |||||
| } | } | ||||
| `; | `; | ||||
| // export const OfferImage = styled.img` | // export const OfferImage = styled.img` | ||||
| width: 18px; | width: 18px; | ||||
| height: 20px; | 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; | |||||
| } | |||||
| ` |
| DesciprtionPostDate, | DesciprtionPostDate, | ||||
| } from "./OfferDetails.styled"; | } from "./OfferDetails.styled"; | ||||
| import { useTranslation } from "react-i18next"; | import { useTranslation } from "react-i18next"; | ||||
| import useScreenDimensions from "../../../../hooks/useScreenDimensions"; | |||||
| import { formatDateLocale } from "../../../../util/helpers/dateHelpers"; | import { formatDateLocale } from "../../../../util/helpers/dateHelpers"; | ||||
| import useIsMobile from "../../../../hooks/useIsMobile"; | import useIsMobile from "../../../../hooks/useIsMobile"; | ||||
| import { getImageUrl, variants } from "../../../../util/helpers/imageUrlGetter"; | import { getImageUrl, variants } from "../../../../util/helpers/imageUrlGetter"; | ||||
| const OfferDetails = (props) => { | const OfferDetails = (props) => { | ||||
| const offer = props.offer; | const offer = props.offer; | ||||
| const { t } = useTranslation(); | const { t } = useTranslation(); | ||||
| const dimension = useScreenDimensions(); | |||||
| const { isMobile } = useIsMobile(); | const { isMobile } = useIsMobile(); | ||||
| const [images, setImages] = useState([]); | const [images, setImages] = useState([]); | ||||
| const [imagesCarouselModal, setImagesCarouselModal] = useState(false); | const [imagesCarouselModal, setImagesCarouselModal] = useState(false); | ||||
| singleOffer={props.singleOffer} | singleOffer={props.singleOffer} | ||||
| previewCard={props.previewCard} | 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> | <ScrollerVertical> | ||||
| {props?.offer?.offer?.images.map((item, index) => ( | {props?.offer?.offer?.images.map((item, index) => ( | ||||
| <OfferImage | <OfferImage | ||||
| <OfferTitle singleOffer={props.singleOffer}> | <OfferTitle singleOffer={props.singleOffer}> | ||||
| {offer?.offer?.name} | {offer?.offer?.name} | ||||
| </OfferTitle> | </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 | <OfferLittleDetails | ||||
| singleOffer={props.singleOffer} | singleOffer={props.singleOffer} | ||||
| previewCard={props.previewCard} | previewCard={props.previewCard} |
| ${(props) => props.hasScrollBar && !props.exchange && `height: 340px;`} | ${(props) => props.hasScrollBar && !props.exchange && `height: 340px;`} | ||||
| /* overflow-y: auto; */ | /* overflow-y: auto; */ | ||||
| overflow-y: hidden; | overflow-y: hidden; | ||||
| padding-bottom: 50px; | |||||
| /* ::-webkit-scrollbar { | /* ::-webkit-scrollbar { | ||||
| width: 5px; | width: 5px; | ||||
| } | } | ||||
| } */ | } */ | ||||
| @media screen and (max-width: 600px) { | @media screen and (max-width: 600px) { | ||||
| flex-direction: column-reverse; | |||||
| flex-direction: column; | |||||
| margin-top: 15px; | margin-top: 15px; | ||||
| min-height: 300px; | min-height: 300px; | ||||
| ${(props) => | ${(props) => | ||||
| @media screen and (max-width: 600px) { | @media screen and (max-width: 600px) { | ||||
| padding: 0 8px; | padding: 0 8px; | ||||
| font-size: 18px; | font-size: 18px; | ||||
| overflow: hidden; | |||||
| text-overflow: ellipsis; | |||||
| white-space: nowrap; | |||||
| max-width: 240px; | |||||
| } | } | ||||
| `; | `; | ||||
| export const OfferLittleDetails = styled(Box)` | export const OfferLittleDetails = styled(Box)` | ||||
| padding: ${(props) => (props.singleOffer ? 0 : "0 60px")}; | padding: ${(props) => (props.singleOffer ? 0 : "0 60px")}; | ||||
| margin-top: 10px; | margin-top: 10px; | ||||
| padding-right: 18px; | padding-right: 18px; | ||||
| overflow-y: auto; | |||||
| overflow-y: ${props => !props.previewCard && `auto`}; | |||||
| ${(props) => | ${(props) => | ||||
| !props.singleOffer && | !props.singleOffer && | ||||
| ` | ` | ||||
| `} | `} | ||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| padding: 0 8px; | padding: 0 8px; | ||||
| position: absolute; | |||||
| top: 270px; | |||||
| /* position: absolute; */ | |||||
| /* top: 270px; */ | |||||
| justify-content: start; | justify-content: start; | ||||
| height: 300px; | |||||
| ${(props) => props.previewCard && `height: 100px;`}; | |||||
| /* height: 300px; */ | |||||
| ${(props) => props.previewCard && `height: 100px;`} | |||||
| width: 97%; | width: 97%; | ||||
| } | } | ||||
| `; | `; |
| import history from "../../../store/utils/history"; | import history from "../../../store/utils/history"; | ||||
| import { replaceInRoute } from "../../../util/helpers/routeHelpers"; | import { replaceInRoute } from "../../../util/helpers/routeHelpers"; | ||||
| import { CHAT_MESSAGE_PAGE } from "../../../constants/pages"; | import { CHAT_MESSAGE_PAGE } from "../../../constants/pages"; | ||||
| import BlockedProfile from "../ProfileCard/BlockedProfile/BlockedProfile"; | |||||
| const MiniChatCard = (props) => { | const MiniChatCard = (props) => { | ||||
| const { t } = useTranslation(); | const { t } = useTranslation(); | ||||
| }) | }) | ||||
| ); | ); | ||||
| }; | }; | ||||
| console.log(props); | |||||
| return ( | return ( | ||||
| <MiniChatCardContainer selected={props.selected} onClick={changeChat}> | <MiniChatCardContainer selected={props.selected} onClick={changeChat}> | ||||
| <ProfileImage | <ProfileImage | ||||
| isMobile | isMobile | ||||
| )} | )} | ||||
| /> | /> | ||||
| <ProfileDetails> | |||||
| <ProfileDetails isBlocked={props.chat.interlocutorData?._blocked}> | |||||
| {props.chat.interlocutorData?._blocked && ( | |||||
| <BlockedProfile redText chatCard shortText aboveTitle hideIcon /> | |||||
| )} | |||||
| <ProfileName selected={props.selected}> | <ProfileName selected={props.selected}> | ||||
| {props?.chat?.interlocutorData?.name} | {props?.chat?.interlocutorData?.name} | ||||
| </ProfileName> | </ProfileName> |
| border-radius: 4px; | border-radius: 4px; | ||||
| display: flex; | display: flex; | ||||
| flex-direction: row; | flex-direction: row; | ||||
| height: 108px; | |||||
| min-height: 108px; | |||||
| margin-bottom: 18px; | margin-bottom: 18px; | ||||
| padding: 18px; | padding: 18px; | ||||
| cursor: pointer; | cursor: pointer; | ||||
| font-weight: 600; | font-weight: 600; | ||||
| font-family: ${selectedTheme.fonts.textFont}; | font-family: ${selectedTheme.fonts.textFont}; | ||||
| color: ${props => props.selected ? selectedTheme.colors.primaryYellow : selectedTheme.colors.primaryPurple}; | color: ${props => props.selected ? selectedTheme.colors.primaryYellow : selectedTheme.colors.primaryPurple}; | ||||
| max-height: 38px; | |||||
| height: 38px; | |||||
| `; | `; | ||||
| export const ProfileProduct = styled(Typography)` | export const ProfileProduct = styled(Typography)` | ||||
| margin-top: 9px; | margin-top: 9px; |
| import { ADMIN_SINGLE_USER_PAGE } from "../../../../constants/pages"; | import { ADMIN_SINGLE_USER_PAGE } from "../../../../constants/pages"; | ||||
| import DeleteCategory from "../../../Modals/DeleteCategory/DeleteCategory"; | import DeleteCategory from "../../../Modals/DeleteCategory/DeleteCategory"; | ||||
| import UserLabeledCard from "../../LabeledCard/User/UserLabeledCard"; | import UserLabeledCard from "../../LabeledCard/User/UserLabeledCard"; | ||||
| import { USERS_BLOCK_TYPE, USERS_DELETE_TYPE, USERS_UNBLOCK_TYPE } from "../../../../constants/adminTypeConstants"; | |||||
| const BigProfileCard = (props) => { | const BigProfileCard = (props) => { | ||||
| const { t } = useTranslation(); | const { t } = useTranslation(); | ||||
| const removeUser = () => { | const removeUser = () => { | ||||
| setDeleteOrEditModal({ | setDeleteOrEditModal({ | ||||
| show: true, | show: true, | ||||
| type: "deleteUser", | |||||
| type: USERS_DELETE_TYPE, | |||||
| }); | }); | ||||
| }; | }; | ||||
| // console.log(props.profile); | // console.log(props.profile); | ||||
| const blockUser = () => { | const blockUser = () => { | ||||
| setDeleteOrEditModal({ | setDeleteOrEditModal({ | ||||
| show: true, | show: true, | ||||
| type: "blockUser", | |||||
| type: USERS_BLOCK_TYPE, | |||||
| }); | }); | ||||
| }; | }; | ||||
| const unblockUser = () => { | const unblockUser = () => { | ||||
| setDeleteOrEditModal({ | setDeleteOrEditModal({ | ||||
| show: true, | show: true, | ||||
| type: "unblockUser", | |||||
| type: USERS_UNBLOCK_TYPE, | |||||
| }); | }); | ||||
| }; | }; | ||||
| const goToUser = () => { | const goToUser = () => { |
| 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; |
| 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; | |||||
| } | |||||
| `; |
| ProfileInfoAndContactContainer, | ProfileInfoAndContactContainer, | ||||
| UnblockButton, | UnblockButton, | ||||
| UnblockIcon, | UnblockIcon, | ||||
| BlockedProfileText, | |||||
| BlockedIcon, | |||||
| BlockedProfileTextContainer, | |||||
| BlockedIconContainer, | |||||
| BlockedContainer, | |||||
| } from "./ProfileCard.styled"; | } from "./ProfileCard.styled"; | ||||
| import PersonOutlineIcon from "@mui/icons-material/PersonOutline"; | import PersonOutlineIcon from "@mui/icons-material/PersonOutline"; | ||||
| import { useRouteMatch } from "react-router-dom"; | import { useRouteMatch } from "react-router-dom"; | ||||
| import UserLabeledCard from "../LabeledCard/User/UserLabeledCard"; | import UserLabeledCard from "../LabeledCard/User/UserLabeledCard"; | ||||
| import history from "../../../store/utils/history"; | import history from "../../../store/utils/history"; | ||||
| import { HOME_PAGE } from "../../../constants/pages"; | import { HOME_PAGE } from "../../../constants/pages"; | ||||
| import useIsMobile from "../../../hooks/useIsMobile"; | |||||
| import BlockedProfile from "./BlockedProfile/BlockedProfile"; | |||||
| const ProfileCard = (props) => { | const ProfileCard = (props) => { | ||||
| const [editProfileModal, setEditProfileModal] = useState(false); | const [editProfileModal, setEditProfileModal] = useState(false); | ||||
| const isLoading = useSelector(selectIsLoadingByActionType(PROFILE_SCOPE)); | const isLoading = useSelector(selectIsLoadingByActionType(PROFILE_SCOPE)); | ||||
| const routeMatch = useRouteMatch(); | const routeMatch = useRouteMatch(); | ||||
| const dispatch = useDispatch(); | const dispatch = useDispatch(); | ||||
| const { isMobile } = useIsMobile(); | |||||
| const profileFromRedux = useSelector(selectProfile); | const profileFromRedux = useSelector(selectProfile); | ||||
| const userId = useSelector(selectUserId); | const userId = useSelector(selectUserId); | ||||
| const idProfile = useMemo(() => { | const idProfile = useMemo(() => { | ||||
| <ProfileCardWrapper | <ProfileCardWrapper | ||||
| variant="outlined" | variant="outlined" | ||||
| isMyProfile={isMyProfile} | isMyProfile={isMyProfile} | ||||
| blocked={profile?._blocked} | |||||
| blocked={!props.isAdmin && profile?._blocked} | |||||
| > | > | ||||
| <ButtonsContainer> | <ButtonsContainer> | ||||
| {profile?._blocked && ( | |||||
| <BlockedContainer> | |||||
| <BlockedProfileTextContainer> | |||||
| <BlockedProfileText> | |||||
| {t("profile.blockedProfile")} | |||||
| </BlockedProfileText> | |||||
| </BlockedProfileTextContainer> | |||||
| <BlockedIconContainer> | |||||
| <BlockedIcon /> | |||||
| </BlockedIconContainer> | |||||
| </BlockedContainer> | |||||
| )} | |||||
| {profile?._blocked && !isMobile && <BlockedProfile />} | |||||
| {props.isAdmin && ( | {props.isAdmin && ( | ||||
| <> | <> | ||||
| {profile?._blocked ? ( | {profile?._blocked ? ( | ||||
| )} | )} | ||||
| </ButtonsContainer> | </ButtonsContainer> | ||||
| <ProfileInfoContainer> | <ProfileInfoContainer> | ||||
| <ProfileInfoAndContactContainer> | |||||
| <ProfileInfoAndContactContainer isAdmin={props.isAdmin}> | |||||
| {profile?._blocked && !props.isAdmin && isMobile && ( | |||||
| <BlockedProfile aboveTitle isAdmin={props.isAdmin} /> | |||||
| )} | |||||
| {/* Profile Main Info */} | {/* Profile Main Info */} | ||||
| <ProfileMainInfo | <ProfileMainInfo | ||||
| isAdmin={props.isAdmin} | |||||
| profile={profile} | profile={profile} | ||||
| isMyProfile={isMyProfile} | isMyProfile={isMyProfile} | ||||
| isBlocked={profile?._blocked} | |||||
| isBlocked={!props.isAdmin && profile?._blocked} | |||||
| /> | /> | ||||
| {/* Profile Contact */} | {/* Profile Contact */} | ||||
| <ProfileContact | <ProfileContact | ||||
| profile={profile} | profile={profile} | ||||
| isMyProfile={profile?._blocked || isMyProfile} | |||||
| isAdmin={props.isAdmin} | |||||
| isMyProfile={ | |||||
| (!props.isAdmin && profile?._blocked) || isMyProfile | |||||
| } | |||||
| /> | /> | ||||
| </ProfileInfoAndContactContainer> | </ProfileInfoAndContactContainer> | ||||
| {/* Profile Stats */} | {/* Profile Stats */} | ||||
| )} | )} | ||||
| {deleteOrEditModal.show && ( | {deleteOrEditModal.show && ( | ||||
| <DeleteCategory | <DeleteCategory | ||||
| customId={profile?._id} | |||||
| setOpenedDeleteModal={closeModalHandler} | setOpenedDeleteModal={closeModalHandler} | ||||
| type={deleteOrEditModal.type} | type={deleteOrEditModal.type} | ||||
| customLabeledCard={<UserLabeledCard user={profile} />} | customLabeledCard={<UserLabeledCard user={profile} />} |
| stroke: ${selectedTheme.colors.iconYellowColor}; | 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)` | export const BlockButton = styled(Box)` | ||||
| width: 40px; | width: 40px; | ||||
| flex-direction: column; | flex-direction: column; | ||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| padding-bottom: 18px; | padding-bottom: 18px; | ||||
| flex-direction: row; | |||||
| flex-direction: ${props => props.isAdmin ? "row" : "column"}; | |||||
| } | } | ||||
| `; | `; | ||||
| export const ProfileContactContainer = styled(Grid)` | export const ProfileContactContainer = styled(Grid)` | ||||
| padding-top: ${(props) => (props.isAdmin ? `20px` : `2rem`)}; | padding-top: ${(props) => (props.isAdmin ? `20px` : `2rem`)}; | ||||
| padding-bottom: ${(props) => (props.isAdmin ? "0" : "2rem")}; | |||||
| padding-bottom: 2rem; | |||||
| @media (max-width: 600px) { | @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; | gap: 5px; | ||||
| width: calc(100vw - 216px); | width: calc(100vw - 216px); | ||||
| } | } |
| replaceInRoute, | replaceInRoute, | ||||
| } from "../../../../util/helpers/routeHelpers"; | } from "../../../../util/helpers/routeHelpers"; | ||||
| import { ADMIN_SINGLE_USER_PAGE } from "../../../../constants/pages"; | import { ADMIN_SINGLE_USER_PAGE } from "../../../../constants/pages"; | ||||
| import BlockedProfile from "../BlockedProfile/BlockedProfile"; | |||||
| const ProfileMainInfo = (props) => { | const ProfileMainInfo = (props) => { | ||||
| const { t } = useTranslation(); | const { t } = useTranslation(); | ||||
| ); | ); | ||||
| } | } | ||||
| }; | }; | ||||
| if (props.profile?.blocked) console.log(props.profile); | |||||
| console.log(props); | |||||
| return ( | return ( | ||||
| <ProfileMainInfoContainer> | |||||
| <ProfileMainInfoContainer isAdmin={props.isAdmin}> | |||||
| <AvatarImageContainer> | <AvatarImageContainer> | ||||
| <AvatarImage | <AvatarImage | ||||
| isAdmin={props.isAdmin} | isAdmin={props.isAdmin} | ||||
| /> | /> | ||||
| </AvatarImageContainer> | </AvatarImageContainer> | ||||
| <ProfileMainInfoGrid> | <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 | <ProfileName | ||||
| isAdmin={props.isAdmin} | isAdmin={props.isAdmin} | ||||
| isMyProfile={props.isMyProfile} | isMyProfile={props.isMyProfile} | ||||
| </ProfileName> | </ProfileName> | ||||
| <ProfilePIBContainer> | <ProfilePIBContainer> | ||||
| <PocketIcon /> | <PocketIcon /> | ||||
| <ProfilePIB isMyProfile={props?.isBlocked || props.isMyProfile} variant="subtitle2"> | |||||
| <ProfilePIB | |||||
| isMyProfile={props?.isBlocked || props.isMyProfile} | |||||
| variant="subtitle2" | |||||
| > | |||||
| {t("profile.PIB")} {props.profile?.company?.PIB} | {t("profile.PIB")} {props.profile?.company?.PIB} | ||||
| </ProfilePIB> | </ProfilePIB> | ||||
| </ProfilePIBContainer> | </ProfilePIBContainer> |
| align-items: start; | align-items: start; | ||||
| flex-direction: row; | flex-direction: row; | ||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| flex-direction: column-reverse; | |||||
| flex-direction: ${(props) => (props.isAdmin ? `column-reverse` : `row`)}; | |||||
| gap: 18px; | gap: 18px; | ||||
| max-width: 108px; | max-width: 108px; | ||||
| } | } |
| handleRemove={handleRemove} | handleRemove={handleRemove} | ||||
| hasGivenReview={props.hasGivenReview} | hasGivenReview={props.hasGivenReview} | ||||
| rightReviews={props.rightReviews} | rightReviews={props.rightReviews} | ||||
| isAdmin={props.isAdmin} | |||||
| /> | /> | ||||
| {removeModalOpened && ( | {removeModalOpened && ( | ||||
| <DeleteReview | <DeleteReview | ||||
| showRemoveIcon: PropTypes.bool, | showRemoveIcon: PropTypes.bool, | ||||
| hasGivenReview: PropTypes.bool, | hasGivenReview: PropTypes.bool, | ||||
| rightReviews: PropTypes.bool, | rightReviews: PropTypes.bool, | ||||
| isAdmin: PropTypes.bool, | |||||
| }; | }; | ||||
| UserReviewsCard.defaultProps = { | UserReviewsCard.defaultProps = { | ||||
| isProfileReviews: false, | isProfileReviews: false, |
| return ( | return ( | ||||
| <ReviewContainer> | <ReviewContainer> | ||||
| {!props.rightReviews && ( | |||||
| {props.isAdmin && !props.rightReviews && ( | |||||
| <GivenReviewsHeader | <GivenReviewsHeader | ||||
| hasGivenReview={props.hasGivenReview} | hasGivenReview={props.hasGivenReview} | ||||
| userWhoReceived={props.review?.userWhoReceived} | userWhoReceived={props.review?.userWhoReceived} | ||||
| hasGivenReview: PropTypes.bool, | hasGivenReview: PropTypes.bool, | ||||
| userWhoReceived: PropTypes.any, | userWhoReceived: PropTypes.any, | ||||
| rightReviews: PropTypes.bool, | rightReviews: PropTypes.bool, | ||||
| isAdmin: PropTypes.bool, | |||||
| }; | }; | ||||
| export default UserReviewsSingleCard; | export default UserReviewsSingleCard; |
| import history from "../../../../store/utils/history"; | import history from "../../../../store/utils/history"; | ||||
| import { replaceInRoute } from "../../../../util/helpers/routeHelpers"; | import { replaceInRoute } from "../../../../util/helpers/routeHelpers"; | ||||
| import { PROFILE_PAGE } from "../../../../constants/pages"; | import { PROFILE_PAGE } from "../../../../constants/pages"; | ||||
| import { selectAmIBlocked } from "../../../../store/selectors/profileSelectors"; | |||||
| import { useSelector } from "react-redux"; | |||||
| const DirectChatContentHeader = (props) => { | const DirectChatContentHeader = (props) => { | ||||
| const [showPhonePopover, setShowPhonePopover] = useState(false); | const [showPhonePopover, setShowPhonePopover] = useState(false); | ||||
| const [phonePopoverAnchorEl, setPhonePopoverAnchorEl] = useState(null); | const [phonePopoverAnchorEl, setPhonePopoverAnchorEl] = useState(null); | ||||
| const { isMobile } = useIsMobile(); | const { isMobile } = useIsMobile(); | ||||
| const mineProfileBlocked = useSelector(selectAmIBlocked); | |||||
| const togglePhonePopover = (event) => { | const togglePhonePopover = (event) => { | ||||
| if (props.interlucator?.telephone) { | if (props.interlucator?.telephone) { | ||||
| } | } | ||||
| }; | }; | ||||
| const routeToUser = () => { | 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 ( | return ( | ||||
| <DirectChatContentHeaderContainer> | <DirectChatContentHeaderContainer> | ||||
| </DirectChatContentHeaderFlexContainer> | </DirectChatContentHeaderFlexContainer> | ||||
| <DirectChatContentHeaderFlexContainer> | <DirectChatContentHeaderFlexContainer> | ||||
| <PhoneIconContainer | <PhoneIconContainer | ||||
| disabled={!props.interlucator?.telephone} | |||||
| disabled={ | |||||
| mineProfileBlocked || | |||||
| props?.interlucator?._blocked || | |||||
| !props.interlucator?.telephone | |||||
| } | |||||
| onClick={togglePhonePopover} | onClick={togglePhonePopover} | ||||
| > | > | ||||
| <PhoneIcon /> | <PhoneIcon /> |
| <OfferCard | <OfferCard | ||||
| offer={props.offer} | offer={props.offer} | ||||
| aboveChat | aboveChat | ||||
| disabledReviews={isDisabledReviews} | |||||
| disabledReviews={props.interlocutor?._blocked || isDisabledReviews} | |||||
| makeReview={makeReview} | makeReview={makeReview} | ||||
| dontShowViews | dontShowViews | ||||
| disabledCheckButton={props?.offer?._deleted} | |||||
| disabledCheckButton={props.interlocutor?._blocked || props?.offer?._deleted} | |||||
| /> | /> | ||||
| </DirectChatHeaderContainer> | </DirectChatHeaderContainer> | ||||
| ); | ); |
| import { validateExchange } from "../../../store/actions/exchange/exchangeActions"; | import { validateExchange } from "../../../store/actions/exchange/exchangeActions"; | ||||
| import NotAllowedChat from "./NotAllowedChat/NotAllowedChat"; | import NotAllowedChat from "./NotAllowedChat/NotAllowedChat"; | ||||
| import { convertLocalDateToUTCDate } from "../../../util/helpers/dateHelpers"; | import { convertLocalDateToUTCDate } from "../../../util/helpers/dateHelpers"; | ||||
| import { selectAmIBlocked } from "../../../store/selectors/profileSelectors"; | |||||
| const DirectChatNewMessage = (props) => { | const DirectChatNewMessage = (props) => { | ||||
| const [typedValue, setTypedValue] = useState(""); | const [typedValue, setTypedValue] = useState(""); | ||||
| const [isFocused, setIsFocused] = useState(false); | const [isFocused, setIsFocused] = useState(false); | ||||
| const exchange = useSelector(selectExchange); | const exchange = useSelector(selectExchange); | ||||
| const dispatch = useDispatch(); | const dispatch = useDispatch(); | ||||
| const mineProfileBlocked = useSelector(selectAmIBlocked); | |||||
| const { t } = useTranslation(); | const { t } = useTranslation(); | ||||
| const location = useLocation(); | const location = useLocation(); | ||||
| const history = useHistory(); | const history = useHistory(); | ||||
| }) | }) | ||||
| ); | ); | ||||
| }; | }; | ||||
| console.log("newm", props); | |||||
| if (mineProfileBlocked) { | |||||
| return <NotAllowedChat mineProfileBlocked />; | |||||
| } | |||||
| if (props?.chat?.offer?.offer?._deleted) { | if (props?.chat?.offer?.offer?._deleted) { | ||||
| return <NotAllowedChat />; | return <NotAllowedChat />; | ||||
| } | } | ||||
| if (props?.chat?.interlocutor?._blocked) { | |||||
| return <NotAllowedChat blocked />; | |||||
| } | |||||
| return ( | return ( | ||||
| <> | <> | ||||
| <DirectChatNewMessageContainer> | <DirectChatNewMessageContainer> |
| } from "./NotAllowedChat.styled"; | } from "./NotAllowedChat.styled"; | ||||
| import { useTranslation } from "react-i18next"; | import { useTranslation } from "react-i18next"; | ||||
| const NotAllowedChat = () => { | |||||
| const NotAllowedChat = (props) => { | |||||
| const { t } = useTranslation(); | const { t } = useTranslation(); | ||||
| return ( | return ( | ||||
| <NotAllowedChatContainer> | <NotAllowedChatContainer> | ||||
| <NotAllowedChatText>{t("messages.notAllowedChat")}</NotAllowedChatText> | |||||
| <NotAllowedChatText> | |||||
| {props.mineProfileBlocked | |||||
| ? t("profile.mineProfileBlocked") | |||||
| : props.blocked | |||||
| ? t("profile.blockedProfile") | |||||
| : t("messages.notAllowedChat")} | |||||
| </NotAllowedChatText> | |||||
| </NotAllowedChatContainer> | </NotAllowedChatContainer> | ||||
| ); | ); | ||||
| }; | }; | ||||
| NotAllowedChat.propTypes = { | NotAllowedChat.propTypes = { | ||||
| children: PropTypes.node, | children: PropTypes.node, | ||||
| blocked: PropTypes.bool, | |||||
| mineProfileBlocked: PropTypes.bool, | |||||
| }; | }; | ||||
| export default NotAllowedChat; | export default NotAllowedChat; |
| display: flex; | display: flex; | ||||
| flex-direction: column; | flex-direction: column; | ||||
| margin-left: 20px; | margin-left: 20px; | ||||
| overflow: hidden; | |||||
| width: 100%; | width: 100%; | ||||
| @media (max-width: 600px) { | @media (max-width: 600px) { |
| import { useDispatch } from "react-redux"; | import { useDispatch } from "react-redux"; | ||||
| import { fetchAdminMethod } from "../../../store/actions/admin/adminActions"; | import { fetchAdminMethod } from "../../../store/actions/admin/adminActions"; | ||||
| import { DELETE_TYPE } from "../../../constants/adminMethodConstants"; | 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 DeleteCategory = (props) => { | ||||
| const dispatch = useDispatch(); | const dispatch = useDispatch(); | ||||
| }, [props, t]); | }, [props, t]); | ||||
| const handleApiResponseSuccess = () => { | const handleApiResponseSuccess = () => { | ||||
| if (dynamicRouteMatches(ADMIN_SINGLE_USER_PAGE)) { | |||||
| dispatch(fetchProfile(props.customId)) | |||||
| } | |||||
| handleCancel(); | handleCancel(); | ||||
| }; | }; | ||||
| font-weight: 700; | font-weight: 700; | ||||
| color: ${selectedTheme.colors.primaryPurple}; | color: ${selectedTheme.colors.primaryPurple}; | ||||
| cursor: pointer; | cursor: pointer; | ||||
| max-width: 170px; | |||||
| display: inline-block; | |||||
| overflow: hidden; | |||||
| text-overflow: ellipsis; | |||||
| white-space: nowrap; | |||||
| } | } | ||||
| & p { | & p { | ||||
| display: -webkit-box; | |||||
| -webkit-line-clamp: 2; | |||||
| -webkit-box-orient: vertical; | |||||
| overflow: hidden; | overflow: hidden; | ||||
| max-height: 32px; | max-height: 32px; | ||||
| font-size: 0.81rem; | font-size: 0.81rem; | ||||
| export const NameOfProduct = styled(Typography)` | export const NameOfProduct = styled(Typography)` | ||||
| font-size: 12px; | font-size: 12px; | ||||
| font-weight: 700; | font-weight: 700; | ||||
| max-width: 100px; | |||||
| display: inline-block; | |||||
| overflow: hidden; | |||||
| text-overflow: ellipsis; | |||||
| white-space: nowrap; | |||||
| font-family: ${selectedTheme.fonts.textFont}; | font-family: ${selectedTheme.fonts.textFont}; | ||||
| letter-spacing: 0.02em; | letter-spacing: 0.02em; | ||||
| color: ${selectedTheme.colors.primaryDarkText}; | color: ${selectedTheme.colors.primaryDarkText}; |
| showRemoveIcon={props.isAdmin} | showRemoveIcon={props.isAdmin} | ||||
| review={review} | review={review} | ||||
| key={index} | key={index} | ||||
| isAdmin={props.isAdmin} | |||||
| hasGivenReview={sortRef.current?.hasGivenReview} | hasGivenReview={sortRef.current?.hasGivenReview} | ||||
| givingReview={props.givingReview} | givingReview={props.givingReview} | ||||
| rightReviews={props.rightReviews} | rightReviews={props.rightReviews} |
| import styled from "styled-components"; | |||||
| import styled, { css } from "styled-components"; | |||||
| import { List, Box, Typography, Grid } from "@mui/material"; | import { List, Box, Typography, Grid } from "@mui/material"; | ||||
| import ThumbUpIcon from "@mui/icons-material/ThumbUp"; | import ThumbUpIcon from "@mui/icons-material/ThumbUp"; | ||||
| import ThumbDownIcon from "@mui/icons-material/ThumbDown"; | import ThumbDownIcon from "@mui/icons-material/ThumbDown"; | ||||
| export const ReviewsBox = styled(Box)` | export const ReviewsBox = styled(Box)` | ||||
| width: 100%; | width: 100%; | ||||
| min-width: 290px; | |||||
| min-width: 350px; | |||||
| ${(props) => | ${(props) => | ||||
| props.profile && | 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) { | @media (max-width: 600px) { | ||||
| position: relative; | position: relative; | ||||
| min-width: 290px; | |||||
| top: -45px; | top: -45px; | ||||
| overflow: hidden; | overflow: hidden; | ||||
| max-height: ${(props) => | max-height: ${(props) => | ||||
| ? "450px" | ? "450px" | ||||
| : "350px"}; | : "350px"}; | ||||
| padding: 0; | padding: 0; | ||||
| margin: 0 ${props => props.isAdmin ? "18px" : "0"}; | |||||
| margin: 0 ${(props) => (props.isAdmin ? "18px" : "0")}; | |||||
| margin-top: 60px; | margin-top: 60px; | ||||
| } | } | ||||
| `; | `; |
| export const LOCATIONS_TYPE = "locations"; | export const LOCATIONS_TYPE = "locations"; | ||||
| export const REVIEW_TYPE = "reviews"; | export const REVIEW_TYPE = "reviews"; | ||||
| export const USERS_BLOCK_TYPE = "blockUser"; | export const USERS_BLOCK_TYPE = "blockUser"; | ||||
| export const USERS_UNBLOCK_TYPE = "unblockUser"; | |||||
| export const USERS_DELETE_TYPE = "deleteUser" | export const USERS_DELETE_TYPE = "deleteUser" |
| messages: { | messages: { | ||||
| headerTitle: "Moje Ćaskanje", | headerTitle: "Moje Ćaskanje", | ||||
| cardProduct: "Proizvod: ", | cardProduct: "Proizvod: ", | ||||
| chatCardBlocked: "(blokiran korisnik)", | |||||
| miniChatHeaderTitle: "Moje Poruke", | miniChatHeaderTitle: "Moje Poruke", | ||||
| send: "Pošalji", | send: "Pošalji", | ||||
| sendPlaceholder: "Poruka...", | sendPlaceholder: "Poruka...", | ||||
| myOffers: "Moje objave", | myOffers: "Moje objave", | ||||
| profileOffers: "Objave kompanije", | profileOffers: "Objave kompanije", | ||||
| blockedProfile: "Trenutno blokiran profil", | blockedProfile: "Trenutno blokiran profil", | ||||
| blockedProfileShort: "Blokiran profil", | |||||
| mineProfileBlocked: "Vaš profil je trenutno blokiran.", | |||||
| deletedProfile: "Obrisan profil" | deletedProfile: "Obrisan profil" | ||||
| }, | }, | ||||
| about: { | about: { |
| <ChatGridLayoutContainer> | <ChatGridLayoutContainer> | ||||
| {props.children} | {props.children} | ||||
| <GridContainer container maxHeight="xl" spacing={2}> | <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} | {props.leftCard} | ||||
| </GridLeftCard> | </GridLeftCard> | ||||
| <GridContent item xs={12} lg={9} xl={9.6} md={8}> | |||||
| <GridContent item xs={12} lg={9} xl={9} md={8}> | |||||
| {props.content} | {props.content} | ||||
| </GridContent> | </GridContent> | ||||
| </GridContainer> | </GridContainer> |
| } | } | ||||
| `; | `; | ||||
| export const GridContainer = styled(Grid)` | export const GridContainer = styled(Grid)` | ||||
| max-width: none; | |||||
| ` | ` | ||||
| export const GridContent = styled(Grid)` | export const GridContent = styled(Grid)` | ||||
| ` | ` |
| profile={props.profile} | profile={props.profile} | ||||
| > | > | ||||
| {props.children} | {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} | {props.rightCard} | ||||
| </RightCard> | </RightCard> | ||||
| </ContentRightCardContainer> | </ContentRightCardContainer> |
| import { Container, Grid, Box } from "@mui/material"; | |||||
| import { Container, Grid } from "@mui/material"; | |||||
| import styled from "styled-components"; | import styled from "styled-components"; | ||||
| export const ItemDetailsLayoutContainer = styled(Container)` | export const ItemDetailsLayoutContainer = styled(Container)` | ||||
| margin: 0; | margin: 0; | ||||
| padding: 0; | |||||
| padding-left: 20px; | |||||
| padding-right: 54px; | |||||
| max-width: 100vw; | max-width: 100vw; | ||||
| position: relative; | position: relative; | ||||
| height: 100%; | 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)` | export const RightCard = styled(Grid)` | ||||
| margin-top: 0; | margin-top: 0; | ||||
| margin-left: 0; | margin-left: 0; | ||||
| padding-right: 18px; | |||||
| padding-left: 0; | padding-left: 0; | ||||
| ${(props) => props.profile && `min-width: 350px;`} | ${(props) => props.profile && `min-width: 350px;`} | ||||
| margin-bottom: 18px; | |||||
| @media screen and (min-width: 600px) { | @media screen and (min-width: 600px) { | ||||
| margin-top: 34px; | margin-top: 34px; | ||||
| /* margin-left: ${(props) => (props.profile ? "0" : "36px")}; */ | /* margin-left: ${(props) => (props.profile ? "0" : "36px")}; */ | ||||
| /* padding-left: ${(props) => (props.singleOffer ? "36px" : 0)}; */ | /* padding-left: ${(props) => (props.singleOffer ? "36px" : 0)}; */ | ||||
| border-top-right-radius: 4px; | border-top-right-radius: 4px; | ||||
| min-width: 0; | |||||
| ${(props) => props.singleOffer && `width: 100%`} | ${(props) => props.singleOffer && `width: 100%`} | ||||
| } | } | ||||
| @media screen and (max-width: 1200px) { | @media screen and (max-width: 1200px) { | ||||
| margin-left: 0; | margin-left: 0; | ||||
| } | } | ||||
| @media (max-width: 600px) { | |||||
| width: 100%; | |||||
| } | |||||
| `; | `; | ||||
| export const Content = styled(Grid)` | export const Content = styled(Grid)` | ||||
| width: 100%; | width: 100%; | ||||
| @media (max-width: 600px) { | |||||
| padding-right: 16px; | |||||
| } | |||||
| `; | `; |
| profile={props.profile} | profile={props.profile} | ||||
| > | > | ||||
| {props.children} | {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} | {props.rightCard} | ||||
| </RightCard> | </RightCard> | ||||
| </ContentRightCardContainer> | </ContentRightCardContainer> |
| import { Container, Grid, Box } from "@mui/material"; | |||||
| import { Container, Grid } from "@mui/material"; | |||||
| import styled from "styled-components"; | import styled from "styled-components"; | ||||
| export const ProfileLayoutContainer = styled(Container)` | 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)` | export const RightCard = styled(Grid)` | ||||
| padding-left: 0; | padding-left: 0; | ||||
| ${(props) => props.profile && `min-width: 350px;`} | ${(props) => props.profile && `min-width: 350px;`} | ||||
| @media screen and (min-width: 600px) { | @media screen and (min-width: 600px) { | ||||
| margin-top: 34px; | margin-top: 34px; | ||||
| margin-left: ${(props) => (props.profile ? "0" : "36px")}; | margin-left: ${(props) => (props.profile ? "0" : "36px")}; | ||||
| padding-left: ${(props) => (props.singleOffer ? "36px" : 0)}; | padding-left: ${(props) => (props.singleOffer ? "36px" : 0)}; | ||||
| border-top-right-radius: 4px; | border-top-right-radius: 4px; | ||||
| min-width: 0; | |||||
| ${(props) => props.singleOffer && `width: 100%`} | ${(props) => props.singleOffer && `width: 100%`} | ||||
| } | } | ||||
| @media screen and (max-width: 1200px) { | @media screen and (max-width: 1200px) { | ||||
| margin-left: 0; | margin-left: 0; | ||||
| } | } | ||||
| @media (max-width: 600px) { | |||||
| min-width: 0; | |||||
| } | |||||
| `; | `; | ||||
| export const Content = styled(Grid)` | export const Content = styled(Grid)` | ||||
| width: 100%; | width: 100%; |
| import UserReviews from "../../../../components/UserReviews/UserReviews"; | import UserReviews from "../../../../components/UserReviews/UserReviews"; | ||||
| export const AdminSingleUserPageContainer = styled(Box)` | export const AdminSingleUserPageContainer = styled(Box)` | ||||
| margin: 0 20px; | |||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| margin: 0; | |||||
| margin-top: 90px; | margin-top: 90px; | ||||
| } | } | ||||
| `; | `; | ||||
| export const AdminSingleUserPageProfile = styled(Profile)` | export const AdminSingleUserPageProfile = styled(Profile)` | ||||
| margin-bottom: 5px; | margin-bottom: 5px; | ||||
| `; | `; | ||||
| export const AdminSingleUserPageReviews = styled(UserReviews)` | export const AdminSingleUserPageReviews = styled(UserReviews)` | ||||
| padding: 0 50px; | |||||
| padding: 0; | |||||
| padding-right: 33px; | |||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| padding: 0; | padding: 0; | ||||
| width: calc(100% - 36px); | |||||
| width: 100%; | |||||
| & > div { | & > div { | ||||
| margin-top: 0; | margin-top: 0; | ||||
| height: 500px; | height: 500px; |
| export const ItemDetailsPageContainer = styled(Container)` | export const ItemDetailsPageContainer = styled(Container)` | ||||
| padding: 0; | padding: 0; | ||||
| margin: 0; | margin: 0; | ||||
| margin-top: 80px; | |||||
| margin-top: 72px; | |||||
| height: 100%; | height: 100%; | ||||
| width: 100%; | width: 100%; | ||||
| max-width: none; | max-width: none; |
| getAllProfilesAsAdmin: "admin/users", | getAllProfilesAsAdmin: "admin/users", | ||||
| deleteProfileAsAdmin: "admin/users/{userId}", | deleteProfileAsAdmin: "admin/users/{userId}", | ||||
| blockProfileAsAdmin: "admin/users/{userId}/block", | blockProfileAsAdmin: "admin/users/{userId}/block", | ||||
| unblockProfileAsAdmin: "admin/users/{userId}/unblock", | |||||
| }, | }, | ||||
| applications: { | applications: { | ||||
| application: "/applications/{applicationUid}", | application: "/applications/{applicationUid}", |
| userId: payload.userId, | userId: payload.userId, | ||||
| }) | }) | ||||
| ); | ); | ||||
| export const attemptUnblockProfileAsAdmin = (payload) => | |||||
| patchRequest( | |||||
| replaceInUrl(apiEndpoints.users.unblockProfileAsAdmin, { | |||||
| userId: payload.userId, | |||||
| }) | |||||
| ); |
| SUBCATEGORIES_TYPE, | SUBCATEGORIES_TYPE, | ||||
| USERS_BLOCK_TYPE, | USERS_BLOCK_TYPE, | ||||
| USERS_DELETE_TYPE, | USERS_DELETE_TYPE, | ||||
| USERS_UNBLOCK_TYPE, | |||||
| } from "../../constants/adminTypeConstants"; | } from "../../constants/adminTypeConstants"; | ||||
| import { | import { | ||||
| attemptAddNewCategory, | attemptAddNewCategory, | ||||
| attemptDeleteLocation, | attemptDeleteLocation, | ||||
| attemptEditLocation, | attemptEditLocation, | ||||
| } from "../../request/locationsRequest"; | } from "../../request/locationsRequest"; | ||||
| import { attemptBlockProfileAsAdmin, attemptDeleteProfileAsAdmin } from "../../request/profileRequest"; | |||||
| import { attemptBlockProfileAsAdmin, attemptDeleteProfileAsAdmin, attemptUnblockProfileAsAdmin } from "../../request/profileRequest"; | |||||
| // import { attemptAddNewCategory } from "../../request/categoriesRequest"; | // import { attemptAddNewCategory } from "../../request/categoriesRequest"; | ||||
| import { ADMIN_FETCH } from "../actions/admin/adminActionConstants"; | import { ADMIN_FETCH } from "../actions/admin/adminActionConstants"; | ||||
| import { | import { | ||||
| yield call(console.log, e); | 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 }) { | function* fetchAdminMethod({ payload }) { | ||||
| try { | try { | ||||
| yield call(deleteUser, { id: payload.id }); | yield call(deleteUser, { id: payload.id }); | ||||
| } else if (payload.type === USERS_BLOCK_TYPE) { | } else if (payload.type === USERS_BLOCK_TYPE) { | ||||
| yield call(blockUser, { id: payload.id }); | yield call(blockUser, { id: payload.id }); | ||||
| } else if (payload.type === USERS_UNBLOCK_TYPE) { | |||||
| yield call(unblockUser, {id: payload.id}) | |||||
| } | } | ||||
| if (payload.handleApiResponseSuccess) | if (payload.handleApiResponseSuccess) | ||||
| yield call(payload.handleApiResponseSuccess); | yield call(payload.handleApiResponseSuccess); |
| profileSelector, | profileSelector, | ||||
| state => state.allProfiles?.total | state => state.allProfiles?.total | ||||
| ) | ) | ||||
| export const selectAmIBlocked = createSelector( | |||||
| profileSelector, | |||||
| state => state?.mineProfile?._blocked | |||||
| ) |