| flex: 1; | flex: 1; | ||||
| width: 648px; | width: 648px; | ||||
| height: 345px; | height: 345px; | ||||
| object-fit: cover; | |||||
| `; | `; | ||||
| export const AboutSectionTextContainer = styled(Box)` | export const AboutSectionTextContainer = styled(Box)` | ||||
| display: flex; | display: flex; |
| ${(props) => | ${(props) => | ||||
| props.disabled && | props.disabled && | ||||
| ` | ` | ||||
| border 1px solid ${selectedTheme.colors.iconStrokeDisabledColor}; | |||||
| border 1px solid ${selectedTheme.colors.iconStrokeDisabledColor} !important; | |||||
| &:hover { | &:hover { | ||||
| background-color: inherit; | background-color: inherit; | ||||
| & svg path { | & svg path { |
| } | } | ||||
| } | } | ||||
| `; | `; | ||||
| export const ErrorText = styled(Typography)` | |||||
| color: red; | |||||
| font-family: ${selectedTheme.fonts.textFont}; | |||||
| height: 20px; | |||||
| font-size: 14px; | |||||
| `; |
| import React from "react"; | |||||
| import PropTypes from "prop-types"; | |||||
| import { ErrorText } from "../../CreateOffer.styled"; | |||||
| const ErrorMessage = (props) => { | |||||
| const formik = props.formik; | |||||
| return ( | |||||
| <> | |||||
| {formik.errors.nameOfProduct && formik.touched.nameOfProduct ? ( | |||||
| <ErrorText>{formik.errors.nameOfProduct}</ErrorText> | |||||
| ) : formik.errors.description && formik.touched.description ? ( | |||||
| <ErrorText>{formik.errors.description}</ErrorText> | |||||
| ) : formik.errors.location && formik.touched.location ? ( | |||||
| <ErrorText>{formik.errors.location}</ErrorText> | |||||
| ) : formik.errors.category && formik.touched.category ? ( | |||||
| <ErrorText>{formik.errors.category}</ErrorText> | |||||
| ) : formik.errors.subcategory && formik.touched.subcategory ? ( | |||||
| <ErrorText>{formik.errors.subcategory}</ErrorText> | |||||
| ) : ( | |||||
| <></> | |||||
| )} | |||||
| </> | |||||
| ); | |||||
| }; | |||||
| ErrorMessage.propTypes = { | |||||
| formik: PropTypes.any, | |||||
| }; | |||||
| export default ErrorMessage; |
| import NextButton from "./NextButton/NextButton"; | import NextButton from "./NextButton/NextButton"; | ||||
| import firstPartCreateOfferInitialValues from "../../../../initialValues/createOfferInitialValues/firstPartCreateOfferInitialValues"; | import firstPartCreateOfferInitialValues from "../../../../initialValues/createOfferInitialValues/firstPartCreateOfferInitialValues"; | ||||
| import firstPartCreateOfferValidation from "../../../../validations/createOfferValidation/firstPartCreateOfferValidation"; | import firstPartCreateOfferValidation from "../../../../validations/createOfferValidation/firstPartCreateOfferValidation"; | ||||
| import ErrorMessage from "./ErrorMessage/ErrorMessage"; | |||||
| const FirstPartCreateOffer = (props) => { | const FirstPartCreateOffer = (props) => { | ||||
| const [subcategories, setSubcategories] = useState([]); | const [subcategories, setSubcategories] = useState([]); | ||||
| initialValues, | initialValues, | ||||
| validationSchema, | validationSchema, | ||||
| onSubmit: handleSubmit, | onSubmit: handleSubmit, | ||||
| validateOnBlur: true, | |||||
| // validateOnBlur: true, | |||||
| enableReinitialize: true, | enableReinitialize: true, | ||||
| }); | }); | ||||
| handleSubcategories={handleSubcategories} | handleSubcategories={handleSubcategories} | ||||
| /> | /> | ||||
| <OfferSubcategoryField formik={formik} subcategories={subcategories} /> | <OfferSubcategoryField formik={formik} subcategories={subcategories} /> | ||||
| <ErrorMessage formik={formik} /> | |||||
| <NextButton formik={formik} /> | <NextButton formik={formik} /> | ||||
| </CreateOfferFormContainer> | </CreateOfferFormContainer> | ||||
| ); | ); |
| myOffers={props.myOffers} | myOffers={props.myOffers} | ||||
| skeleton={props.skeleton} | skeleton={props.skeleton} | ||||
| > | > | ||||
| <SkeletonFilterCard | |||||
| skeleton={props.skeleton} | |||||
| /> | |||||
| <SkeletonFilterCard skeleton={props.skeleton} /> | |||||
| {/* Header title for my offers */} | {/* Header title for my offers */} | ||||
| {props.myOffers && <HeaderBack />} | {props.myOffers && <HeaderBack />} | ||||
| /> | /> | ||||
| {/* Locations */} | {/* Locations */} | ||||
| <LocationChoser filters={filters} ref={locationRef} /> | |||||
| {!props.myOffers && ( | |||||
| <LocationChoser filters={filters} ref={locationRef} /> | |||||
| )} | |||||
| </ContentContainer> | </ContentContainer> | ||||
| <FilterFooter | <FilterFooter |
| export const InfoText = styled(Typography)` | export const InfoText = styled(Typography)` | ||||
| font-family: ${selectedTheme.fonts.textFont}; | font-family: ${selectedTheme.fonts.textFont}; | ||||
| text-transform: capitalize; | text-transform: capitalize; | ||||
| color: ${selectedTheme.colors.primaryText}; | |||||
| font-size: 12px; | |||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| font-size: 12px; | font-size: 12px; | ||||
| } | } |
| box-sizing: border-box; | box-sizing: border-box; | ||||
| padding: 0 50px; | padding: 0 50px; | ||||
| margin-top: 34px; | margin-top: 34px; | ||||
| overflow: hidden; | |||||
| @media (max-width: 1200px) { | @media (max-width: 1200px) { | ||||
| padding: 0 36px 0 0; | padding: 0 36px 0 0; | ||||
| `; | `; | ||||
| export const ProfileCardWrapper = styled(Card)` | export const ProfileCardWrapper = styled(Card)` | ||||
| border: 1px solid ${selectedTheme.colors.primaryPurple}; | |||||
| border: 1px solid ${selectedTheme.colors.borderNormal}; | |||||
| background: ${(props) => | background: ${(props) => | ||||
| props.isMyProfile ? selectedTheme.colors.primaryPurple : "white"}; | props.isMyProfile ? selectedTheme.colors.primaryPurple : "white"}; | ||||
| width: 100%; | width: 100%; | ||||
| min-width: fit-content; | min-width: fit-content; | ||||
| padding: 1rem; | padding: 1rem; | ||||
| position: relative; | position: relative; | ||||
| border-radius: 0 0 4px 4px; | |||||
| `; | `; | ||||
| // export const ProfileName = styled(Typography)` | // export const ProfileName = styled(Typography)` | ||||
| export const HeaderTitle = styled(Typography)` | export const HeaderTitle = styled(Typography)` | ||||
| font-size: 16px; | font-size: 16px; | ||||
| font-family: ${selectedTheme.fonts.textFont}; | font-family: ${selectedTheme.fonts.textFont}; | ||||
| color: ${selectedTheme.colors.primaryDarkTextThird}; | |||||
| color: ${selectedTheme.colors.primaryText}; | |||||
| position: relative; | position: relative; | ||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| font-size: 12px; | font-size: 12px; |
| padding-bottom: 1.3rem; | padding-bottom: 1.3rem; | ||||
| margin-bottom: -1rem; | margin-bottom: -1rem; | ||||
| margin-left: -1rem; | margin-left: -1rem; | ||||
| border-radius: 0 0 4px 4px; | |||||
| /* border-radius: 0 0 4px 4px; */ | |||||
| `; | `; | ||||
| export const ProfileStatsGrid = styled(Grid)` | export const ProfileStatsGrid = styled(Grid)` | ||||
| display: flex; | display: flex; |
| import styled from "styled-components"; | import styled from "styled-components"; | ||||
| export const DirectChatContainer = styled(Box)` | export const DirectChatContainer = styled(Box)` | ||||
| margin-bottom: 8px; | |||||
| ` | ` |
| import { Box, Link, Typography } from "@mui/material"; | import { Box, Link, Typography } from "@mui/material"; | ||||
| import styled from "styled-components"; | import styled from "styled-components"; | ||||
| import {ReactComponent as Message} from "../../../assets/images/svg/message.svg"; | |||||
| import { ReactComponent as Message } from "../../../assets/images/svg/message.svg"; | |||||
| import selectedTheme from "../../../themes"; | import selectedTheme from "../../../themes"; | ||||
| export const DirectChatHeaderTitleContainer = styled(Box)` | |||||
| ` | |||||
| export const MessageIcon = styled(Message)` | |||||
| ` | |||||
| export const DirectChatHeaderTitleContainer = styled(Box)``; | |||||
| export const MessageIcon = styled(Message)``; | |||||
| export const HeaderTitleContent = styled(Typography)` | export const HeaderTitleContent = styled(Typography)` | ||||
| font-family: ${selectedTheme.fonts.textFont}; | |||||
| font-size: 16px; | |||||
| position: relative; | |||||
| left: 9px; | |||||
| bottom: 7px; | |||||
| ` | |||||
| font-family: ${selectedTheme.fonts.textFont}; | |||||
| font-size: 16px; | |||||
| position: relative; | |||||
| left: 9px; | |||||
| bottom: 7px; | |||||
| color: ${selectedTheme.colors.primaryText}; | |||||
| `; | |||||
| export const ButtonContainer = styled(Link)` | export const ButtonContainer = styled(Link)` | ||||
| width: fit-content; | width: fit-content; | ||||
| cursor: pointer; | cursor: pointer; |
| font-size: 16px; | font-size: 16px; | ||||
| position: relative; | position: relative; | ||||
| left: 9px; | left: 9px; | ||||
| color: ${selectedTheme.colors.primaryText}; | |||||
| bottom: 7px; | bottom: 7px; | ||||
| ` | ` |
| font-size: 16px; | font-size: 16px; | ||||
| line-height: 22px; | line-height: 22px; | ||||
| letter-spacing: 0.02em; | letter-spacing: 0.02em; | ||||
| border-bottom: 0px solid ${selectedTheme.iconYellowColor}; | |||||
| &:hover { | |||||
| border-bottom: 1px solid ${selectedTheme.colors.iconYellowColor}; | |||||
| } | |||||
| `; | `; |
| import React, { useMemo } from "react"; | import React, { useMemo } from "react"; | ||||
| import PropTypes from "prop-types"; | import PropTypes from "prop-types"; | ||||
| import { | import { | ||||
| ButtonContainer, | |||||
| // ButtonContainer, | |||||
| CategoryHeaderIcon, | CategoryHeaderIcon, | ||||
| HeaderAltLocation, | HeaderAltLocation, | ||||
| HeaderButton, | HeaderButton, | ||||
| HeaderLocation, | HeaderLocation, | ||||
| HeaderOptions, | HeaderOptions, | ||||
| HeaderSelect, | HeaderSelect, | ||||
| HeaderText, | |||||
| // HeaderText, | |||||
| HeaderTitleContainer, | |||||
| HeaderTitleText, | |||||
| HeaderWrapperContainer, | HeaderWrapperContainer, | ||||
| IconStyled, | IconStyled, | ||||
| PageTitleContainer, | PageTitleContainer, | ||||
| SelectOption, | SelectOption, | ||||
| SwapsHeaderIcon, | |||||
| SwapsIcon, | SwapsIcon, | ||||
| SwapsTitle, | SwapsTitle, | ||||
| } from "./Header.styled"; | } from "./Header.styled"; | ||||
| import { useSelector } from "react-redux"; | import { useSelector } from "react-redux"; | ||||
| import { selectHeaderString } from "../../../store/selectors/filtersSelectors"; | import { selectHeaderString } from "../../../store/selectors/filtersSelectors"; | ||||
| import useIsMobile from "../../../hooks/useIsMobile"; | import useIsMobile from "../../../hooks/useIsMobile"; | ||||
| import { ArrowButton } from "../../Buttons/ArrowButton/ArrowButton"; | |||||
| import history from "../../../store/utils/history"; | |||||
| // import { ArrowButton } from "../../Buttons/ArrowButton/ArrowButton"; | |||||
| // import history from "../../../store/utils/history"; | |||||
| const DownArrow = (props) => ( | const DownArrow = (props) => ( | ||||
| <IconStyled {...props}> | <IconStyled {...props}> | ||||
| const { isMobile } = useIsMobile(); | const { isMobile } = useIsMobile(); | ||||
| // Changing header string on refresh or on load | // Changing header string on refresh or on load | ||||
| const showAltString = useMemo(() => { | |||||
| return ( | |||||
| sorting.selectedSortOption === sortEnum.INITIAL || | |||||
| sorting.selectedSortOption === sortEnum.NEW || | |||||
| !sorting.selectedSortOption | |||||
| ); | |||||
| const altString = useMemo(() => { | |||||
| if (sorting.selectedSortOption === sortEnum.OLD) { | |||||
| return t("header.oldOffers"); | |||||
| } | |||||
| if (sorting.selectedSortOption === sortEnum.POPULAR) { | |||||
| return t("header.popularOffers"); | |||||
| } | |||||
| return t("header.newOffers"); | |||||
| }, [sorting.selectedSortOption]); | }, [sorting.selectedSortOption]); | ||||
| const handleChangeSelect = (event) => { | const handleChangeSelect = (event) => { | ||||
| sorting.changeSorting(event.target.value); | sorting.changeSorting(event.target.value); | ||||
| }; | }; | ||||
| const goBack = () => { | |||||
| history.goBack(); | |||||
| }; | |||||
| // const goBack = () => { | |||||
| // history.goBack(); | |||||
| // }; | |||||
| return ( | return ( | ||||
| <> | <> | ||||
| <SkeletonHeader skeleton={props.skeleton} myOffers={props.myOffers}/> | |||||
| <SkeletonHeader skeleton={props.skeleton} myOffers={props.myOffers} /> | |||||
| <HeaderWrapperContainer skeleton={props.skeleton}> | <HeaderWrapperContainer skeleton={props.skeleton}> | ||||
| <HeaderContainer> | <HeaderContainer> | ||||
| {/* Setting appropriate header title if page is market place or my offers */} | {/* Setting appropriate header title if page is market place or my offers */} | ||||
| {!props.myOffers ? ( | {!props.myOffers ? ( | ||||
| <> | <> | ||||
| <CategoryHeaderIcon /> | <CategoryHeaderIcon /> | ||||
| <HeaderLocation initial={showAltString}> | |||||
| <HeaderLocation initial={altString}> | |||||
| {headerString} | {headerString} | ||||
| </HeaderLocation> | </HeaderLocation> | ||||
| {showAltString && ( | |||||
| <HeaderAltLocation> | |||||
| {t("header.newOffers")} | |||||
| </HeaderAltLocation> | |||||
| )} | |||||
| <HeaderAltLocation>{altString}</HeaderAltLocation> | |||||
| </> | </> | ||||
| ) : ( | ) : ( | ||||
| <ButtonContainer onClick={goBack}> | |||||
| <ArrowButton side={"left"}></ArrowButton> | |||||
| <HeaderText>{t("profile.backToHome")}</HeaderText> | |||||
| </ButtonContainer> | |||||
| <HeaderTitleContainer> | |||||
| <SwapsHeaderIcon /> | |||||
| <HeaderTitleText>{t("header.myOffers")}</HeaderTitleText> | |||||
| </HeaderTitleContainer> | |||||
| )} | )} | ||||
| </> | </> | ||||
| </Tooltip> | </Tooltip> |
| font-size: 14px; | font-size: 14px; | ||||
| } | } | ||||
| `; | `; | ||||
| export const SwapsHeaderIcon = styled(SwapsIcon)` | |||||
| width: 18px; | |||||
| height: 18px; | |||||
| ` | |||||
| export const HeaderTitleContainer = styled(Box)` | |||||
| position: relative; | |||||
| left: 5px; | |||||
| ` | |||||
| export const HeaderTitleText = styled(Typography)` | |||||
| font-family: ${selectedTheme.fonts.textFont}; | |||||
| color: ${selectedTheme.colors.primaryText}; | |||||
| font-size: 16px; | |||||
| position: relative; | |||||
| bottom: 2px; | |||||
| ` |
| import React from "react"; | import React from "react"; | ||||
| import PropTypes from "prop-types"; | import PropTypes from "prop-types"; | ||||
| import { Arrow, ButtonContainer, LinkText, PricesHeaderContainer, PricesHeaderTitle } from "./PricesHeader.styled"; | |||||
| import { Arrow, ButtonContainer, LinkText, PricesHeaderContainer, PricesHeaderLine, PricesHeaderTitle } from "./PricesHeader.styled"; | |||||
| import { useTranslation } from "react-i18next"; | import { useTranslation } from "react-i18next"; | ||||
| const PricesHeader = () => { | const PricesHeader = () => { | ||||
| return ( | return ( | ||||
| <PricesHeaderContainer> | <PricesHeaderContainer> | ||||
| <PricesHeaderTitle>{t("prices.header.title")}</PricesHeaderTitle> | <PricesHeaderTitle>{t("prices.header.title")}</PricesHeaderTitle> | ||||
| <PricesHeaderLine /> | |||||
| <ButtonContainer> | <ButtonContainer> | ||||
| <LinkText>{t("prices.header.link")}</LinkText> | <LinkText>{t("prices.header.link")}</LinkText> | ||||
| <Arrow /> | <Arrow /> |
| display: flex; | display: flex; | ||||
| flex: 1; | flex: 1; | ||||
| `; | `; | ||||
| export const PricesHeaderLine = styled(Box)` | |||||
| border-top: 1px solid ${selectedTheme.colors.iconYellowColor}; | |||||
| width: 90px; | |||||
| margin-bottom: 26px; | |||||
| `; | |||||
| export const PricesHeaderContainer = styled(Box)` | export const PricesHeaderContainer = styled(Box)` | ||||
| display: flex; | display: flex; | ||||
| flex-direction: row; | |||||
| flex-direction: column; | |||||
| width: 100%; | width: 100%; | ||||
| justify-content: space-between; | justify-content: space-between; | ||||
| `; | `; |
| isMyOffer={props.isMyProfile} | isMyOffer={props.isMyProfile} | ||||
| offer={item} | offer={item} | ||||
| key={JSON.stringify(item)} | key={JSON.stringify(item)} | ||||
| pinned | |||||
| messageUser={messageUser} | messageUser={messageUser} | ||||
| /> | /> | ||||
| )) | )) |
| width: 210px; | width: 210px; | ||||
| height: 35px; | height: 35px; | ||||
| font-family: ${selectedTheme.fonts.textFont}; | font-family: ${selectedTheme.fonts.textFont}; | ||||
| background: white; | |||||
| margin-top: 3px; | margin-top: 3px; | ||||
| font-weight: 400; | font-weight: 400; | ||||
| position: absolute; | position: absolute; |
| <NoReviewsContainer> | <NoReviewsContainer> | ||||
| <NoReviewsText>{t("reviews.title")}</NoReviewsText> | <NoReviewsText>{t("reviews.title")}</NoReviewsText> | ||||
| <NoReviewsAltText>{t("reviews.altTitle")}</NoReviewsAltText> | <NoReviewsAltText>{t("reviews.altTitle")}</NoReviewsAltText> | ||||
| <UserReviewsSkeleton numOfElements={isMobile ? 1 : 2} /> | |||||
| <UserReviewsSkeleton noReviews numOfElements={isMobile ? 1 : 2} /> | |||||
| </NoReviewsContainer> | </NoReviewsContainer> | ||||
| ); | ); | ||||
| }; | }; |
| import selectedTheme from "../../../themes" | import selectedTheme from "../../../themes" | ||||
| export const NoReviewsContainer = styled(Box)` | export const NoReviewsContainer = styled(Box)` | ||||
| text-align: center; | |||||
| margin-top: 36px; | |||||
| ` | ` | ||||
| export const NoReviewsText = styled(Typography)` | export const NoReviewsText = styled(Typography)` | ||||
| color: ${selectedTheme.colors.primaryPurple}; | color: ${selectedTheme.colors.primaryPurple}; | ||||
| font-family: ${selectedTheme.fonts.textFont}; | font-family: ${selectedTheme.fonts.textFont}; | ||||
| text-align: center; | text-align: center; | ||||
| font-weight: 700; | font-weight: 700; | ||||
| width: 100%; | |||||
| width: 229px; | |||||
| ` | ` | ||||
| export const NoReviewsAltText = styled(Typography)` | export const NoReviewsAltText = styled(Typography)` |
| display: flex; | display: flex; | ||||
| flex-direction: row; | flex-direction: row; | ||||
| & * { | & * { | ||||
| background-color: ${(props) => | |||||
| props.skeleton | |||||
| ? `${selectedTheme.colors.skeletonItemColor}` | |||||
| : `${selectedTheme.colors.filterSkeletonBackgroundSecond}`}; | |||||
| } | |||||
| & * { | |||||
| background-color: ${selectedTheme.colors.skeletonItemColor}; | |||||
| ${(props) => | ${(props) => | ||||
| props.skeleton && | props.skeleton && | ||||
| css` | css` | ||||
| width: 54px; | width: 54px; | ||||
| height: 54px; | height: 54px; | ||||
| border-radius: 100%; | border-radius: 100%; | ||||
| background-color: ${selectedTheme.colors.skeletonItemColor}; | |||||
| ${(props) => | ${(props) => | ||||
| props.skeleton && | props.skeleton && | ||||
| css` | css` | ||||
| height: 18px; | height: 18px; | ||||
| margin-top: 18px; | margin-top: 18px; | ||||
| margin-left: 18px; | margin-left: 18px; | ||||
| background-color: ${selectedTheme.colors.skeletonItemColor}; | |||||
| ${(props) => | ${(props) => | ||||
| props.skeleton && | props.skeleton && | ||||
| css` | css` | ||||
| export const UserReviewsSkeletonSquareImage = styled(Box)` | export const UserReviewsSkeletonSquareImage = styled(Box)` | ||||
| width: 54px; | width: 54px; | ||||
| height: 54px; | height: 54px; | ||||
| background-color: ${(props) => | |||||
| props.skeleton | |||||
| ? `${selectedTheme.colors.skeletonItemColor}` | |||||
| : `${selectedTheme.colors.filterSkeletonBackgroundSecond}`}; | |||||
| background-color: ${selectedTheme.colors.skeletonItemColor}; | |||||
| ${(props) => | ${(props) => | ||||
| props.skeleton && | props.skeleton && | ||||
| css` | css` | ||||
| export const UserReviewsSkeletonSquareInfoFirstLine = styled(Box)` | export const UserReviewsSkeletonSquareInfoFirstLine = styled(Box)` | ||||
| width: 121px; | width: 121px; | ||||
| height: 14px; | height: 14px; | ||||
| background-color: ${(props) => | |||||
| props.skeleton | |||||
| ? `${selectedTheme.colors.skeletonItemColor}` | |||||
| : `${selectedTheme.colors.filterSkeletonBackgroundSecond}`}; | |||||
| background-color: ${selectedTheme.colors.skeletonItemColor}; | |||||
| ${(props) => | ${(props) => | ||||
| props.skeleton && | props.skeleton && | ||||
| width: 78px; | width: 78px; | ||||
| height: 18px; | height: 18px; | ||||
| margin-top: 6px; | margin-top: 6px; | ||||
| background-color: ${(props) => | |||||
| props.skeleton | |||||
| ? `${selectedTheme.colors.skeletonItemColor}` | |||||
| : `${selectedTheme.colors.filterSkeletonBackgroundSecond}`}; | |||||
| background-color: ${selectedTheme.colors.skeletonItemColor}; | |||||
| ${(props) => | ${(props) => | ||||
| props.skeleton && | props.skeleton && | ||||
| css` | css` |
| import { reviewSortEnum } from "../../../enums/reviewEnum"; | import { reviewSortEnum } from "../../../enums/reviewEnum"; | ||||
| import { setReviews } from "../../../store/actions/review/reviewActions"; | import { setReviews } from "../../../store/actions/review/reviewActions"; | ||||
| const ReviewsSorting = () => { | |||||
| const ReviewsSorting = (props) => { | |||||
| const reviews = useSelector(selectSelectedReviews); | const reviews = useSelector(selectSelectedReviews); | ||||
| const dispatch = useDispatch(); | const dispatch = useDispatch(); | ||||
| const [value, setValue] = useState(); | const [value, setValue] = useState(); | ||||
| ) | ) | ||||
| ) | ) | ||||
| ); | ); | ||||
| props.changeSorting(); | |||||
| setValue(event.target.value); | setValue(event.target.value); | ||||
| }; | }; | ||||
| return ( | return ( | ||||
| ReviewsSorting.propTypes = { | ReviewsSorting.propTypes = { | ||||
| children: PropTypes.node, | children: PropTypes.node, | ||||
| changeSorting: PropTypes.func, | |||||
| }; | }; | ||||
| export default ReviewsSorting; | export default ReviewsSorting; |
| import React, { useEffect, useMemo } from "react"; | |||||
| import React, { useEffect, useMemo, useRef } from "react"; | |||||
| import PropTypes from "prop-types"; | import PropTypes from "prop-types"; | ||||
| import { | import { | ||||
| ReviewList, | ReviewList, | ||||
| const reviews = useSelector(selectSelectedReviews); | const reviews = useSelector(selectSelectedReviews); | ||||
| const routeMatch = useRouteMatch(); | const routeMatch = useRouteMatch(); | ||||
| const dispatch = useDispatch(); | const dispatch = useDispatch(); | ||||
| const listRef = useRef(null); | |||||
| const isLoadingReview = useSelector( | const isLoadingReview = useSelector( | ||||
| selectIsLoadingByActionType( | selectIsLoadingByActionType( | ||||
| return []; | return []; | ||||
| }, [props.profileReviews, offer, props.isProfileReviews, reviews]); | }, [props.profileReviews, offer, props.isProfileReviews, reviews]); | ||||
| const scrollToTop = () => { | |||||
| listRef.current.scrollTo({ top: 0, behaviour: "smooth" }); | |||||
| }; | |||||
| return ( | return ( | ||||
| <> | <> | ||||
| {!props.givingReview && | {!props.givingReview && | ||||
| /> | /> | ||||
| <ReviewsTitle>{t("reviews.rates")}</ReviewsTitle> | <ReviewsTitle>{t("reviews.rates")}</ReviewsTitle> | ||||
| </ReviewsHeaderTitle> | </ReviewsHeaderTitle> | ||||
| <ReviewsSorting /> | |||||
| <ReviewsSorting changeSorting={scrollToTop} /> | |||||
| </ReviewsHeader> | </ReviewsHeader> | ||||
| )} | )} | ||||
| <ReviewList isProfileReviews={props.isProfileReviews}> | |||||
| <ReviewList ref={listRef} isProfileReviews={props.isProfileReviews}> | |||||
| {lastThreeReviews?.length > 0 ? ( | {lastThreeReviews?.length > 0 ? ( | ||||
| lastThreeReviews?.map((review, index) => ( | lastThreeReviews?.map((review, index) => ( | ||||
| <UserReviewsCard | <UserReviewsCard |
| /* @media (max-width: 1200px) { | /* @media (max-width: 1200px) { | ||||
| padding: 0 50px; | padding: 0 50px; | ||||
| } */ | } */ | ||||
| ${(props) => | |||||
| props.profile && | |||||
| ` | |||||
| position: relative; | |||||
| top: -15px; | |||||
| `} | |||||
| margin-top: ${(props) => (props.profile ? "60px" : "0")}; | margin-top: ${(props) => (props.profile ? "60px" : "0")}; | ||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| position: relative; | position: relative; |
| useDifferentEmail: "Iskoristite drugačiju lozinku.", | useDifferentEmail: "Iskoristite drugačiju lozinku.", | ||||
| wrongCredentials: "Pogrešan mail ili lozinka!", | wrongCredentials: "Pogrešan mail ili lozinka!", | ||||
| headerTitle: "Ulogujte se", | headerTitle: "Ulogujte se", | ||||
| nameOfProductError: "Naslov je obavezan!", | |||||
| descriptionRequiredError: "Opis je obavezan!", | |||||
| descriptionNoOfCharsError: "Opis mora imati najmanje 8 karaktera!", | |||||
| locationError: "Unesite ispravnu lokaciju!", | |||||
| categoryError: "Kategorija je obavezna!", | |||||
| subcategoryError: "Podkategorija je obavezna!" | |||||
| }, | }, | ||||
| password: { | password: { | ||||
| weak: "slaba", | weak: "slaba", | ||||
| checkEverything: "POGLEDAJ SVE", | checkEverything: "POGLEDAJ SVE", | ||||
| myMessages: "Moje poruke", | myMessages: "Moje poruke", | ||||
| newOffers: "Najnovije ponude", | newOffers: "Najnovije ponude", | ||||
| oldOffers: "Najstarije ponude", | |||||
| popularOffers: "Najpopularnije ponude", | |||||
| navMenu: "Navigacioni Meni", | navMenu: "Navigacioni Meni", | ||||
| noItems: "Trenutno nema ni jedne stavke...", | noItems: "Trenutno nema ni jedne stavke...", | ||||
| logout: "Odjavite se", | logout: "Odjavite se", |
| registerUser({ ...informations, ...values }); | registerUser({ ...informations, ...values }); | ||||
| } | } | ||||
| } | } | ||||
| console.log({...informations, ...values}) | |||||
| setInformations({ ...informations, ...values }); | setInformations({ ...informations, ...values }); | ||||
| }; | }; | ||||
| }, | }, | ||||
| validationSchema: Yup.object().shape({ | validationSchema: Yup.object().shape({ | ||||
| nameOfFirm: Yup.string().required(t("login.usernameRequired")), | nameOfFirm: Yup.string().required(t("login.usernameRequired")), | ||||
| PIB: Yup.number() | |||||
| PIB: Yup.string() | |||||
| .required(t("login.passwordRequired")) | .required(t("login.passwordRequired")) | ||||
| .min(100000000, "PIB mora imati 9 karaktera!") | |||||
| .max(999999999, "PIB mora imati 9 karaktera!"), | |||||
| .min(9, t("register.PIBnoOfCharacters")) | |||||
| .max(9, t("register.PIBnoOfCharacters")), | |||||
| }), | }), | ||||
| onSubmit: props.handleSubmit, | onSubmit: props.handleSubmit, | ||||
| validateOnBlur: true, | validateOnBlur: true, | ||||
| margin="normal" | margin="normal" | ||||
| type="number" | type="number" | ||||
| value={formik.values.PIB} | value={formik.values.PIB} | ||||
| onChange={formik.handleChange} | |||||
| onChange={(event) => { | |||||
| formik.setFieldValue("PIB", event.target.value) | |||||
| }} | |||||
| error={ | error={ | ||||
| (formik.touched.PIB && Boolean(formik.errors.PIB)) || PIBTakenStatus | (formik.touched.PIB && Boolean(formik.errors.PIB)) || PIBTakenStatus | ||||
| } | } |
| export default (locations, categories, subcategories) => | export default (locations, categories, subcategories) => | ||||
| Yup.object().shape({ | Yup.object().shape({ | ||||
| nameOfProduct: Yup.string().required( | |||||
| i18next.t("login.nameOfProductRequired") | |||||
| ), | |||||
| nameOfProduct: Yup.string().required(i18next.t("login.nameOfProductError")), | |||||
| description: Yup.string() | description: Yup.string() | ||||
| .required(i18next.t("login.descriptionRequired")) | |||||
| .min(8), | |||||
| location: Yup.string().oneOf(locations.map((l) => l.city)), | |||||
| category: Yup.string().oneOf(categories.map((c) => c.name)), | |||||
| subcategory: Yup.string().oneOf(subcategories || []), | |||||
| .required(i18next.t("login.descriptionRequiredError")) | |||||
| .min(8, i18next.t("login.descriptionNoOfCharsError")), | |||||
| location: Yup.string().oneOf( | |||||
| locations.map((l) => l.city), | |||||
| i18next.t("login.locationError") | |||||
| ), | |||||
| category: Yup.string().oneOf( | |||||
| categories.map((c) => c.name), | |||||
| i18next.t("login.categoryError") | |||||
| ), | |||||
| subcategory: Yup.string().oneOf( | |||||
| subcategories || [], | |||||
| i18next.t("login.subcategoryError") | |||||
| ), | |||||
| }); | }); |