| const formik = props.formik; | const formik = props.formik; | ||||
| return ( | return ( | ||||
| <> | <> | ||||
| {formik.errors.nameOfProduct ? ( | |||||
| {formik.errors.nameOfProduct && formik.touched.nameOfProduct ? ( | |||||
| <ErrorText>{formik.errors.nameOfProduct}</ErrorText> | <ErrorText>{formik.errors.nameOfProduct}</ErrorText> | ||||
| ) : formik.errors.description ? ( | |||||
| ) : formik.errors.description && formik.touched.description ? ( | |||||
| <ErrorText>{formik.errors.description}</ErrorText> | <ErrorText>{formik.errors.description}</ErrorText> | ||||
| ) : formik.errors.location ? ( | |||||
| ) : formik.errors.location && formik.touched.location ? ( | |||||
| <ErrorText>{formik.errors.location}</ErrorText> | <ErrorText>{formik.errors.location}</ErrorText> | ||||
| ) : formik.errors.category ? ( | |||||
| ) : formik.errors.category && formik.touched.category ? ( | |||||
| <ErrorText>{formik.errors.category}</ErrorText> | <ErrorText>{formik.errors.category}</ErrorText> | ||||
| ) : formik.errors.subcategory ? ( | |||||
| ) : formik.errors.subcategory && formik.touched.subcategory ? ( | |||||
| <ErrorText>{formik.errors.subcategory}</ErrorText> | <ErrorText>{formik.errors.subcategory}</ErrorText> | ||||
| ) : (<></>)} | |||||
| ) : ( | |||||
| <></> | |||||
| )} | |||||
| </> | </> | ||||
| ); | ); | ||||
| }; | }; | ||||
| ErrorMessage.propTypes = { | ErrorMessage.propTypes = { | ||||
| formik: PropTypes.any, | |||||
| formik: PropTypes.any, | |||||
| }; | }; | ||||
| export default ErrorMessage; | export default ErrorMessage; |
| initialValues, | initialValues, | ||||
| validationSchema, | validationSchema, | ||||
| onSubmit: handleSubmit, | onSubmit: handleSubmit, | ||||
| validateOnBlur: true, | |||||
| // validateOnBlur: true, | |||||
| enableReinitialize: true, | enableReinitialize: true, | ||||
| }); | }); | ||||
| 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 |
| 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)` |
| 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; |
| 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 { | &:hover { | ||||
| border-bottom: 1px solid ${selectedTheme.colors.iconYellowColor}; | 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 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 ( | ||||
| <> | <> | ||||
| <HeaderAltLocation>{altString}</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; | |||||
| ` |
| 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` |
| /* @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; |
| 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("offer.nameOfProductError")), | |||||
| nameOfProduct: Yup.string().required(i18next.t("login.nameOfProductError")), | |||||
| description: Yup.string() | description: Yup.string() | ||||
| .required(i18next.t("offer.descriptionRequiredError")) | |||||
| .min(8, i18next.t("offer.descriptionNoOfCharsError")), | |||||
| .required(i18next.t("login.descriptionRequiredError")) | |||||
| .min(8, i18next.t("login.descriptionNoOfCharsError")), | |||||
| location: Yup.string().oneOf( | location: Yup.string().oneOf( | ||||
| locations.map((l) => l.city), | locations.map((l) => l.city), | ||||
| i18next.t("offer.locationError") | |||||
| i18next.t("login.locationError") | |||||
| ), | ), | ||||
| category: Yup.string().oneOf( | category: Yup.string().oneOf( | ||||
| categories.map((c) => c.name), | categories.map((c) => c.name), | ||||
| i18next.t("offer.categoryError") | |||||
| i18next.t("login.categoryError") | |||||
| ), | ), | ||||
| subcategory: Yup.string().oneOf( | subcategory: Yup.string().oneOf( | ||||
| subcategories || [], | subcategories || [], | ||||
| i18next.t("offer.subcategoryError") | |||||
| i18next.t("login.subcategoryError") | |||||
| ), | ), | ||||
| }); | }); |