| <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"> | <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||||
| <g clip-path="url(#clip0_1412_9649)"> | |||||
| <g clip-path="url(#clip0_2930_12933)"> | |||||
| <path d="M9 16.5C13.1421 16.5 16.5 13.1421 16.5 9C16.5 4.85786 13.1421 1.5 9 1.5C4.85786 1.5 1.5 4.85786 1.5 9C1.5 13.1421 4.85786 16.5 9 16.5Z" stroke="#5A3984" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/> | <path d="M9 16.5C13.1421 16.5 16.5 13.1421 16.5 9C16.5 4.85786 13.1421 1.5 9 1.5C4.85786 1.5 1.5 4.85786 1.5 9C1.5 13.1421 4.85786 16.5 9 16.5Z" stroke="#5A3984" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/> | ||||
| <path d="M3.69727 3.69727L14.3023 14.3023" stroke="#5A3984" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/> | |||||
| <path d="M6 9H12" stroke="#5A3984" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/> | |||||
| </g> | </g> | ||||
| <defs> | <defs> | ||||
| <clipPath id="clip0_1412_9649"> | |||||
| <clipPath id="clip0_2930_12933"> | |||||
| <rect width="18" height="18" fill="white"/> | <rect width="18" height="18" fill="white"/> | ||||
| </clipPath> | </clipPath> | ||||
| </defs> | </defs> |
| <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"> | |||||
| <g clip-path="url(#clip0_2944_12839)"> | |||||
| <path d="M10 17.5C14.1421 17.5 17.5 14.1421 17.5 10C17.5 5.85786 14.1421 2.5 10 2.5C5.85786 2.5 2.5 5.85786 2.5 10C2.5 14.1421 5.85786 17.5 10 17.5Z" stroke="#FEB005" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/> | |||||
| <path d="M7 10H13" stroke="#FEB005" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/> | |||||
| </g> | |||||
| <path d="M1 17.5L17.5 0.999999" stroke="#5A3984" stroke-linecap="round" stroke-linejoin="round"/> | |||||
| <path d="M3 18.5L19.5 2" stroke="#5A3984" stroke-linecap="round" stroke-linejoin="round"/> | |||||
| <path d="M1.74927 18.2505L18.2493 1.75049" stroke="#FEB005" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/> | |||||
| <defs> | |||||
| <clipPath id="clip0_2944_12839"> | |||||
| <rect width="18" height="18" fill="white" transform="translate(1 1)"/> | |||||
| </clipPath> | |||||
| </defs> | |||||
| </svg> |
| <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"> | |||||
| <g clip-path="url(#clip0_2930_12825)"> | |||||
| <path d="M10 17.5C14.1421 17.5 17.5 14.1421 17.5 10C17.5 5.85786 14.1421 2.5 10 2.5C5.85786 2.5 2.5 5.85786 2.5 10C2.5 14.1421 5.85786 17.5 10 17.5Z" stroke="#5A3984" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/> | |||||
| <path d="M7 10H13" stroke="#5A3984" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/> | |||||
| </g> | |||||
| <path d="M1 17.5L17.5 0.999999" stroke="#E4E4E4" stroke-linecap="round" stroke-linejoin="round"/> | |||||
| <path d="M3 18.5L19.5 2" stroke="#E4E4E4" stroke-linecap="round" stroke-linejoin="round"/> | |||||
| <path d="M1.74902 18.2505L18.249 1.75049" stroke="#5A3984" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/> | |||||
| <defs> | |||||
| <clipPath id="clip0_2930_12825"> | |||||
| <rect width="18" height="18" fill="white" transform="translate(1 1)"/> | |||||
| </clipPath> | |||||
| </defs> | |||||
| </svg> |
| flex-wrap: ${(props) => (!props.halfwidth ? "no-wrap" : "wrap")}; | flex-wrap: ${(props) => (!props.halfwidth ? "no-wrap" : "wrap")}; | ||||
| justify-content: start; | justify-content: start; | ||||
| gap: 1rem; | gap: 1rem; | ||||
| @media (max-width: 760px) { | |||||
| @media (max-width: 1150px) { | |||||
| flex-direction: column; | |||||
| justify-content: center; | |||||
| gap: 0; | |||||
| } | |||||
| @media (max-width: 900px) { | |||||
| gap: 1rem; | |||||
| justify-content: start; | |||||
| flex-direction: row; | |||||
| } | |||||
| @media (max-width: 800px) { | |||||
| flex-direction: column; | flex-direction: column; | ||||
| justify-content: center; | justify-content: center; | ||||
| gap: 0; | gap: 0; | ||||
| right: 134px; | right: 134px; | ||||
| top: 18px; | top: 18px; | ||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| ${props => props.vertical && ` | |||||
| ${(props) => | |||||
| props.vertical && | |||||
| ` | |||||
| display: block; | display: block; | ||||
| top: initial; | top: initial; | ||||
| right: initial; | right: initial; | ||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| top: 20px; | top: 20px; | ||||
| right: 55px; | right: 55px; | ||||
| ${props => props.vertical && ` | |||||
| ${(props) => | |||||
| props.vertical && | |||||
| ` | |||||
| top: initial; | top: initial; | ||||
| bottom: 18px; | bottom: 18px; | ||||
| right: 18px; | right: 18px; | ||||
| `} | `} | ||||
| } | } | ||||
| `; | `; | ||||
| export const CategoryIcon = styled(Category)` | export const CategoryIcon = styled(Category)` | ||||
| width: 14px; | width: 14px; |
| SkeletonOfferCardContainer, | SkeletonOfferCardContainer, | ||||
| SkeletonRowGroup, | SkeletonRowGroup, | ||||
| SkeletonTitle, | SkeletonTitle, | ||||
| // SkeletonTitleAboveImage, | |||||
| SkeletonTitleAboveImage, | |||||
| SpreadLine, | SpreadLine, | ||||
| } from "./SkeletonOfferCard.styled"; | } from "./SkeletonOfferCard.styled"; | ||||
| import useIsMobile from "../../../../hooks/useIsMobile"; | import useIsMobile from "../../../../hooks/useIsMobile"; | ||||
| return ( | return ( | ||||
| <SkeletonOfferCardsContainer> | <SkeletonOfferCardsContainer> | ||||
| <SkeletonOfferCardContainer skeleton={props.skeleton}> | <SkeletonOfferCardContainer skeleton={props.skeleton}> | ||||
| <SkeletonTitleAboveImage /> | |||||
| <LeftPart> | <LeftPart> | ||||
| <SkeletonImage /> | <SkeletonImage /> | ||||
| <SkeletonColumnContainer> | <SkeletonColumnContainer> | ||||
| <SkeletonDetail /> | <SkeletonDetail /> | ||||
| <SkeletonDetail /> | <SkeletonDetail /> | ||||
| <SkeletonDetail /> | <SkeletonDetail /> | ||||
| <SkeletonDetail /> | |||||
| </SkeletonRowGroup> | </SkeletonRowGroup> | ||||
| </SkeletonColumnContainer> | </SkeletonColumnContainer> | ||||
| </LeftPart> | </LeftPart> | ||||
| </SkeletonExchangeButton> | </SkeletonExchangeButton> | ||||
| <SkeletonMessageButton /> | <SkeletonMessageButton /> | ||||
| {isMobile && <SkeletonMessageButtonSecond />} | {isMobile && <SkeletonMessageButtonSecond />} | ||||
| {/* <SkeletonTitleAboveImage /> */} | |||||
| </SkeletonOfferCardContainer> | </SkeletonOfferCardContainer> | ||||
| {isMobile && ( | |||||
| {/* {isMobile && ( | |||||
| <SkeletonOfferCardContainer skeleton={props.skeleton}> | <SkeletonOfferCardContainer skeleton={props.skeleton}> | ||||
| <LeftPart> | <LeftPart> | ||||
| <SkeletonImage /> | <SkeletonImage /> | ||||
| </SkeletonExchangeButton> | </SkeletonExchangeButton> | ||||
| <SkeletonMessageButton /> | <SkeletonMessageButton /> | ||||
| {isMobile && <SkeletonMessageButtonSecond />} | {isMobile && <SkeletonMessageButtonSecond />} | ||||
| {/* <SkeletonTitleAboveImage /> */} | |||||
| <SkeletonTitleAboveImage /> | |||||
| </SkeletonOfferCardContainer> | </SkeletonOfferCardContainer> | ||||
| )} | |||||
| )} */} | |||||
| </SkeletonOfferCardsContainer> | </SkeletonOfferCardsContainer> | ||||
| ); | ); | ||||
| }; | }; |
| } | } | ||||
| @media (max-width: 550px) { | @media (max-width: 550px) { | ||||
| height: 184px; | |||||
| height: 194px; | |||||
| padding: 18px; | padding: 18px; | ||||
| padding-top: 12px; | padding-top: 12px; | ||||
| ${(props) => | ${(props) => | ||||
| margin: 0 18px; | margin: 0 18px; | ||||
| `} | `} | ||||
| } | } | ||||
| @media (max-width: 600px) { | |||||
| /* @media (max-width: 600px) { | |||||
| width: 180px; | width: 180px; | ||||
| height: 373px; | height: 373px; | ||||
| margin-right: 18px; | margin-right: 18px; | ||||
| } | |||||
| } */ | |||||
| `; | `; | ||||
| export const LeftPart = styled(Box)` | export const LeftPart = styled(Box)` | ||||
| display: flex; | display: flex; | ||||
| flex-direction: row; | flex-direction: row; | ||||
| margin-right: 40px; | margin-right: 40px; | ||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| flex-direction: column; | |||||
| gap: 18px; | |||||
| } | } | ||||
| /* @media (max-width: 600px) { | |||||
| flex-direction: column; | |||||
| } */ | |||||
| `; | `; | ||||
| export const SpreadLine = styled(Box)` | export const SpreadLine = styled(Box)` | ||||
| height: 108px; | height: 108px; | ||||
| margin-bottom: auto; | margin-bottom: auto; | ||||
| opacity: 0.12; | opacity: 0.12; | ||||
| border: 1px solid black; | border: 1px solid black; | ||||
| @media (max-width: 600px) { | |||||
| @media (max-width: 1050px) { | |||||
| display: none; | display: none; | ||||
| } | } | ||||
| `; | `; | ||||
| gap: 4px; | gap: 4px; | ||||
| margin-left: 36px; | margin-left: 36px; | ||||
| padding-top: 20px; | padding-top: 20px; | ||||
| @media (max-width: 600px) { | |||||
| @media (max-width: 1050px) { | |||||
| display: none; | display: none; | ||||
| } | } | ||||
| `; | `; | ||||
| export const SkeletonImage = styled(ItemsTransition)` | export const SkeletonImage = styled(ItemsTransition)` | ||||
| width: 144px; | width: 144px; | ||||
| height: 144px; | height: 144px; | ||||
| @media (max-width: 600px) { | |||||
| margin-top: 54px; | |||||
| width: 108px; | |||||
| height: 108px; | |||||
| } | |||||
| `; | `; | ||||
| export const SkeletonColumnContainer = styled(Box)` | export const SkeletonColumnContainer = styled(Box)` | ||||
| display: flex; | display: flex; | ||||
| export const SkeletonAuthor = styled(ItemsTransition)` | export const SkeletonAuthor = styled(ItemsTransition)` | ||||
| width: 117px; | width: 117px; | ||||
| height: 18px; | height: 18px; | ||||
| @media (max-width: 600px) { | |||||
| visibility: hidden; | |||||
| } | |||||
| `; | `; | ||||
| export const SkeletonLocation = styled(ItemsTransition)` | export const SkeletonLocation = styled(ItemsTransition)` | ||||
| width: 90px; | width: 90px; | ||||
| height: 18px; | height: 18px; | ||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| width: 100px; | |||||
| margin-top: 36px; | |||||
| width: 117px; | |||||
| margin-top: 26px; | |||||
| } | } | ||||
| `; | `; | ||||
| export const SkeletonRowGroup = styled(Box)` | export const SkeletonRowGroup = styled(Box)` | ||||
| display: flex; | display: flex; | ||||
| flex-direction: row; | flex-direction: row; | ||||
| justify-content: space-between; | justify-content: space-between; | ||||
| & div:nth-child(4) {display: none;} | |||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| flex-direction: column; | flex-direction: column; | ||||
| gap: 4px; | gap: 4px; | ||||
| } | } | ||||
| & div:nth-child(1) { | & div:nth-child(1) { | ||||
| display: block; | display: block; | ||||
| width: 85px; | |||||
| width: 90px; | |||||
| margin-top: 4px; | margin-top: 4px; | ||||
| ${(props) => props.aboveChat && `margin-bottom: 18px;`} | ${(props) => props.aboveChat && `margin-bottom: 18px;`} | ||||
| } | } | ||||
| & div:nth-child(2) { | & div:nth-child(2) { | ||||
| display: ${(props) => (props.aboveChat ? "none" : "block")}; | display: ${(props) => (props.aboveChat ? "none" : "block")}; | ||||
| width: 85px; | |||||
| } | |||||
| & div:nth-child(4) { | |||||
| display: block; | |||||
| margin-top: 0; | |||||
| } | } | ||||
| } | } | ||||
| `; | `; | ||||
| width: 221px; | width: 221px; | ||||
| height: 18px; | height: 18px; | ||||
| background-color: ${selectedTheme.colors.filterSkeletonItems}; | background-color: ${selectedTheme.colors.filterSkeletonItems}; | ||||
| @media (max-width: 1400px) { | |||||
| ${props => props.removeOnSmallerScreens && `display: none;`} | |||||
| } | |||||
| `; | `; | ||||
| export const SkeletonMessageButton = styled(ItemsTransition)` | export const SkeletonMessageButton = styled(ItemsTransition)` | ||||
| width: 40px; | width: 40px; | ||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| width: 32px; | width: 32px; | ||||
| height: 32px; | height: 32px; | ||||
| top: 323px; | |||||
| left: 18px; | |||||
| } | } | ||||
| `; | `; | ||||
| export const SkeletonMessageButtonSecond = styled(ItemsTransition)` | export const SkeletonMessageButtonSecond = styled(ItemsTransition)` | ||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| width: 32px; | width: 32px; | ||||
| height: 32px; | height: 32px; | ||||
| top: 323px; | |||||
| left: 59px; | |||||
| /* top: 323px; */ | |||||
| /* left: 59px; */ | |||||
| } | } | ||||
| `; | `; | ||||
| export const SkeletonExchangeButton = styled(ItemsTransition)` | export const SkeletonExchangeButton = styled(ItemsTransition)` | ||||
| right: 18px; | right: 18px; | ||||
| position: absolute; | position: absolute; | ||||
| padding-top: 17px; | padding-top: 17px; | ||||
| @media (max-width: 600px) { | |||||
| @media (max-width: 1400px) { | |||||
| display: none; | display: none; | ||||
| } | } | ||||
| `; | `; |
| ProfileInfoContainer, | ProfileInfoContainer, | ||||
| RemoveIcon, | RemoveIcon, | ||||
| RemoveIconContainer, | RemoveIconContainer, | ||||
| UnblockIcon, | |||||
| UnblockIconContainer, | |||||
| UnblockLabelIcon, | |||||
| } from "./BigProfileCard.styled"; | } from "./BigProfileCard.styled"; | ||||
| import ProfileMainInfo from "../ProfileMainInfo/ProfileMainInfo"; | import ProfileMainInfo from "../ProfileMainInfo/ProfileMainInfo"; | ||||
| import ProfileContact from "../ProfileContact/ProfileContact"; | import ProfileContact from "../ProfileContact/ProfileContact"; | ||||
| type: "blockUser", | type: "blockUser", | ||||
| }); | }); | ||||
| }; | }; | ||||
| const unblockUser = () => { | |||||
| setDeleteOrEditModal({ | |||||
| show: true, | |||||
| type: "unblockUser", | |||||
| }); | |||||
| }; | |||||
| const goToUser = () => { | const goToUser = () => { | ||||
| history.push( | history.push( | ||||
| replaceInRoute(ADMIN_SINGLE_USER_PAGE, { | replaceInRoute(ADMIN_SINGLE_USER_PAGE, { | ||||
| <RemoveIconContainer onClick={removeUser}> | <RemoveIconContainer onClick={removeUser}> | ||||
| <RemoveIcon /> | <RemoveIcon /> | ||||
| </RemoveIconContainer> | </RemoveIconContainer> | ||||
| <BlockIconContainer onClick={blockUser}> | |||||
| <BlockIcon /> | |||||
| </BlockIconContainer> | |||||
| {props.profile?._blocked ? ( | |||||
| <UnblockIconContainer onClick={unblockUser}> | |||||
| <UnblockIcon /> | |||||
| </UnblockIconContainer> | |||||
| ) : ( | |||||
| <BlockIconContainer onClick={blockUser}> | |||||
| <BlockIcon /> | |||||
| </BlockIconContainer> | |||||
| )} | |||||
| </ButtonsContainer> | </ButtonsContainer> | ||||
| <ProfileInfoContainer> | <ProfileInfoContainer> | ||||
| {/* Profile Main Info */} | {/* Profile Main Info */} | ||||
| <ProfileMainInfo profile={props.profile} isAdmin /> | |||||
| <ProfileMainInfo profile={props.profile} isAdmin bigProfileCard /> | |||||
| {/* Profile Contact */} | {/* Profile Contact */} | ||||
| <ProfileContact profile={props.profile} isAdmin /> | <ProfileContact profile={props.profile} isAdmin /> | ||||
| </ProfileInfoContainer> | </ProfileInfoContainer> | ||||
| customLabeledCard={<UserLabeledCard user={props.profile} />} | customLabeledCard={<UserLabeledCard user={props.profile} />} | ||||
| customLabeledCardHeight="90px" | customLabeledCardHeight="90px" | ||||
| customLabeledCardIcon={ | customLabeledCardIcon={ | ||||
| deleteOrEditModal.type === "blockUser" && <BlockLabelIcon /> | |||||
| deleteOrEditModal.type === "blockUser" ? ( | |||||
| <BlockLabelIcon /> | |||||
| ) : ( | |||||
| <UnblockLabelIcon /> | |||||
| ) | |||||
| } | } | ||||
| /> | /> | ||||
| )} | )} |
| import { ReactComponent as Mail } from "../../../../assets/images/svg/mail.svg"; | import { ReactComponent as Mail } from "../../../../assets/images/svg/mail.svg"; | ||||
| import { ReactComponent as Remove } from "../../../../assets/images/svg/trash.svg"; | import { ReactComponent as Remove } from "../../../../assets/images/svg/trash.svg"; | ||||
| import { ReactComponent as Block } from "../../../../assets/images/svg/block.svg"; | import { ReactComponent as Block } from "../../../../assets/images/svg/block.svg"; | ||||
| import { ReactComponent as Unblock } from "../../../../assets/images/svg/unblock.svg"; | |||||
| import { ReactComponent as UnblockGold } from "../../../../assets/images/svg/unblock-gold.svg"; | |||||
| import { IconButton } from "../../../Buttons/IconButton/IconButton"; | import { IconButton } from "../../../Buttons/IconButton/IconButton"; | ||||
| import { PrimaryButton } from "../../../Buttons/PrimaryButton/PrimaryButton"; | import { PrimaryButton } from "../../../Buttons/PrimaryButton/PrimaryButton"; | ||||
| // import { ReactComponent as Location } from "../../../assets/images/svg/location.svg"; | // import { ReactComponent as Location } from "../../../assets/images/svg/location.svg"; | ||||
| display: block; | display: block; | ||||
| `; | `; | ||||
| export const BlockIcon = styled(Block)``; | export const BlockIcon = styled(Block)``; | ||||
| export const UnblockIconContainer = styled(MessageButton)` | |||||
| display: block; | |||||
| `; | |||||
| export const UnblockIcon = styled(Unblock)``; | |||||
| export const BlockLabelIcon = styled(Block)` | export const BlockLabelIcon = styled(Block)` | ||||
| width: 18px; | width: 18px; | ||||
| height: 18px; | height: 18px; | ||||
| stroke: ${selectedTheme.colors.iconYellowColor}; | stroke: ${selectedTheme.colors.iconYellowColor}; | ||||
| } | } | ||||
| `; | `; | ||||
| export const UnblockLabelIcon = styled(UnblockGold)` | |||||
| width: 18px; | |||||
| height: 18px; | |||||
| position: relative; | |||||
| top: 10px; | |||||
| left: 11px; | |||||
| `; | |||||
| export const CheckButton = styled(PrimaryButton)` | export const CheckButton = styled(PrimaryButton)` | ||||
| width: 180px; | width: 180px; | ||||
| height: 48px; | height: 48px; |
| MessageButton, | MessageButton, | ||||
| MessageIcon, | MessageIcon, | ||||
| ProfileInfoAndContactContainer, | ProfileInfoAndContactContainer, | ||||
| UnblockButton, | |||||
| 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 companyData from "../../../notFoundData/companyData"; | import companyData from "../../../notFoundData/companyData"; | ||||
| 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 history from "../../../store/utils/history"; | |||||
| import { HOME_PAGE } from "../../../constants/pages"; | |||||
| const ProfileCard = (props) => { | const ProfileCard = (props) => { | ||||
| const [editProfileModal, setEditProfileModal] = useState(false); | const [editProfileModal, setEditProfileModal] = useState(false); | ||||
| reFetchProfile(); | reFetchProfile(); | ||||
| } | } | ||||
| }, [idProfile]); | }, [idProfile]); | ||||
| useEffect(() => { | |||||
| if (profile && isMyProfile !== undefined) { | |||||
| if (!isMyProfile && profile._blocked && !props.isAdmin) | |||||
| history.push(HOME_PAGE); | |||||
| } | |||||
| }, [profile, isMyProfile, props.isAdmin]); | |||||
| const reFetchProfile = () => { | const reFetchProfile = () => { | ||||
| dispatch(fetchProfile(idProfile)); | dispatch(fetchProfile(idProfile)); | ||||
| type: "blockUser", | type: "blockUser", | ||||
| }); | }); | ||||
| }; | }; | ||||
| const unblockUser = () => { | |||||
| setDeleteOrEditModal({ | |||||
| show: true, | |||||
| type: "unblockUser", | |||||
| }); | |||||
| }; | |||||
| const handleEditProfile = () => { | |||||
| if (!profile?._blocked) setEditProfileModal(true); | |||||
| }; | |||||
| if (editProfileModal) { | if (editProfileModal) { | ||||
| document.body.style.overflow = "hidden"; | document.body.style.overflow = "hidden"; | ||||
| : t("profile.companyProfile")} | : t("profile.companyProfile")} | ||||
| </HeaderTitle> | </HeaderTitle> | ||||
| </ProfileCardHeader> | </ProfileCardHeader> | ||||
| <ProfileCardWrapper variant="outlined" isMyProfile={isMyProfile}> | |||||
| <ProfileCardWrapper | |||||
| variant="outlined" | |||||
| isMyProfile={isMyProfile} | |||||
| blocked={profile?._blocked} | |||||
| > | |||||
| <ButtonsContainer> | <ButtonsContainer> | ||||
| {profile?._blocked && ( | |||||
| <BlockedContainer> | |||||
| <BlockedProfileTextContainer> | |||||
| <BlockedProfileText> | |||||
| {t("profile.blockedProfile")} | |||||
| </BlockedProfileText> | |||||
| </BlockedProfileTextContainer> | |||||
| <BlockedIconContainer> | |||||
| <BlockedIcon /> | |||||
| </BlockedIconContainer> | |||||
| </BlockedContainer> | |||||
| )} | |||||
| {props.isAdmin && ( | {props.isAdmin && ( | ||||
| <> | <> | ||||
| <BlockButton onClick={blockUser}> | |||||
| <BlockIcon /> | |||||
| </BlockButton> | |||||
| {profile?._blocked ? ( | |||||
| <UnblockButton onClick={unblockUser}> | |||||
| <UnblockIcon /> | |||||
| </UnblockButton> | |||||
| ) : ( | |||||
| <BlockButton onClick={blockUser}> | |||||
| <BlockIcon /> | |||||
| </BlockButton> | |||||
| )} | |||||
| <RemoveButton onClick={removeUser}> | <RemoveButton onClick={removeUser}> | ||||
| <RemoveIcon /> | <RemoveIcon /> | ||||
| </RemoveButton> | </RemoveButton> | ||||
| )} | )} | ||||
| {isMyProfile || props.isAdmin ? ( | {isMyProfile || props.isAdmin ? ( | ||||
| <EditButton | <EditButton | ||||
| onClick={() => setEditProfileModal(true)} | |||||
| onClick={handleEditProfile} | |||||
| isAdmin={props.isAdmin} | isAdmin={props.isAdmin} | ||||
| disabled={!props.isAdmin && profile?._blocked} | |||||
| > | > | ||||
| <EditIcon /> | <EditIcon /> | ||||
| </EditButton> | </EditButton> | ||||
| <ProfileMainInfo | <ProfileMainInfo | ||||
| profile={profile} | profile={profile} | ||||
| isMyProfile={isMyProfile} | isMyProfile={isMyProfile} | ||||
| isBlocked={profile?._blocked} | |||||
| /> | /> | ||||
| {/* Profile Contact */} | {/* Profile Contact */} | ||||
| <ProfileContact profile={profile} isMyProfile={isMyProfile} /> | |||||
| <ProfileContact | |||||
| profile={profile} | |||||
| isMyProfile={profile?._blocked || isMyProfile} | |||||
| /> | |||||
| </ProfileInfoAndContactContainer> | </ProfileInfoAndContactContainer> | ||||
| {/* Profile Stats */} | {/* Profile Stats */} | ||||
| <ProfileStats | <ProfileStats |
| import styled from "styled-components"; | |||||
| import styled, { css } from "styled-components"; | |||||
| import { Card, Typography, Grid, Box } from "@mui/material"; | import { Card, Typography, Grid, Box } from "@mui/material"; | ||||
| import selectedTheme from "../../../themes"; | import selectedTheme from "../../../themes"; | ||||
| import { ReactComponent as Edit } from "../../../assets/images/svg/edit.svg"; | import { ReactComponent as Edit } from "../../../assets/images/svg/edit.svg"; | ||||
| import { ReactComponent as Block } from "../../../assets/images/svg/block.svg"; | import { ReactComponent as Block } from "../../../assets/images/svg/block.svg"; | ||||
| import { ReactComponent as Unblock } from "../../../assets/images/svg/unblock.svg"; | |||||
| import { ReactComponent as Remove } from "../../../assets/images/svg/trash.svg"; | import { ReactComponent as Remove } from "../../../assets/images/svg/trash.svg"; | ||||
| // import { ReactComponent as Pocket } from "../../assets/images/svg/pocket.svg"; | |||||
| // import { ReactComponent as Globe } from "../../assets/images/svg/globe.svg"; | |||||
| import { ReactComponent as Mail } from "../../../assets/images/svg/mail.svg"; | import { ReactComponent as Mail } from "../../../assets/images/svg/mail.svg"; | ||||
| // import { ReactComponent as Location } from "../../assets/images/svg/location.svg"; | |||||
| // import { PRIMARY_PURPLE_COLOR, PRIMARY_YELLOW_COLOR } from '../../constants/stylesConstants'; | |||||
| export const ProfileCardContainer = styled(Box)` | export const ProfileCardContainer = styled(Box)` | ||||
| width: 100%; | width: 100%; | ||||
| padding: 0 36px 0 0; | padding: 0 36px 0 0; | ||||
| } | } | ||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| padding: 0 ${props => props.isAdmin ? "18px" : "0"}; | |||||
| padding: 0 ${(props) => (props.isAdmin ? "18px" : "0")}; | |||||
| } | } | ||||
| `; | `; | ||||
| export const EditIcon = styled(Edit)` | export const EditIcon = styled(Edit)` | ||||
| background: ${selectedTheme.colors.primaryIconBackgroundColor}; | background: ${selectedTheme.colors.primaryIconBackgroundColor}; | ||||
| border-radius: 360px; | border-radius: 360px; | ||||
| padding: 0.45rem 0.45rem 0.27rem 0.57rem; | padding: 0.45rem 0.45rem 0.27rem 0.57rem; | ||||
| cursor: pointer; | |||||
| cursor: ${(props) => !props.disabled && `pointer`}; | |||||
| ${(props) => | |||||
| props.disabled && | |||||
| css` | |||||
| & path { | |||||
| stroke: ${selectedTheme.colors.iconStrokePurpleDisabledColor}; | |||||
| } | |||||
| `} | |||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| width: 32px; | width: 32px; | ||||
| height: 32px; | height: 32px; | ||||
| height: 32px; | height: 32px; | ||||
| } | } | ||||
| `; | `; | ||||
| export const BlockIcon = styled(Block)` | |||||
| export const BlockLabelIcon = styled(Block)` | |||||
| width: 18px; | |||||
| height: 18px; | |||||
| position: relative; | position: relative; | ||||
| top: 10px; | |||||
| left: 11px; | |||||
| & path { | |||||
| 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; | top: 3px; | ||||
| left: 2px; | |||||
| left: 2px; */ | |||||
| width: 18px; | width: 18px; | ||||
| height: 18px; | height: 18px; | ||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| left: -2px; | left: -2px; | ||||
| } | } | ||||
| & path { | & path { | ||||
| stroke: ${selectedTheme.colors.primaryPurple}; | |||||
| stroke: white; | |||||
| } | } | ||||
| `; | `; | ||||
| export const BlockLabelIcon = styled(Block)` | |||||
| export const BlockButton = styled(Box)` | |||||
| width: 40px; | |||||
| height: 40px; | |||||
| font-weight: 900; | |||||
| background: ${selectedTheme.colors.primaryIconBackgroundColor}; | |||||
| border-radius: 360px; | |||||
| padding: 0.45rem 0.45rem 0.27rem 0.57rem; | |||||
| cursor: pointer; | |||||
| @media (max-width: 600px) { | |||||
| width: 32px; | |||||
| height: 32px; | |||||
| } | |||||
| `; | |||||
| export const BlockIcon = styled(Block)` | |||||
| position: relative; | |||||
| top: 3px; | |||||
| left: 2px; | |||||
| width: 18px; | width: 18px; | ||||
| height: 18px; | height: 18px; | ||||
| position: relative; | |||||
| top: 10px; | |||||
| left: 11px; | |||||
| @media (max-width: 600px) { | |||||
| top: 0; | |||||
| left: -2px; | |||||
| } | |||||
| & path { | & path { | ||||
| stroke: ${selectedTheme.colors.iconYellowColor}; | |||||
| stroke: ${selectedTheme.colors.primaryPurple}; | |||||
| } | } | ||||
| `; | `; | ||||
| export const BlockButton = styled(Box)` | |||||
| export const UnblockButton = styled(Box)` | |||||
| width: 40px; | width: 40px; | ||||
| height: 40px; | height: 40px; | ||||
| font-weight: 900; | font-weight: 900; | ||||
| height: 32px; | height: 32px; | ||||
| } | } | ||||
| `; | `; | ||||
| export const UnblockIcon = styled(Unblock)` | |||||
| position: relative; | |||||
| top: 3px; | |||||
| left: 2px; | |||||
| width: 18px; | |||||
| height: 18px; | |||||
| @media (max-width: 600px) { | |||||
| top: 0; | |||||
| left: -2px; | |||||
| } | |||||
| `; | |||||
| export const MessageButton = styled(EditButton)` | export const MessageButton = styled(EditButton)` | ||||
| background: ${selectedTheme.colors.primaryPurple}; | background: ${selectedTheme.colors.primaryPurple}; | ||||
| width: 40px; | width: 40px; | ||||
| export const ProfileCardWrapper = styled(Card)` | export const ProfileCardWrapper = styled(Card)` | ||||
| border: 1px solid ${selectedTheme.colors.borderNormal}; | border: 1px solid ${selectedTheme.colors.borderNormal}; | ||||
| background: ${(props) => | background: ${(props) => | ||||
| props.isMyProfile ? selectedTheme.colors.primaryPurple : "white"}; | |||||
| props.blocked | |||||
| ? selectedTheme.colors.blockedColor | |||||
| : props.isMyProfile | |||||
| ? selectedTheme.colors.primaryPurple | |||||
| : "white"}; | |||||
| width: 100%; | width: 100%; | ||||
| min-width: fit-content; | min-width: fit-content; | ||||
| padding: 1rem; | padding: 1rem; | ||||
| font-size: 12px; | font-size: 12px; | ||||
| } | } | ||||
| `; | `; | ||||
| // export const PocketIcon = styled(Pocket)` | |||||
| // width: 22px; | |||||
| // height: 22px; | |||||
| // position: relative; | |||||
| // left: -5px; | |||||
| // top: 2px; | |||||
| // & path { | |||||
| // stroke: #b4b4b4; | |||||
| // } | |||||
| // @media (max-width: 600px) { | |||||
| // width: 14px; | |||||
| // height: 14px; | |||||
| // } | |||||
| // `; | |||||
| // export const MailIcon = styled(Mail)` | |||||
| // height: 24px; | |||||
| // width: 24px; | |||||
| // & path { | |||||
| // stroke: ${(props) => | |||||
| // props.isMyProfile | |||||
| // ? selectedTheme.colors.iconMineProfileColor | |||||
| // : selectedTheme.colors.iconProfileColor}; | |||||
| // } | |||||
| // @media (max-width: 600px) { | |||||
| // width: 14px; | |||||
| // height: 14px; | |||||
| // } | |||||
| // `; | |||||
| // export const GlobeIcon = styled(Globe)` | |||||
| // height: 22px; | |||||
| // width: 22px; | |||||
| // & path { | |||||
| // stroke: ${(props) => | |||||
| // props.isMyProfile | |||||
| // ? selectedTheme.colors.iconMineProfileColor | |||||
| // : selectedTheme.colors.iconProfileColor}; | |||||
| // } | |||||
| // @media (max-width: 600px) { | |||||
| // width: 14px; | |||||
| // height: 14px; | |||||
| // } | |||||
| // `; | |||||
| // export const LocationIcon = styled(Location)` | |||||
| // height: 22px; | |||||
| // width: 22px; | |||||
| // & path { | |||||
| // stroke: ${(props) => | |||||
| // props.isMyProfile | |||||
| // ? selectedTheme.colors.iconMineProfileColor | |||||
| // : selectedTheme.colors.iconProfileColor}; | |||||
| // } | |||||
| // @media (max-width: 600px) { | |||||
| // width: 14px; | |||||
| // height: 14px; | |||||
| // } | |||||
| // `; | |||||
| export const MessageIcon = styled(Mail)` | export const MessageIcon = styled(Mail)` | ||||
| width: 19.5px; | width: 19.5px; | ||||
| height: 19.5px; | height: 19.5px; |
| ProfilePIBContainer, | ProfilePIBContainer, | ||||
| PocketIcon, | PocketIcon, | ||||
| ProfilePIB, | ProfilePIB, | ||||
| BlockedProfileText, | |||||
| } from "./ProfileMainInfo.styled"; | } from "./ProfileMainInfo.styled"; | ||||
| import { useTranslation } from "react-i18next"; | import { useTranslation } from "react-i18next"; | ||||
| import { getImageUrl, variants } from "../../../../util/helpers/imageUrlGetter"; | import { getImageUrl, variants } from "../../../../util/helpers/imageUrlGetter"; | ||||
| ); | ); | ||||
| } | } | ||||
| }; | }; | ||||
| if (props.profile?.blocked) console.log(props.profile); | |||||
| return ( | return ( | ||||
| <ProfileMainInfoContainer> | <ProfileMainInfoContainer> | ||||
| <AvatarImageContainer> | <AvatarImageContainer> | ||||
| /> | /> | ||||
| </AvatarImageContainer> | </AvatarImageContainer> | ||||
| <ProfileMainInfoGrid> | <ProfileMainInfoGrid> | ||||
| {props.bigProfileCard && (props.profile?._deleted ? ( | |||||
| <BlockedProfileText>{t("profile.deletedProfile")}</BlockedProfileText> | |||||
| ) : props.profile?._blocked ? ( | |||||
| <BlockedProfileText>{t("profile.blockedProfile")}</BlockedProfileText> | |||||
| ) : ( | |||||
| <></> | |||||
| ))} | |||||
| <ProfileName | <ProfileName | ||||
| isAdmin={props.isAdmin} | isAdmin={props.isAdmin} | ||||
| isMyProfile={props.isMyProfile} | isMyProfile={props.isMyProfile} | ||||
| isBlocked={props.isBlocked} | |||||
| variant="h5" | variant="h5" | ||||
| onClick={goToUser} | onClick={goToUser} | ||||
| > | > | ||||
| </ProfileName> | </ProfileName> | ||||
| <ProfilePIBContainer> | <ProfilePIBContainer> | ||||
| <PocketIcon /> | <PocketIcon /> | ||||
| <ProfilePIB isMyProfile={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> | ||||
| isMyProfile: PropTypes.bool, | isMyProfile: PropTypes.bool, | ||||
| children: PropTypes.node, | children: PropTypes.node, | ||||
| isAdmin: PropTypes.any, | isAdmin: PropTypes.any, | ||||
| bigProfileCard: PropTypes.bool, | |||||
| isBlocked: PropTypes.bool, | |||||
| }; | }; | ||||
| export default ProfileMainInfo; | export default ProfileMainInfo; |
| height: ${(props) => (props.isAdmin ? "108px" : "90px")}; | height: ${(props) => (props.isAdmin ? "108px" : "90px")}; | ||||
| } | } | ||||
| `; | `; | ||||
| export const BlockedProfileText = styled(Typography)` | |||||
| font-style: italic; | |||||
| font-weight: 400; | |||||
| font-size: 12px; | |||||
| line-height: 16px; | |||||
| font-family: ${selectedTheme.fonts.textFont}; | |||||
| color: ${selectedTheme.colors.blockedColor}; | |||||
| `; | |||||
| export const ProfileMainInfoGrid = styled(Grid)` | export const ProfileMainInfoGrid = styled(Grid)` | ||||
| display: flex; | display: flex; | ||||
| flex-direction: column; | flex-direction: column; | ||||
| `; | `; | ||||
| export const ProfileName = styled(Typography)` | export const ProfileName = styled(Typography)` | ||||
| color: ${(props) => | color: ${(props) => | ||||
| props.isMyProfile | |||||
| props.isBlocked | |||||
| ? "white" | |||||
| : props.isMyProfile | |||||
| ? selectedTheme.colors.primaryYellow | ? selectedTheme.colors.primaryYellow | ||||
| : selectedTheme.colors.primaryPurple}; | : selectedTheme.colors.primaryPurple}; | ||||
| font-weight: 700; | font-weight: 700; |
| justify-content: center; | justify-content: center; | ||||
| align-items: center; | align-items: center; | ||||
| cursor: pointer; | cursor: pointer; | ||||
| max-width: 130px; | |||||
| svg { | svg { | ||||
| width: 90%; | width: 90%; | ||||
| } | } | ||||
| min-width: ${(props) => (props.shrink ? "0" : "400px")}; | min-width: ${(props) => (props.shrink ? "0" : "400px")}; | ||||
| } | } | ||||
| @media (max-width: 900px) { | @media (max-width: 900px) { | ||||
| flex: 0.35; | |||||
| flex: 0.2; | |||||
| min-width: 0px; | min-width: 0px; | ||||
| width: 60px; | width: 60px; | ||||
| justify-content: right; | justify-content: right; |
| }; | }; | ||||
| const listener = useCallback( | const listener = useCallback( | ||||
| (event) => { | (event) => { | ||||
| console.log(event); | |||||
| console.log(ref); | |||||
| if (event.keyCode === 13) { | if (event.keyCode === 13) { | ||||
| event.preventDefault(); | event.preventDefault(); | ||||
| handleManualSearch(); | handleManualSearch(); |
| export const SearchInputContainer = styled(TextField)` | export const SearchInputContainer = styled(TextField)` | ||||
| background-color: ${selectedTheme.colors.primaryBackgroundColor}; | background-color: ${selectedTheme.colors.primaryBackgroundColor}; | ||||
| width: 45%; | |||||
| flex: 3; | |||||
| flex: 1; | |||||
| max-width: 520px; | max-width: 520px; | ||||
| margin-right: 30px; | |||||
| font-family: ${selectedTheme.fonts.textFont}; | font-family: ${selectedTheme.fonts.textFont}; | ||||
| @media (max-width: 1700px) { | @media (max-width: 1700px) { | ||||
| margin-left: 15%; | margin-left: 15%; | ||||
| @media (max-width: 1320px) { | @media (max-width: 1320px) { | ||||
| margin-left: 7%; | margin-left: 7%; | ||||
| } | } | ||||
| @media (max-width: 1100px) { | |||||
| width: 36%; | |||||
| } | |||||
| @media (max-width: 1000px) { | |||||
| width: 36%; | |||||
| @media (max-width: 1250px) { | |||||
| margin-left: 5%; | margin-left: 5%; | ||||
| margin-right: 10px; | |||||
| } | } | ||||
| @media (max-width: 550px) { | @media (max-width: 550px) { | ||||
| /* display: none; */ | |||||
| /* width: 0; */ | |||||
| display: block; | display: block; | ||||
| /* position: relative; */ | |||||
| width: 80%; | width: 80%; | ||||
| /* top: 70px; */ | |||||
| height: 46px; | height: 46px; | ||||
| margin-right: 27px; | |||||
| /* left: -5px; */ | |||||
| font-family: ${selectedTheme.fonts.textFont}; | font-family: ${selectedTheme.fonts.textFont}; | ||||
| /* ${(props) => !props.shouldShow && `display: none;`} */ | |||||
| & div { | & div { | ||||
| /* background-color: white; */ | |||||
| height: 46px; | height: 46px; | ||||
| overflow: visible; | overflow: visible; | ||||
| & input { | & input { |
| export const SkeletonItemDetailsContainer = styled(Box)` | export const SkeletonItemDetailsContainer = styled(Box)` | ||||
| display: flex; | display: flex; | ||||
| flex-direction: column; | flex-direction: column; | ||||
| margin-left: 36px; | |||||
| margin-right: -36px; | |||||
| /* margin-left: 36px; */ | |||||
| /* margin-right: -36px; */ | |||||
| max-width: 45vw; | |||||
| @media (max-width: 1200px) { | |||||
| @media (max-width: 600px) { | |||||
| margin-left: 0; | margin-left: 0; | ||||
| margin-right: 0; | margin-right: 0; | ||||
| } | |||||
| @media (max-width: 600px) { | |||||
| margin-top: 180px; | |||||
| max-width: none; | |||||
| } | } | ||||
| `; | `; | ||||
| export const DeleteCategoryContainer = styled(Box)` | export const DeleteCategoryContainer = styled(Box)` | ||||
| width: 537px; | width: 537px; | ||||
| height: ${(props) => | height: ${(props) => | ||||
| ["blockUser", "deleteUser"].includes(props.type) ? "309px" : "274px"}; | |||||
| ["blockUser", "unblockUser", "deleteUser"].includes(props.type) ? "309px" : "274px"}; | |||||
| position: fixed; | position: fixed; | ||||
| z-index: 150; | z-index: 150; | ||||
| left: calc(50vw - 268px); | left: calc(50vw - 268px); | ||||
| top: ${(props) => | top: ${(props) => | ||||
| ["blockUser", "deleteUser"].includes(props.type) | |||||
| ["blockUser", "unblockUser", "deleteUser"].includes(props.type) | |||||
| ? `calc(50vh - 153px)` | ? `calc(50vh - 153px)` | ||||
| : `calc(50vh - 137px)`}; | : `calc(50vh - 137px)`}; | ||||
| padding-top: 36px; | padding-top: 36px; | ||||
| width: 350px; | width: 350px; | ||||
| left: calc(50vw - 175px); | left: calc(50vw - 175px); | ||||
| height: ${(props) => | height: ${(props) => | ||||
| ["blockUser", "deleteUser"].includes(props.type) ? "281px" : "246px"}; | |||||
| ["blockUser", "unblockUser", "deleteUser"].includes(props.type) ? "281px" : "246px"}; | |||||
| top: ${(props) => | top: ${(props) => | ||||
| ["blockUser", "deleteUser"].includes(props.type) | |||||
| ["blockUser", "unblockUser", "deleteUser"].includes(props.type) | |||||
| ? `calc(50vh - 140px)` | ? `calc(50vh - 140px)` | ||||
| : `calc(50vh - 123px)`}; | : `calc(50vh - 123px)`}; | ||||
| } | } |
| console.log("applyfilters"); | console.log("applyfilters"); | ||||
| setFiltersCleared(true); | setFiltersCleared(true); | ||||
| }; | }; | ||||
| // const applySorting = () => { | |||||
| // filters.apply(); | |||||
| // console.log("ovde"); | |||||
| // const newQueryString = makeQueryStringHelper( | |||||
| // filters, | |||||
| // paging, | |||||
| // search, | |||||
| // sorting | |||||
| // ); | |||||
| // paging.changePage(1); | |||||
| // newQueryString.set(KEY_PAGE, 1); | |||||
| // dispatch(setQueryString(convertQueryStringForBackend(newQueryString))); | |||||
| // }; | |||||
| const clearFiltersAndApply = () => { | const clearFiltersAndApply = () => { | ||||
| clear(); | clear(); | ||||
| setFiltersCleared(true); | setFiltersCleared(true); | ||||
| }; | }; | ||||
| const applySorting = () => { | |||||
| paging.changePage(1); | |||||
| setFiltersCleared(true); | |||||
| } | |||||
| const applySearch = () => { | |||||
| paging.changePage(1); | |||||
| setFiltersCleared(true); | |||||
| } | |||||
| // Those hooks are below becouse function apply cannot be put on props before initialization | // Those hooks are below becouse function apply cannot be put on props before initialization | ||||
| const sorting = useSorting(apply); | |||||
| const sorting = useSorting(applySorting); | |||||
| const paging = usePaging(apply); | const paging = usePaging(apply); | ||||
| const search = useSearch(applyFilters); | |||||
| const search = useSearch(applySearch); | |||||
| // On every change of search string, offers should be immediately searched | // On every change of search string, offers should be immediately searched | ||||
| useEffect(() => { | useEffect(() => { |
| backToHome: "Nazad na sve objave", | backToHome: "Nazad na sve objave", | ||||
| myOffers: "Moje objave", | myOffers: "Moje objave", | ||||
| profileOffers: "Objave kompanije", | profileOffers: "Objave kompanije", | ||||
| blockedProfile: "Trenutno blokiran profil", | |||||
| deletedProfile: "Obrisan profil" | |||||
| }, | }, | ||||
| about: { | about: { | ||||
| header: { | header: { | ||||
| cancel: "Otkaži", | cancel: "Otkaži", | ||||
| delete: "Blokiraj", | delete: "Blokiraj", | ||||
| }, | }, | ||||
| unblockUser: { | |||||
| reassuranceDelete: | |||||
| "Da li ste sigurni da želite da odblokirate profil kompanje?", | |||||
| cancel: "Otkaži", | |||||
| delete: "Odblokiraj", | |||||
| }, | |||||
| pin: { | pin: { | ||||
| reassurancePin: | reassurancePin: | ||||
| "Da li ste sigurni da želite da zakačite proizvod na vrhu?", | "Da li ste sigurni da želite da zakačite proizvod na vrhu?", |
| import styled from "styled-components"; | import styled from "styled-components"; | ||||
| export const ItemDetailsLayoutContainer = styled(Container)` | export const ItemDetailsLayoutContainer = styled(Container)` | ||||
| /* padding-left: 36px; */ | |||||
| /* padding-right: ${(props) => (props.singleOffer ? "76px" : 0)}; */ | |||||
| margin: 0; | margin: 0; | ||||
| width: calc(100vw - 17px); | |||||
| max-width: 100vw; | max-width: 100vw; | ||||
| /* display: flex; */ | |||||
| position: relative; | position: relative; | ||||
| /* flex: 1; */ | |||||
| height: 100%; | height: 100%; | ||||
| @media (max-width: 1200px) { | |||||
| /* padding-right: ${(props) => (props.profile ? 0 : "36px")}; */ | |||||
| } | |||||
| @media (max-width: 600px) { | |||||
| /* padding-left: 18px; */ | |||||
| /* padding-right: 18px; */ | |||||
| } | |||||
| `; | `; | ||||
| export const ContentRightCardContainer = styled(Box)` | export const ContentRightCardContainer = styled(Box)` |
| <MainLayoutContainer className={props.className}> | <MainLayoutContainer className={props.className}> | ||||
| {props.children} | {props.children} | ||||
| <Grid container maxHeight="xl"> | <Grid container maxHeight="xl"> | ||||
| <LeftCard item xs={0} sm={0} md={3} lg={3} xl={2.4}> | |||||
| <LeftCard item xs={0} sm={0} md={3.5} lg={3.5} xl={3}> | |||||
| {props.leftCard} | {props.leftCard} | ||||
| </LeftCard> | </LeftCard> | ||||
| <Content item xs={12} sm={12} md={9} lg={9} xl={9.6}> | |||||
| <Content item xs={12} sm={12} md={8.5} lg={8.5} xl={9}> | |||||
| {props.content} | {props.content} | ||||
| </Content> | </Content> | ||||
| </Grid> | </Grid> |
| import { | import { | ||||
| createErrorType, | createErrorType, | ||||
| createFetchType, | createFetchType, | ||||
| createSetType, | |||||
| createSuccessType, | createSuccessType, | ||||
| } from "../actionHelpers"; | } from "../actionHelpers"; | ||||
| export const ADMIN_FETCH = createFetchType(ADMIN_SCOPE); | export const ADMIN_FETCH = createFetchType(ADMIN_SCOPE); | ||||
| export const ADMIN_FETCH_SUCCESS = createSuccessType(ADMIN_SCOPE); | export const ADMIN_FETCH_SUCCESS = createSuccessType(ADMIN_SCOPE); | ||||
| export const ADMIN_FETCH_ERROR = createErrorType(ADMIN_SCOPE); | export const ADMIN_FETCH_ERROR = createErrorType(ADMIN_SCOPE); | ||||
| export const ADMIN_QUERY_STRING = createSetType("ADMIN_QUERY_STRING"); |
| ADMIN_FETCH, | ADMIN_FETCH, | ||||
| ADMIN_FETCH_ERROR, | ADMIN_FETCH_ERROR, | ||||
| ADMIN_FETCH_SUCCESS, | ADMIN_FETCH_SUCCESS, | ||||
| ADMIN_QUERY_STRING, | |||||
| } from "./adminActionConstants"; | } from "./adminActionConstants"; | ||||
| export const fetchAdminMethod = (payload) => ({ | export const fetchAdminMethod = (payload) => ({ | ||||
| export const fetchAdminMethodError = () => ({ | export const fetchAdminMethodError = () => ({ | ||||
| type: ADMIN_FETCH_ERROR, | type: ADMIN_FETCH_ERROR, | ||||
| }); | }); | ||||
| export const setAdminQueryString = () => ({ | |||||
| type: ADMIN_QUERY_STRING | |||||
| }) |
| setMineProfile, | setMineProfile, | ||||
| setProfile, | setProfile, | ||||
| } from "../actions/profile/profileActions"; | } from "../actions/profile/profileActions"; | ||||
| import { setQueryStringRedux } from "../actions/queryString/queryStringActions"; | |||||
| import { selectUserId } from "../selectors/loginSelectors"; | import { selectUserId } from "../selectors/loginSelectors"; | ||||
| import { selectQueryString } from "../selectors/queryStringSelectors"; | |||||
| function* fetchProfile(payload) { | function* fetchProfile(payload) { | ||||
| try { | try { | ||||
| function* fetchAllProfilesAsAdmin({ payload }) { | function* fetchAllProfilesAsAdmin({ payload }) { | ||||
| try { | try { | ||||
| yield call(console.log, payload); | yield call(console.log, payload); | ||||
| const queryObject = new URLSearchParams(); | |||||
| queryObject.set(KEY_SIZE, "10"); | |||||
| let queryString; | |||||
| if (payload?.currentPage) { | |||||
| const queryObject = new URLSearchParams(); | |||||
| queryObject.set(KEY_SIZE, "10"); | |||||
| if (payload?.searchValue && payload?.searchValue?.length !== 0) | if (payload?.searchValue && payload?.searchValue?.length !== 0) | ||||
| queryObject.set(KEY_NAME, payload.searchValue); | queryObject.set(KEY_NAME, payload.searchValue); | ||||
| if (payload?.sortOption?.value === sortUsersEnum.OLD.value) | if (payload?.sortOption?.value === sortUsersEnum.OLD.value) | ||||
| queryObject.set(KEY_SORT_DATE, "false"); | queryObject.set(KEY_SORT_DATE, "false"); | ||||
| if (payload?.sortOption?.value === sortUsersEnum.NEW.value) | if (payload?.sortOption?.value === sortUsersEnum.NEW.value) | ||||
| queryObject.set(KEY_SORT_DATE, "true"); | queryObject.set(KEY_SORT_DATE, "true"); | ||||
| queryObject.set(KEY_PAGE, payload.currentPage); | |||||
| queryString = queryObject.toString(); | |||||
| yield put(setQueryStringRedux(queryString)) | |||||
| } else { | |||||
| queryString = yield select(selectQueryString); | |||||
| } | |||||
| queryObject.set(KEY_PAGE, payload.currentPage); | |||||
| const data = yield call( | const data = yield call( | ||||
| attemptFetchAllProfilesAsAdmin, | attemptFetchAllProfilesAsAdmin, | ||||
| queryObject.toString() | |||||
| queryString | |||||
| ); | ); | ||||
| if (data) yield put(setAllProfiles(data.data)); | if (data) yield put(setAllProfiles(data.data)); | ||||
| yield put(fetchAllProfilesAsAdminSuccess()); | yield put(fetchAllProfilesAsAdminSuccess()); |
| primaryDarkTextThird: "#4D4D4D", | primaryDarkTextThird: "#4D4D4D", | ||||
| iconStrokeColor: "#8C8C8C", | iconStrokeColor: "#8C8C8C", | ||||
| iconStrokeDisabledColor: "#C4C4C4", | iconStrokeDisabledColor: "#C4C4C4", | ||||
| iconStrokePurpleDisabledColor: "#B4B4B4", | |||||
| imagePickerBackground: "#E4E4E4", | imagePickerBackground: "#E4E4E4", | ||||
| iconYellowColor: "#FEB005", | iconYellowColor: "#FEB005", | ||||
| iconMineProfileColor: "#9E9E9E", | iconMineProfileColor: "#9E9E9E", | ||||
| filterSkeletonItemsSecond: "#DDDDDD", | filterSkeletonItemsSecond: "#DDDDDD", | ||||
| staticBackgroundColor: "#F3EFF8", | staticBackgroundColor: "#F3EFF8", | ||||
| stepProgressAltColor: "#F4F4F4", | stepProgressAltColor: "#F4F4F4", | ||||
| blockedColor: "#EE3A3A", | |||||
| }; | }; |
| export default function (hex) { | |||||
| var hexToDo = hex[0] === "#" ? hex.slice(1) : hex; | |||||
| var bigint = parseInt(hexToDo, 16); | |||||
| var r = (bigint >> 16) & 255; | |||||
| var g = (bigint >> 8) & 255; | |||||
| var b = bigint & 255; | |||||
| return r + "," + g + "," + b; | |||||
| } | |||||
| queryObjectToReturn.delete(KEY_SIZE); | queryObjectToReturn.delete(KEY_SIZE); | ||||
| return queryObjectToReturn.toString(); | return queryObjectToReturn.toString(); | ||||
| } else { | } else { | ||||
| queryObjectToReturn.delete(KEY_PAGE); | |||||
| queryObjectToReturn.set(KEY_PAGE, queryObject.get(KEY_PAGE)); | |||||
| return ( | return ( | ||||
| queryObjectToReturn.toString() + "&page=" + queryObject.get(KEY_PAGE) | |||||
| queryObjectToReturn.toString() | |||||
| ); | ); | ||||
| } | } | ||||
| } | } |