| props?.review?.userWhoGaveReview?.image, | props?.review?.userWhoGaveReview?.image, | ||||
| userWhoReceived: | userWhoReceived: | ||||
| props?.review?.reviewAdditionalData?.userWhoReceived?.company?.name, | props?.review?.reviewAdditionalData?.userWhoReceived?.company?.name, | ||||
| _deleted: props?.review?._deleted, | |||||
| }; | }; | ||||
| }, [props.review]); | }, [props.review]); | ||||
| const handleRemove = () => { | const handleRemove = () => { |
| const RemoveButton = (props) => { | const RemoveButton = (props) => { | ||||
| return ( | return ( | ||||
| <RemoveButtonContainer | <RemoveButtonContainer | ||||
| isRemoved={props.isRemoved} | |||||
| onClick={props.onClick} | onClick={props.onClick} | ||||
| hasGivenReview={props.hasGivenReview} | hasGivenReview={props.hasGivenReview} | ||||
| > | > | ||||
| <RemoveIcon /> | |||||
| <RemoveIcon isRemoved={props.isRemoved} /> | |||||
| </RemoveButtonContainer> | </RemoveButtonContainer> | ||||
| ); | ); | ||||
| }; | }; | ||||
| children: PropTypes.node, | children: PropTypes.node, | ||||
| onClick: PropTypes.func, | onClick: PropTypes.func, | ||||
| hasGivenReview: PropTypes.bool, | hasGivenReview: PropTypes.bool, | ||||
| isRemoved: PropTypes.bool, | |||||
| }; | }; | ||||
| export default RemoveButton; | export default RemoveButton; |
| // import { Box } from "@mui/material"; | // import { Box } from "@mui/material"; | ||||
| import styled from "styled-components"; | |||||
| import styled, { css } from "styled-components"; | |||||
| import { ReactComponent as Remove } from "../../../../../assets/images/svg/trash.svg"; | import { ReactComponent as Remove } from "../../../../../assets/images/svg/trash.svg"; | ||||
| import selectedTheme from "../../../../../themes"; | import selectedTheme from "../../../../../themes"; | ||||
| import { IconButton } from "../../../../Buttons/IconButton/IconButton"; | import { IconButton } from "../../../../Buttons/IconButton/IconButton"; | ||||
| position: absolute; | position: absolute; | ||||
| top: ${(props) => (props.hasGivenReview ? "79px" : "16px")}; | top: ${(props) => (props.hasGivenReview ? "79px" : "16px")}; | ||||
| right: 16px; | right: 16px; | ||||
| background-color: ${selectedTheme.colors.primaryIconBackgroundColor}; | |||||
| background-color: ${props => props.isRemoved ? "transparent" : selectedTheme.colors.primaryIconBackgroundColor}; | |||||
| border-radius: 100%; | border-radius: 100%; | ||||
| width: 32px; | width: 32px; | ||||
| height: 32px; | height: 32px; | ||||
| ${props => props.isRemoved && css` | |||||
| & button:hover { | |||||
| background-color: transparent; | |||||
| cursor: auto; | |||||
| } | |||||
| `} | |||||
| & button { | & button { | ||||
| width: 32px; | width: 32px; | ||||
| height: 32px; | height: 32px; | ||||
| } | } | ||||
| `; | `; | ||||
| export const RemoveIcon = styled(Remove)``; | |||||
| export const RemoveIcon = styled(Remove)` | |||||
| & path { | |||||
| stroke: ${props => props.isRemoved && selectedTheme.colors.blockedColor}; | |||||
| } | |||||
| `; |
| import selectedTheme from "../../../../../themes"; | import selectedTheme from "../../../../../themes"; | ||||
| export const ReviewDetailsContainer = styled(Grid)` | export const ReviewDetailsContainer = styled(Grid)` | ||||
| padding-bottom: 1rem; | |||||
| padding-bottom: 21px; | |||||
| `; | `; | ||||
| export const ReviewDetailsText = styled(Typography)` | export const ReviewDetailsText = styled(Typography)` | ||||
| font-family: ${selectedTheme.fonts.textFont}; | font-family: ${selectedTheme.fonts.textFont}; |
| margin-top: 18px; | margin-top: 18px; | ||||
| align-items: center; | align-items: center; | ||||
| justify-content: start; | justify-content: start; | ||||
| margin-bottom: 15px; | |||||
| margin-bottom: 21px; | |||||
| `; | `; | ||||
| export const ThumbContainer = styled(Grid)` | export const ThumbContainer = styled(Grid)` | ||||
| max-width: 20px; | max-width: 20px; |
| const handleRemove = () => { | const handleRemove = () => { | ||||
| props.handleRemove(); | props.handleRemove(); | ||||
| }; | }; | ||||
| console.log(props.review); | |||||
| return ( | return ( | ||||
| <ReviewContainer> | |||||
| <ReviewContainer | |||||
| lastReview={props.lastReview} | |||||
| className={props.className} | |||||
| hasGivenReview={props.hasGivenReview} | |||||
| > | |||||
| {props.isAdmin && !props.rightReviews && props.hasGivenReview && ( | {props.isAdmin && !props.rightReviews && props.hasGivenReview && ( | ||||
| <GivenReviewsHeader | <GivenReviewsHeader | ||||
| hasGivenReview={props.hasGivenReview} | hasGivenReview={props.hasGivenReview} | ||||
| review={props.review} | review={props.review} | ||||
| onClick={handleRemove} | onClick={handleRemove} | ||||
| hasGivenReview={props.hasGivenReview} | hasGivenReview={props.hasGivenReview} | ||||
| isRemoved={props.review?._deleted} | |||||
| /> | /> | ||||
| )} | )} | ||||
| <ReviewOffer | <ReviewOffer | ||||
| userWhoReceived: PropTypes.any, | userWhoReceived: PropTypes.any, | ||||
| rightReviews: PropTypes.bool, | rightReviews: PropTypes.bool, | ||||
| isAdmin: PropTypes.bool, | isAdmin: PropTypes.bool, | ||||
| className: PropTypes.string, | |||||
| lastReview: PropTypes.bool, | |||||
| }; | |||||
| UserReviewsSingleCard.defaultProps = { | |||||
| lastReview: false, | |||||
| isAdmin: false, | |||||
| rightReviews: false, | |||||
| hasGivenReview: false, | |||||
| showRemoveIcon: false, | |||||
| }; | }; | ||||
| export default UserReviewsSingleCard; | export default UserReviewsSingleCard; |
| import { Box } from "@mui/material"; | import { Box } from "@mui/material"; | ||||
| import styled from "styled-components"; | |||||
| import styled, { css } from "styled-components"; | |||||
| import selectedTheme from "../../../../themes"; | import selectedTheme from "../../../../themes"; | ||||
| export const ReviewContainer = styled(Box)` | export const ReviewContainer = styled(Box)` | ||||
| padding-right: 12px; | padding-right: 12px; | ||||
| position: relative; | position: relative; | ||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| height: 258px; | |||||
| } | |||||
| &::after { | |||||
| content: ""; | |||||
| display: block; | |||||
| border-bottom: 1px solid ${selectedTheme.colors.primaryIconBackgroundColor}; | |||||
| width: calc(100% + 24.4px); | |||||
| height: 1px; | |||||
| position: relative; | |||||
| left: -18px; | |||||
| margin-top: 18px; | |||||
| height: ${props => props.hasGivenReview ? "323px" : "258px"}; | |||||
| } | } | ||||
| ${(props) => | |||||
| !props.lastReview && | |||||
| css` | |||||
| &::after { | |||||
| content: ""; | |||||
| display: block; | |||||
| border-bottom: 1px solid | |||||
| ${selectedTheme.colors.primaryIconBackgroundColor}; | |||||
| width: calc(100% + 24.4px); | |||||
| height: 1px; | |||||
| position: relative; | |||||
| left: -18px; | |||||
| margin-top: 18px; | |||||
| } | |||||
| `} | |||||
| `; | `; |
| import { PrimaryButton } from "../../../Buttons/PrimaryButton/PrimaryButton"; | import { PrimaryButton } from "../../../Buttons/PrimaryButton/PrimaryButton"; | ||||
| export const DeleteButtonContainer = styled(Box)` | export const DeleteButtonContainer = styled(Box)` | ||||
| position: absolute; | |||||
| bottom: 36px; | |||||
| left: 18px; | |||||
| background-color: white !important; | background-color: white !important; | ||||
| border: 0 !important; | border: 0 !important; | ||||
| padding: 0 !important; | padding: 0 !important; | ||||
| @media (max-width: 600px) { | |||||
| position: absolute; | |||||
| bottom: 36px; | |||||
| left: 18px; | |||||
| } | |||||
| `; | `; | ||||
| export const ButtonContainer = styled(PrimaryButton)` | export const ButtonContainer = styled(PrimaryButton)` | ||||
| height: 44px; | height: 44px; | ||||
| width: calc(100vw - 36px); | |||||
| width: 335px; | |||||
| margin: 18px auto; | |||||
| background-color: white !important; | background-color: white !important; | ||||
| & > button { | & > button { | ||||
| background-color: ${(props) => props.buttoncolor} !important; | background-color: ${(props) => props.buttoncolor} !important; | ||||
| } | } | ||||
| @media (max-width: 600px) { | |||||
| width: calc(100vw - 36px); | |||||
| } | |||||
| `; | `; |
| import { | import { | ||||
| DeleteReviewContainer, | DeleteReviewContainer, | ||||
| DeleteReviewTitle, | DeleteReviewTitle, | ||||
| ReviewCard, | |||||
| XIcon, | XIcon, | ||||
| } from "./DeleteReview.styled"; | } from "./DeleteReview.styled"; | ||||
| import BackdropComponent from "../../MUI/BackdropComponent"; | import BackdropComponent from "../../MUI/BackdropComponent"; | ||||
| import UserReviewsSingleCard from "../../Cards/UserReviewsCard/UserReviewsSingleCard/UserReviewsSingleCard"; | |||||
| import { useTranslation } from "react-i18next"; | import { useTranslation } from "react-i18next"; | ||||
| import DeleteButton from "./DeleteButton/DeleteButton"; | import DeleteButton from "./DeleteButton/DeleteButton"; | ||||
| import { useDispatch } from "react-redux"; | import { useDispatch } from "react-redux"; | ||||
| /> | /> | ||||
| <DeleteReviewContainer> | <DeleteReviewContainer> | ||||
| <DeleteReviewTitle>{t("admin.review.title")}</DeleteReviewTitle> | <DeleteReviewTitle>{t("admin.review.title")}</DeleteReviewTitle> | ||||
| <UserReviewsSingleCard | |||||
| showRemoveIcon | |||||
| <ReviewCard | |||||
| deleteModal | deleteModal | ||||
| lastReview | |||||
| review={props.review} | review={props.review} | ||||
| /> | /> | ||||
| <XIcon onClick={closeModalHandler} /> | <XIcon onClick={closeModalHandler} /> |
| import styled from "styled-components"; | import styled from "styled-components"; | ||||
| import selectedTheme from "../../../themes"; | import selectedTheme from "../../../themes"; | ||||
| import { ReactComponent as X } from "../../../assets/images/svg/plus.svg"; | import { ReactComponent as X } from "../../../assets/images/svg/plus.svg"; | ||||
| import UserReviewsSingleCard from "../../Cards/UserReviewsCard/UserReviewsSingleCard/UserReviewsSingleCard"; | |||||
| export const DeleteReviewContainer = styled(Box)` | export const DeleteReviewContainer = styled(Box)` | ||||
| position: fixed; | position: fixed; | ||||
| width: 100vw; | |||||
| height: 100vh; | |||||
| top: 0; | |||||
| left: 0; | |||||
| top: 50%; | |||||
| left: 50%; | |||||
| transform: translate(-50%, -50%); | |||||
| width: 623px; | |||||
| min-height: 492px; | |||||
| background-color: white; | background-color: white; | ||||
| z-index: 150; | z-index: 150; | ||||
| padding: 28px; | |||||
| padding: 37px; | |||||
| & > div { | & > div { | ||||
| margin: 0 auto; | margin: 0 auto; | ||||
| background-color: ${selectedTheme.colors.skeletonItemColor}; | background-color: ${selectedTheme.colors.skeletonItemColor}; | ||||
| } | } | ||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| padding: 36px 28px; | padding: 36px 28px; | ||||
| width: 100vw; | |||||
| min-height: 0; | |||||
| height: 100vh; | |||||
| } | } | ||||
| `; | `; | ||||
| export const DeleteReviewTitle = styled(Typography)` | export const DeleteReviewTitle = styled(Typography)` | ||||
| right: 18px; | right: 18px; | ||||
| } | } | ||||
| `; | `; | ||||
| export const ReviewCard = styled(UserReviewsSingleCard)` | |||||
| width: 335px; | |||||
| `; |
| } else closeModalHandler(); | } else closeModalHandler(); | ||||
| }; | }; | ||||
| const handleSubmit = (values) => { | const handleSubmit = (values) => { | ||||
| console.log(props); | |||||
| dispatch( | dispatch( | ||||
| fetchAdminMethod({ | fetchAdminMethod({ | ||||
| type: props.type, | type: props.type, |
| ${(props) => | ${(props) => | ||||
| props.profile && | props.profile && | ||||
| css` | css` | ||||
| height: calc(100vh - 100px); | |||||
| height: calc(100vh - 138px); | |||||
| position: relative; | position: relative; | ||||
| top: -15px; | top: -15px; | ||||
| `} | `} | ||||
| border: 1px solid ${selectedTheme.colors.borderNormal}; | border: 1px solid ${selectedTheme.colors.borderNormal}; | ||||
| overflow-y: auto; | overflow-y: auto; | ||||
| overflow-x: hidden; | overflow-x: hidden; | ||||
| max-height: ${(props) => (props.isProfileReviews ? "70vh" : "39vh")}; | |||||
| max-height: ${(props) => (props.isProfileReviews ? "80vh" : "39vh")}; | |||||
| @media (max-width: 600px) { | |||||
| height: 450px; | |||||
| } | |||||
| /* overflow-y: auto; */ | /* overflow-y: auto; */ | ||||
| &::-webkit-scrollbar { | &::-webkit-scrollbar { |
| type: SUBCATEGORIES_TYPE, | type: SUBCATEGORIES_TYPE, | ||||
| method: ADD_TYPE, | method: ADD_TYPE, | ||||
| showSecondButton: true, | showSecondButton: true, | ||||
| category, | |||||
| categoryId: category?._id | |||||
| }) | }) | ||||
| ); | ); | ||||
| }; | }; |