| } from "./AboutSection.styled"; | } from "./AboutSection.styled"; | ||||
| const AboutSection = (props) => { | const AboutSection = (props) => { | ||||
| console.log(props); | |||||
| return ( | return ( | ||||
| <AboutSectionContainer reverse={props.reverse}> | <AboutSectionContainer reverse={props.reverse}> | ||||
| <AboutSectionTextContainer> | <AboutSectionTextContainer> |
| ), | ), | ||||
| name: props.informations.nameOfProduct, | name: props.informations.nameOfProduct, | ||||
| description: props.informations.description, | description: props.informations.description, | ||||
| location: props.informations.location, | |||||
| }, | }, | ||||
| }), | }), | ||||
| [props.informations] | [props.informations] |
| PinIconContainer, | PinIconContainer, | ||||
| PinIcon, | PinIcon, | ||||
| UnpinIcon, | UnpinIcon, | ||||
| LocationIcon, | |||||
| // EditDeleteButtons, | // EditDeleteButtons, | ||||
| } from "./ItemDetailsCard.styled"; | } from "./ItemDetailsCard.styled"; | ||||
| import selectedTheme from "../../../themes"; | import selectedTheme from "../../../themes"; | ||||
| import Information from "./OfferInformations/SingleInformation/SingleInformation"; | import Information from "./OfferInformations/SingleInformation/SingleInformation"; | ||||
| import { useTranslation } from "react-i18next"; | import { useTranslation } from "react-i18next"; | ||||
| import OfferDetails from "./OfferDetails/OfferDetails"; | import OfferDetails from "./OfferDetails/OfferDetails"; | ||||
| import { useRouteMatch } from "react-router-dom"; | |||||
| import { useRouteMatch, useHistory } from "react-router-dom"; | |||||
| import itemDetailsData from "../../../notFoundData/itemDetailsData"; | import itemDetailsData from "../../../notFoundData/itemDetailsData"; | ||||
| import { | import { | ||||
| toggleDeleteOfferModal, | toggleDeleteOfferModal, | ||||
| toggleEditOfferModal, | toggleEditOfferModal, | ||||
| } from "../../../store/actions/modal/modalActions"; | } from "../../../store/actions/modal/modalActions"; | ||||
| import { getExistChat } from "../../../store/actions/chat/chatActions"; | import { getExistChat } from "../../../store/actions/chat/chatActions"; | ||||
| import useIsLoggedIn from "../../../hooks/useIsLoggedIn"; | |||||
| import { LOGIN_PAGE } from "../../../constants/pages"; | |||||
| const ItemDetailsCard = (props) => { | const ItemDetailsCard = (props) => { | ||||
| // const offer = props.offer; | // const offer = props.offer; | ||||
| const routeMatch = useRouteMatch(); | const routeMatch = useRouteMatch(); | ||||
| const chats = useSelector(selectLatestChats); | const chats = useSelector(selectLatestChats); | ||||
| const userId = useSelector(selectUserId); | const userId = useSelector(selectUserId); | ||||
| const history = useHistory(); | |||||
| const { isLoggedIn } = useIsLoggedIn(); | |||||
| const { t } = useTranslation(); | const { t } = useTranslation(); | ||||
| const dispatch = useDispatch(); | const dispatch = useDispatch(); | ||||
| const offer = useMemo(() => { | const offer = useMemo(() => { | ||||
| }; | }; | ||||
| const startExchange = () => { | const startExchange = () => { | ||||
| dispatch( | |||||
| getExistChat({ | |||||
| userId: userId, | |||||
| offerId: props.offer._id, | |||||
| handleApiResponseSuccess, | |||||
| }) | |||||
| ); | |||||
| if (!isLoggedIn) { | |||||
| history.push({ | |||||
| pathname: LOGIN_PAGE, | |||||
| }); | |||||
| } else { | |||||
| dispatch( | |||||
| getExistChat({ | |||||
| userId: userId, | |||||
| offerId: props.offer._id, | |||||
| handleApiResponseSuccess, | |||||
| }) | |||||
| ); | |||||
| } | |||||
| }; | }; | ||||
| const showDeleteOfferModalHandler = () => { | const showDeleteOfferModalHandler = () => { | ||||
| ); | ); | ||||
| }; | }; | ||||
| console.log(props); | |||||
| return ( | return ( | ||||
| <> | <> | ||||
| <ItemDetailsCardContainer | <ItemDetailsCardContainer | ||||
| value={offer?.subcategory} | value={offer?.subcategory} | ||||
| /> | /> | ||||
| <Information icon={<QuantityIcon />} value={offer?.condition} /> | <Information icon={<QuantityIcon />} value={offer?.condition} /> | ||||
| <Information | |||||
| icon={<LocationIcon />} | |||||
| value={props.previewCard ? offer?.location : offer?.location.city} | |||||
| /> | |||||
| {!props.hideViews && ( | {!props.hideViews && ( | ||||
| <Information icon={<EyeIcon />} value={offer?.views?.count} /> | <Information icon={<EyeIcon />} value={offer?.views?.count} /> | ||||
| )} | )} |
| import { ReactComponent as Pin } from "../../../assets/images/svg/pin-outlined.svg"; | import { ReactComponent as Pin } from "../../../assets/images/svg/pin-outlined.svg"; | ||||
| import { ReactComponent as Unpin } from "../../../assets/images/svg/unpin-outlined.svg"; | import { ReactComponent as Unpin } from "../../../assets/images/svg/unpin-outlined.svg"; | ||||
| import { ReactComponent as Remove } from "../../../assets/images/svg/trash.svg"; | import { ReactComponent as Remove } from "../../../assets/images/svg/trash.svg"; | ||||
| import { ReactComponent as Location } from "../../../assets/images/svg/location.svg"; | |||||
| export const ItemDetailsCardContainer = styled(Container)` | export const ItemDetailsCardContainer = styled(Container)` | ||||
| display: flex; | display: flex; | ||||
| position: static; | position: static; | ||||
| } | } | ||||
| `; | `; | ||||
| export const LocationIcon = styled(Location)` | |||||
| width: 18px; | |||||
| `; |
| flex-direction: row; | flex-direction: row; | ||||
| align-items: center; | align-items: center; | ||||
| gap: 4px; | gap: 4px; | ||||
| @media (max-width: 600px) { | |||||
| max-width: calc(100% / 5); | |||||
| } | |||||
| `; | `; | ||||
| export const InfoIcon = styled(Box)` | export const InfoIcon = styled(Box)` | ||||
| display: flex; | display: flex; |
| import React from "react"; | import React from "react"; | ||||
| import PropTypes from "prop-types"; | import PropTypes from "prop-types"; | ||||
| import { | import { | ||||
| AlreadyFinishedExhangeMessage, | |||||
| RequestExchangeMessageButton, | RequestExchangeMessageButton, | ||||
| RequestExchangeMessageButtonsContainer, | RequestExchangeMessageButtonsContainer, | ||||
| RequestExchangeMessageContainer, | RequestExchangeMessageContainer, | ||||
| import { convertLocalDateToUTCDate } from "../../../../util/helpers/dateHelpers"; | import { convertLocalDateToUTCDate } from "../../../../util/helpers/dateHelpers"; | ||||
| import requesterStatus from "../../../../constants/requesterStatus"; | import requesterStatus from "../../../../constants/requesterStatus"; | ||||
| import { selectJwtToken } from "../../../../store/selectors/loginSelectors"; | import { selectJwtToken } from "../../../../store/selectors/loginSelectors"; | ||||
| import { selectOffers } from "../../../../store/selectors/offersSelectors"; | |||||
| const RequestExchangeMessage = (props) => { | const RequestExchangeMessage = (props) => { | ||||
| const { t } = useTranslation(); | const { t } = useTranslation(); | ||||
| const dispatch = useDispatch(); | const dispatch = useDispatch(); | ||||
| const exchange = useSelector(selectExchange); | const exchange = useSelector(selectExchange); | ||||
| const requester = useSelector(selectRequester); | const requester = useSelector(selectRequester); | ||||
| const token = useSelector(selectJwtToken) | |||||
| const token = useSelector(selectJwtToken); | |||||
| const offers = useSelector(selectOffers); | |||||
| const isOfferExist = offers.filter( | |||||
| (offer) => offer._id === exchange?.offer?._id | |||||
| ); | |||||
| const handleAcceptExchangeSuccess = () => { | const handleAcceptExchangeSuccess = () => { | ||||
| console.log("accept salje i prima 3 POZVANA RESPONSE FUNKCIJA"); | console.log("accept salje i prima 3 POZVANA RESPONSE FUNKCIJA"); | ||||
| }) | }) | ||||
| ); | ); | ||||
| }; | }; | ||||
| return ( | return ( | ||||
| <RequestExchangeMessageContainer> | |||||
| <RequestExchangeMessageText> | |||||
| {t("messages.requestReceived")} | |||||
| </RequestExchangeMessageText> | |||||
| <RequestExchangeMessageButtonsContainer> | |||||
| {!props.haveIAccepted && ( | |||||
| <RequestExchangeMessageButton variant="outlined" white> | |||||
| {t("messages.declineRequest")} | |||||
| </RequestExchangeMessageButton> | |||||
| )} | |||||
| <RequestExchangeMessageButton | |||||
| variant="contained" | |||||
| onClick={handleAcceptExchange} | |||||
| disabled={props.haveIAccepted} | |||||
| > | |||||
| {props.haveIAccepted | |||||
| ? t("messages.acceptedRequest") | |||||
| : t("messages.acceptRequest")} | |||||
| </RequestExchangeMessageButton> | |||||
| </RequestExchangeMessageButtonsContainer> | |||||
| </RequestExchangeMessageContainer> | |||||
| <> | |||||
| {isOfferExist.length > 0 ? ( | |||||
| <RequestExchangeMessageContainer> | |||||
| <RequestExchangeMessageText> | |||||
| {t("messages.requestReceived")} | |||||
| </RequestExchangeMessageText> | |||||
| <RequestExchangeMessageButtonsContainer> | |||||
| {!props.haveIAccepted && ( | |||||
| <RequestExchangeMessageButton variant="outlined" white> | |||||
| {t("messages.declineRequest")} | |||||
| </RequestExchangeMessageButton> | |||||
| )} | |||||
| <RequestExchangeMessageButton | |||||
| variant="contained" | |||||
| onClick={handleAcceptExchange} | |||||
| disabled={props.haveIAccepted} | |||||
| > | |||||
| {props.haveIAccepted | |||||
| ? t("messages.acceptedRequest") | |||||
| : t("messages.acceptRequest")} | |||||
| </RequestExchangeMessageButton> | |||||
| </RequestExchangeMessageButtonsContainer> | |||||
| </RequestExchangeMessageContainer> | |||||
| ) : ( | |||||
| <AlreadyFinishedExhangeMessage> | |||||
| {t("messages.notAllowedChat")} | |||||
| </AlreadyFinishedExhangeMessage> | |||||
| )} | |||||
| </> | |||||
| ); | ); | ||||
| }; | }; | ||||
| } | } | ||||
| } | } | ||||
| `; | `; | ||||
| export const AlreadyFinishedExhangeMessage = styled(Typography)` | |||||
| font-family: ${selectedTheme.fonts.textFont}; | |||||
| font-size: 16px; | |||||
| line-height: 22px; | |||||
| color: ${selectedTheme.colors.primaryText}; | |||||
| `; |
| import { NextButton as NextButtonContainer } from "../../CreateReview.styled"; | import { NextButton as NextButtonContainer } from "../../CreateReview.styled"; | ||||
| import { useTranslation } from "react-i18next"; | import { useTranslation } from "react-i18next"; | ||||
| const NextButton = (props) => { | |||||
| const NextButton = () => { | |||||
| const { t } = useTranslation(); | const { t } = useTranslation(); | ||||
| return ( | return ( | ||||
| <NextButtonContainer | <NextButtonContainer | ||||
| fullWidth | fullWidth | ||||
| height="48px" | height="48px" | ||||
| type="submit" | type="submit" | ||||
| disabled={props.formik.values.comment?.length < 5} | |||||
| // disabled={props.formik.values.comment?.length < 5} | |||||
| > | > | ||||
| {t("common.continue")} | {t("common.continue")} | ||||
| </NextButtonContainer> | </NextButtonContainer> |
| import useIsTablet from "../../hooks/useIsTablet"; | import useIsTablet from "../../hooks/useIsTablet"; | ||||
| import { clearFilters } from "../../store/actions/filters/filtersActions"; | import { clearFilters } from "../../store/actions/filters/filtersActions"; | ||||
| import { selectLatestChats } from "../../store/selectors/chatSelectors"; | import { selectLatestChats } from "../../store/selectors/chatSelectors"; | ||||
| import useIsLoggedIn from "../../hooks/useIsLoggedIn"; | |||||
| const Header = () => { | const Header = () => { | ||||
| const theme = useTheme(); | const theme = useTheme(); | ||||
| const { isTablet } = useIsTablet(); | const { isTablet } = useIsTablet(); | ||||
| const [logoClicked, setLogoClicked] = useState(false); | const [logoClicked, setLogoClicked] = useState(false); | ||||
| const [badge, setBadge] = useState(0); | const [badge, setBadge] = useState(0); | ||||
| const { isLoggedIn } = useIsLoggedIn(); | |||||
| console.log(isLoggedIn); | |||||
| const { t } = useTranslation(); | const { t } = useTranslation(); | ||||
| const allChats = useSelector(selectLatestChats); | const allChats = useSelector(selectLatestChats); | ||||
| const seenLastChat = allChats[0]?.participants?.filter( | const seenLastChat = allChats[0]?.participants?.filter( | ||||
| // Handling search when user is on marketplace and when he is not | // Handling search when user is on marketplace and when he is not | ||||
| const handleSearch = (value) => { | const handleSearch = (value) => { | ||||
| if (!isLoggedIn) { | |||||
| search.searchOffersImmediately(value); | |||||
| } | |||||
| if (isAdminRoute()) { | if (isAdminRoute()) { | ||||
| search.setSearchStringManually(value); | search.setSearchStringManually(value); | ||||
| } else { | } else { |
| import { selectUserId } from "../../store/selectors/loginSelectors"; | import { selectUserId } from "../../store/selectors/loginSelectors"; | ||||
| import { toggleCreateOfferModal } from "../../store/actions/modal/modalActions"; | import { toggleCreateOfferModal } from "../../store/actions/modal/modalActions"; | ||||
| import useIsMobile from "../../hooks/useIsMobile"; | import useIsMobile from "../../hooks/useIsMobile"; | ||||
| import useIsLoggedIn from "../../hooks/useIsLoggedIn"; | |||||
| const MarketPlace = (props) => { | const MarketPlace = (props) => { | ||||
| const [isGrid, setIsGrid] = useState(false); | const [isGrid, setIsGrid] = useState(false); | ||||
| const userId = useSelector(selectUserId); | const userId = useSelector(selectUserId); | ||||
| const dispatch = useDispatch(); | const dispatch = useDispatch(); | ||||
| const { isMobile } = useIsMobile(); | const { isMobile } = useIsMobile(); | ||||
| const { isLoggedIn } = useIsLoggedIn(); | |||||
| useEffect(() => { | useEffect(() => { | ||||
| console.log("ABG", userId); | console.log("ABG", userId); | ||||
| if (userId) | if (userId) | ||||
| isUsers={props.users} | isUsers={props.users} | ||||
| users={props.allUsers} | users={props.allUsers} | ||||
| /> | /> | ||||
| {isMobile && ( | |||||
| {isMobile && isLoggedIn && ( | |||||
| <AddOfferButton onClick={addOfferHandler}> | <AddOfferButton onClick={addOfferHandler}> | ||||
| <AddPlusIcon /> | <AddPlusIcon /> | ||||
| </AddOfferButton> | </AddOfferButton> |
| "Da li želite da prihvatite trampu sa nama za gore navedeni proizvod?", | "Da li želite da prihvatite trampu sa nama za gore navedeni proizvod?", | ||||
| acceptRequest: "Prihvati", | acceptRequest: "Prihvati", | ||||
| acceptedRequest: "Prihvaćeno", | acceptedRequest: "Prihvaćeno", | ||||
| declinedRequest: "Odbijeno", | |||||
| declineRequest: "Odbij", | declineRequest: "Odbij", | ||||
| requestSuccessfulLong: "Uspešno ste ostvarili trampu sa ovom kompanijom.", | requestSuccessfulLong: "Uspešno ste ostvarili trampu sa ovom kompanijom.", | ||||
| requestSuccessfulShort: "Uspešno ste otvarili trampu.", | requestSuccessfulShort: "Uspešno ste otvarili trampu.", | ||||
| requestSentLong: "Ponudili ste trampu kompaniji. Čeka se odgovor...", | requestSentLong: "Ponudili ste trampu kompaniji. Čeka se odgovor...", | ||||
| requestSentShort: "Ponudili ste trampu kompaniji.", | requestSentShort: "Ponudili ste trampu kompaniji.", | ||||
| exchangeAlreadyFinished: "Trampa za ovaj proizvod je već završena.", | |||||
| }, | }, | ||||
| editProfile: { | editProfile: { | ||||
| website: "Web Sajt", | website: "Web Sajt", |
| resetLoginState, | resetLoginState, | ||||
| setUserJwtToken, | setUserJwtToken, | ||||
| } from "../actions/login/loginActions"; | } from "../actions/login/loginActions"; | ||||
| import { ADMIN_LOGIN_PAGE, LOGIN_PAGE } from "../../constants/pages"; | |||||
| import { ADMIN_LOGIN_PAGE, BASE_PAGE, LOGIN_PAGE } from "../../constants/pages"; | |||||
| import { addHeaderToken, removeHeaderToken } from "../../request"; | import { addHeaderToken, removeHeaderToken } from "../../request"; | ||||
| import { | import { | ||||
| JWT_REFRESH_TOKEN, | JWT_REFRESH_TOKEN, | ||||
| yield call(authScopeClearHelper); | yield call(authScopeClearHelper); | ||||
| yield call(removeHeaderToken); | yield call(removeHeaderToken); | ||||
| yield put(resetLoginState()); | yield put(resetLoginState()); | ||||
| yield call(history.replace, LOGIN_PAGE); | |||||
| yield call(history.replace, BASE_PAGE); | |||||
| yield put(clearProfile()); | yield put(clearProfile()); | ||||
| yield put(clearOffers()); | yield put(clearOffers()); | ||||
| yield put(clearChat()); | yield put(clearChat()); |
| import i18next from "i18next"; | |||||
| import * as Yup from "yup"; | import * as Yup from "yup"; | ||||
| export default Yup.object().shape({ | export default Yup.object().shape({ | ||||
| comment: Yup.string().min(5, i18next.t("reviews.commentError")), | |||||
| comment: Yup.string(), | |||||
| }); | }); |