Bladeren bron

bugfic/591

feature/595
Djordje Mitrovic 3 jaren geleden
bovenliggende
commit
c1316c9e06
35 gewijzigde bestanden met toevoegingen van 503 en 114 verwijderingen
  1. 6
    6
      src/AppRoutes.js
  2. 8
    5
      src/components/About/AboutComponent.js
  3. 6
    0
      src/components/About/AboutComponent.styled.js
  4. 1
    1
      src/components/About/CheckOffersButton/CheckOffersButton.styled.js
  5. 32
    0
      src/components/Footer/AboutFooter.js
  6. 49
    0
      src/components/Footer/AboutFooter.styled.js
  7. 68
    0
      src/components/Header/AboutHeader/AboutHeader.js
  8. 21
    0
      src/components/Header/AboutHeader/AboutHeader.styled.js
  9. 80
    66
      src/components/Header/Header.js
  10. 4
    4
      src/components/Header/Header.styled.js
  11. 0
    1
      src/components/MarketPlace/Offers/Offers.js
  12. 11
    2
      src/components/Popovers/MyProfile/AboutButton/AboutButton.js
  13. 12
    4
      src/components/Popovers/MyProfile/MyProfile.js
  14. 12
    3
      src/components/Popovers/MyProfile/PrivacyPolicyButton/PrivacyPolicyButton.js
  15. 1
    0
      src/components/Prices/Plan/Plan.styled.js
  16. 7
    4
      src/components/Prices/PricesComponent.js
  17. 4
    1
      src/components/Prices/PricesComponent.styled.js
  18. 3
    0
      src/components/Prices/PricesHeader/PricesHeader.styled.js
  19. 7
    4
      src/components/PrivacyPolicy/PrivacyPolicyComponent.js
  20. 1
    0
      src/components/UserReviews/UserReviews.styled.js
  21. 7
    0
      src/constants/scrollConstants.js
  22. 6
    0
      src/hooks/useOffers/useOffers.js
  23. 24
    0
      src/hooks/useOffers/useSearch.js
  24. 7
    0
      src/i18n/resources/rs.js
  25. 2
    1
      src/layouts/ItemDetailsLayout/ItemDetailsLayout.js
  26. 1
    1
      src/layouts/ItemDetailsLayout/ItemDetailsLayout.styled.js
  27. 2
    5
      src/layouts/ProfileLayout/ProfileLayout.js
  28. 82
    2
      src/pages/About/AboutPage.js
  29. 1
    1
      src/pages/About/AboutPage.styled.js
  30. 1
    1
      src/pages/ProfilePage/ProfilePage.js
  31. 2
    1
      src/store/actions/app/appActionConstants.js
  32. 5
    1
      src/store/actions/app/appActions.js
  33. 20
    0
      src/store/reducers/app/appReducer.js
  34. 2
    0
      src/store/reducers/index.js
  35. 8
    0
      src/store/selectors/appSelectors.js

+ 6
- 6
src/AppRoutes.js Bestand weergeven

CHAT_MESSAGE_PAGE, CHAT_MESSAGE_PAGE,
CHAT_PAGE, CHAT_PAGE,
MY_OFFERS_PAGE, MY_OFFERS_PAGE,
PRICES_PAGE,
// PRICES_PAGE,
ABOUT_PAGE, ABOUT_PAGE,
POLICY_PRIVACY_PAGE,
// POLICY_PRIVACY_PAGE,
} from "./constants/pages"; } from "./constants/pages";
import LoginPage from "./pages/LoginPage/LoginPage"; import LoginPage from "./pages/LoginPage/LoginPage";
import HomePage from "./pages/HomePage/HomePageMUI"; import HomePage from "./pages/HomePage/HomePageMUI";
import ChatMessagesPage from "./pages/ChatMessages/ChatMessages"; import ChatMessagesPage from "./pages/ChatMessages/ChatMessages";
import ChatPage from "./pages/Chat/Chat"; import ChatPage from "./pages/Chat/Chat";
import MyOffers from "./pages/MyOffers/MyOffers"; import MyOffers from "./pages/MyOffers/MyOffers";
import PricesPage from "./pages/Prices/PricesPage";
// import PricesPage from "./pages/Prices/PricesPage";
import AboutPage from "./pages/About/AboutPage"; import AboutPage from "./pages/About/AboutPage";
import PrivacyPolicyPage from "./pages/PrivacyPolicy/PrivacyPolicyPage";
// import PrivacyPolicyPage from "./pages/PrivacyPolicy/PrivacyPolicyPage";


const AppRoutes = () => { const AppRoutes = () => {
return ( return (
<Route path={CREATE_OFFER_PAGE} component={CreateOffer} /> <Route path={CREATE_OFFER_PAGE} component={CreateOffer} />
<Route path={ITEM_DETAILS_PAGE} component={ItemDetailsPage} /> <Route path={ITEM_DETAILS_PAGE} component={ItemDetailsPage} />
<Route path={PROFILE_PAGE} component={ProfilePage} /> <Route path={PROFILE_PAGE} component={ProfilePage} />
<Route path={PRICES_PAGE} component={PricesPage} />
{/* <Route path={PRICES_PAGE} component={PricesPage} /> */}
<Route path={ABOUT_PAGE} component={AboutPage} /> <Route path={ABOUT_PAGE} component={AboutPage} />
<Route path={POLICY_PRIVACY_PAGE} component={PrivacyPolicyPage} />
{/* <Route path={POLICY_PRIVACY_PAGE} component={PrivacyPolicyPage} /> */}
<Route <Route
path={HOME_PAGE} path={HOME_PAGE}
component={(props) => { component={(props) => {

+ 8
- 5
src/components/About/AboutComponent.js Bestand weergeven

import React from "react";
import React, { forwardRef } from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import AboutHeader from "./AboutHeader/AboutHeader"; import AboutHeader from "./AboutHeader/AboutHeader";
import AboutSection from "./AboutSection/AboutSection"; import AboutSection from "./AboutSection/AboutSection";
import SectionImage1 from "../../assets/images/about/about-1.png"; import SectionImage1 from "../../assets/images/about/about-1.png";
import SectionImage2 from "../../assets/images/about/about-2.png"; import SectionImage2 from "../../assets/images/about/about-2.png";
import CheckOffersButton from "./CheckOffersButton/CheckOffersButton"; import CheckOffersButton from "./CheckOffersButton/CheckOffersButton";
import { AboutComponentContainer } from "./AboutComponent.styled";


const AboutComponent = () => {
const AboutComponent = forwardRef((props, ref) => {
const { t } = useTranslation(); const { t } = useTranslation();
return ( return (
<>
<AboutComponentContainer ref={ref}>
<AboutHeader /> <AboutHeader />
<AboutSection <AboutSection
title={t("about.history.title")} title={t("about.history.title")}
reverse reverse
/> />
<CheckOffersButton /> <CheckOffersButton />
</>
</AboutComponentContainer>
); );
};
});

AboutComponent.displayName = "AboutComponent";


AboutComponent.propTypes = { AboutComponent.propTypes = {
children: PropTypes.node, children: PropTypes.node,

+ 6
- 0
src/components/About/AboutComponent.styled.js Bestand weergeven

import { Box } from "@mui/material";
import styled from "styled-components";

export const AboutComponentContainer = styled(Box)`
position: relative;
`

+ 1
- 1
src/components/About/CheckOffersButton/CheckOffersButton.styled.js Bestand weergeven



export const CheckOffersButtonContainer = styled(PrimaryButton)` export const CheckOffersButtonContainer = styled(PrimaryButton)`
position: absolute; position: absolute;
bottom: 44px;
bottom: 8px;
right: 36px; right: 36px;
width: 180px; width: 180px;
height: 49px; height: 49px;

+ 32
- 0
src/components/Footer/AboutFooter.js Bestand weergeven

import React from "react";
import PropTypes from "prop-types";
import {
AboutFooterContainer,
AboutFooterText,
Arrow,
ButtonContainer,
LinkText,
} from "./AboutFooter.styled";
import { useTranslation } from "react-i18next";

const AboutFooter = () => {
const { t } = useTranslation();
const handleGoStart = () => {
window.scrollTo({ top: 0, behavior: "smooth" });
};
return (
<AboutFooterContainer>
<AboutFooterText>{t("aboutFooter.middleText")}</AboutFooterText>
<ButtonContainer onClick={handleGoStart}>
<LinkText>{t("aboutFooter.goStart")}</LinkText>
<Arrow />
</ButtonContainer>
</AboutFooterContainer>
);
};

AboutFooter.propTypes = {
children: PropTypes.node,
};

export default AboutFooter;

+ 49
- 0
src/components/Footer/AboutFooter.styled.js Bestand weergeven

import { Box, Link, Typography } from "@mui/material";
import styled from "styled-components";
import selectedTheme from "../../themes";
import { ArrowButton } from "../Buttons/ArrowButton/ArrowButton";

export const AboutFooterContainer = styled(Box)`
height: 144px;
background-color: white;
display: flex;
flex-direction: column;
padding: 0 72px;
`;
export const AboutFooterText = styled(Typography)`
font-family: "Open Sans";
font-weight: 400;
font-size: 16px;
line-height: 22px;
color: ${selectedTheme.primaryGrayText};
width: 100%;
text-align: center;
position: relative;
top: 61px;
`;
export const ButtonContainer = styled(Link)`
width: fit-content;
cursor: pointer;
display: flex;
flex-direction: row;
justify-content: flex-end;
gap: 12px;
text-decoration: none;
color: ${selectedTheme.primaryPurple};
width: 100%;
text-align: right;
position: relative;
top: 29px;
`;
export const LinkText = styled(Typography)`
font-family: "Open Sans";
line-height: 22px;
font-size: 16px;
color: ${selectedTheme.primaryGrayText};
position: relative;
top: 8px;
`;

export const Arrow = styled(ArrowButton)`
transform: rotate(-90deg);
`;

+ 68
- 0
src/components/Header/AboutHeader/AboutHeader.js Bestand weergeven

import React from "react";
import PropTypes from "prop-types";
import { AboutHeaderContainer, LinkRoute } from "./AboutHeader.styled";
import { useTranslation } from "react-i18next";
import scrollConstants from "../../../constants/scrollConstants";
import { useSelector } from "react-redux";
import { selectAboutRouteSelected } from "../../../store/selectors/appSelectors";
import { useHistory } from "react-router-dom";

const AboutHeader = () => {
console.log("about header");
const history = useHistory();
const { t } = useTranslation();
const aboutRouteSelected = useSelector(selectAboutRouteSelected);
const navigateAbout = () => {
history.replace({
state: {
clicked: true,
navigation: scrollConstants.about.aboutPage,
},
});
};
const navigatePrices = () => {
history.replace({
state: {
clicked: true,
navigation: scrollConstants.about.pricesPage,
},
});
};
const navigatePrivacyPolicy = () => {
history.replace({
state: {
clicked: true,
navigation: scrollConstants.about.privacyPolicyPage,
},
});
};
return (
<AboutHeaderContainer>
<LinkRoute
selected={aboutRouteSelected === scrollConstants.about.aboutPage}
onClick={navigateAbout}
>
{t("about.header.navigation")}
</LinkRoute>
<LinkRoute
selected={aboutRouteSelected === scrollConstants.about.pricesPage}
onClick={navigatePrices}
>
{t("prices.header.navigation")}
</LinkRoute>
<LinkRoute
selected={aboutRouteSelected === scrollConstants.about.privacyPolicyPage}
onClick={navigatePrivacyPolicy}
>
{t("privacyPolicy.header.navigation")}
</LinkRoute>
</AboutHeaderContainer>
);
};

AboutHeader.propTypes = {
children: PropTypes.node,
selected: PropTypes.string,
};

export default AboutHeader;

+ 21
- 0
src/components/Header/AboutHeader/AboutHeader.styled.js Bestand weergeven

import { Box } from "@mui/material";
import styled from "styled-components";
import Link from "../../Link/Link";

export const AboutHeaderContainer = styled(Box)`
flex: 5;
z-index: 3000;
display: flex;
color: black;
flex-direction: row;
justify-content: center;
gap: 36px;
`;
export const LinkRoute = styled(Link)`
text-decoration: none;
font-family: "Open Sans";
font-weight: ${props => props.selected ? "600" : "400"};
font-size: 16px;
line-height: 22px;
letter-spacing: 0.02em;
`;

+ 80
- 66
src/components/Header/Header.js Bestand weergeven

import { selectProfileName } from "../../store/selectors/profileSelectors"; import { selectProfileName } from "../../store/selectors/profileSelectors";
import { useHistory, useRouteMatch } from "react-router-dom"; import { useHistory, useRouteMatch } from "react-router-dom";
import { import {
ABOUT_PAGE,
BASE_PAGE, BASE_PAGE,
FORGOT_PASSWORD_MAIL_SENT, FORGOT_PASSWORD_MAIL_SENT,
FORGOT_PASSWORD_PAGE, FORGOT_PASSWORD_PAGE,
import { Drawer as HeaderDrawer } from "./Drawer/Drawer"; import { Drawer as HeaderDrawer } from "./Drawer/Drawer";
import useSearch from "../../hooks/useOffers/useSearch"; import useSearch from "../../hooks/useOffers/useSearch";
import { routeMatches } from "../../util/helpers/routeHelpers"; import { routeMatches } from "../../util/helpers/routeHelpers";
import AboutHeader from "./AboutHeader/AboutHeader";
// import useQueryString from "../../hooks/useOffers/useQueryString"; // import useQueryString from "../../hooks/useOffers/useQueryString";


const Header = () => { const Header = () => {
}; };
}, []); }, []);
useEffect(() => { useEffect(() => {
searchRef.current.value = search.searchString ?? "";
if (searchRef.current) {
searchRef.current.value = search.searchString ?? "";
}
}, [search.searchString]); }, [search.searchString]);
useEffect(() => { useEffect(() => {
if (history.location.pathname !== "/home") { if (history.location.pathname !== "/home") {
searchRef.current.removeEventListener("keyup", listener); searchRef.current.removeEventListener("keyup", listener);
}; };
const handleSearch = (value) => { const handleSearch = (value) => {
if (
!routeMatches(HOME_PAGE) &&
!routeMatches(BASE_PAGE)
) {
if (!routeMatches(HOME_PAGE) && !routeMatches(BASE_PAGE)) {
const newQueryString = new URLSearchParams({ search: value }); const newQueryString = new URLSearchParams({ search: value });
history.push({ history.push({
pathname: HOME_PAGE, pathname: HOME_PAGE,
const closePostsPopover = () => { const closePostsPopover = () => {
setPostsPopoverOpen(false); setPostsPopoverOpen(false);
setPostsAnchorEl(null); setPostsAnchorEl(null);
}
};
const closeMsgPopover = () => { const closeMsgPopover = () => {
setMsgPopoverOpen(false); setMsgPopoverOpen(false);
setMsgAnchorEl(null); setMsgAnchorEl(null);
}
};
const closeUserPopover = () => { const closeUserPopover = () => {
setUserPopoverOpen(false); setUserPopoverOpen(false);
setUserAnchorEl(null); setUserAnchorEl(null);
}
};


return ( return (
<HeaderContainer style={{ display: shouldShow ? "block" : "none" }}> <HeaderContainer style={{ display: shouldShow ? "block" : "none" }}>
} }
/> />
)} )}
<SearchInput
fullWidth
InputProps={{
endAdornment: (
<EndIcon size="36px">
<SearchIcon
onClick={() => handleSearch(searchRef.current.value)}
/>
</EndIcon>
),
}}
placeholder={t("header.searchOffers")}
onFocus={handleFocusSearch}
onBlur={handleBlurSearch}
ref={searchRef}
/>
{!routeMatches(ABOUT_PAGE) && (
<SearchInput
fullWidth
InputProps={{
endAdornment: (
<EndIcon size="36px">
<SearchIcon
onClick={() => handleSearch(searchRef.current.value)}
/>
</EndIcon>
),
}}
placeholder={t("header.searchOffers")}
onFocus={handleFocusSearch}
onBlur={handleBlurSearch}
ref={searchRef}
/>
)}
{routeMatches(ABOUT_PAGE) && <AboutHeader />}

{user ? ( {user ? (
<ToolsButtonsContainer mobile={matches}>
<ToolsButtonsContainer
mobile={matches}
shrink={routeMatches(ABOUT_PAGE)}
>
{matches ? ( {matches ? (
<ToggleDrawerButton> <ToggleDrawerButton>
<IconButton onClick={handleToggleDrawer}> <IconButton onClick={handleToggleDrawer}>
</ToggleDrawerButton> </ToggleDrawerButton>
) : ( ) : (
<React.Fragment> <React.Fragment>
<AddOfferButton
type="submit"
variant="contained"
fullWidth
buttoncolor={selectedTheme.primaryYellow}
textcolor={selectedTheme.primaryDarkText}
onClick={() => {
setUserPopoverOpen(false);
setUserAnchorEl(null);
setShowCreateOfferModal(true);
}}
>
{t("header.addOffer")}
</AddOfferButton>
<IconButton
onClick={(e) => {
setPostsPopoverOpen(true);
setPostsAnchorEl(e.currentTarget);
}}
style={{
background: selectedTheme.primaryIconBackgroundColor,
color: selectedTheme.primaryPurple,
}}
>
<SwapsIcon />
</IconButton>
<IconButton
onClick={(e) => {
setMsgPopoverOpen(true);
setMsgAnchorEl(e.currentTarget);
}}
style={{
background: selectedTheme.primaryIconBackgroundColor,
color: selectedTheme.primaryPurple,
}}
>
<Badge badgeContent={3} color="primary">
<MailIcon />
</Badge>
</IconButton>
{!routeMatches(ABOUT_PAGE) && (
<>
<AddOfferButton
type="submit"
variant="contained"
fullWidth
buttoncolor={selectedTheme.primaryYellow}
textcolor={selectedTheme.primaryDarkText}
onClick={() => {
setUserPopoverOpen(false);
setUserAnchorEl(null);
setShowCreateOfferModal(true);
}}
>
{t("header.addOffer")}
</AddOfferButton>
<IconButton
onClick={(e) => {
setPostsPopoverOpen(true);
setPostsAnchorEl(e.currentTarget);
}}
style={{
background:
selectedTheme.primaryIconBackgroundColor,
color: selectedTheme.primaryPurple,
}}
>
<SwapsIcon />
</IconButton>
<IconButton
onClick={(e) => {
setMsgPopoverOpen(true);
setMsgAnchorEl(e.currentTarget);
}}
style={{
background:
selectedTheme.primaryIconBackgroundColor,
color: selectedTheme.primaryPurple,
}}
>
<Badge badgeContent={3} color="primary">
<MailIcon />
</Badge>
</IconButton>
</>
)}
<UserButton <UserButton
onClick={(e) => { onClick={(e) => {
setUserPopoverOpen(true); setUserPopoverOpen(true);
setMsgPopoverOpen(false); setMsgPopoverOpen(false);
setMsgAnchorEl(null); setMsgAnchorEl(null);
}} }}
content={<MyMessages closePopover={closeMsgPopover}/>}
content={<MyMessages closePopover={closeMsgPopover} />}
/> />
<PopoverComponent <PopoverComponent
anchorEl={userAnchorEl} anchorEl={userAnchorEl}

+ 4
- 4
src/components/Header/Header.styled.js Bestand weergeven

`; `;
export const ToolsButtonsContainer = styled(Box)` export const ToolsButtonsContainer = styled(Box)`
display: flex; display: flex;
flex: 4;
flex: ${props => props.shrink ? "none" : "4"};;
justify-content: space-between; justify-content: space-between;
min-width: ${(props) => (props.mobile ? "40px" : "600px")};
min-width: ${(props) => (props.mobile ? "40px" : props.shrink ? "0" : "600px")};
max-width: 600px; max-width: 600px;
align-items: center; align-items: center;
flex-wrap: nowrap; flex-wrap: nowrap;
@media (max-width: 1400px) { @media (max-width: 1400px) {
min-width: 450px;
min-width: ${props => props.shrink ? "0" : "450px"};
} }
@media (max-width: 1200px) { @media (max-width: 1200px) {
min-width: 400px;
min-width: ${props => props.shrink ? "0" : "400px"};
} }
@media (max-width: 900px) { @media (max-width: 900px) {
flex: 0.35; flex: 0.35;

+ 0
- 1
src/components/MarketPlace/Offers/Offers.js Bestand weergeven

) : ( ) : (
<OffersContainer ref={offersRef}> <OffersContainer ref={offersRef}>
{offers.allOffersToShow.map((item) => { {offers.allOffersToShow.map((item) => {
console.log(item);
return ( return (
<OfferCard <OfferCard
key={item._id} key={item._id}

+ 11
- 2
src/components/Popovers/MyProfile/AboutButton/AboutButton.js Bestand weergeven

import { PopoverButton } from "../../HeaderPopover/HeaderPopover.styled"; import { PopoverButton } from "../../HeaderPopover/HeaderPopover.styled";
import { InfoIcon } from "./AboutButton.styled"; import { InfoIcon } from "./AboutButton.styled";
import { useHistory } from "react-router-dom"; import { useHistory } from "react-router-dom";
import scrollConstants from "../../../../constants/scrollConstants";


const AboutButton = () => {
const AboutButton = (props) => {
const { t } = useTranslation(); const { t } = useTranslation();
const history = useHistory(); const history = useHistory();
const seeAbout = () => { const seeAbout = () => {
history.push(ABOUT_PAGE);
history.push({
pathname: ABOUT_PAGE,
state: {
navigation: scrollConstants.about.aboutPage,
clicked: true,
}
});
props.closePopover();
}; };
return ( return (
<GrayButton> <GrayButton>


AboutButton.propTypes = { AboutButton.propTypes = {
children: PropTypes.node, children: PropTypes.node,
closePopover: PropTypes.func,
}; };


export default AboutButton; export default AboutButton;

+ 12
- 4
src/components/Popovers/MyProfile/MyProfile.js Bestand weergeven

import { EyeIcon } from "../HeaderPopover/HeaderPopover.styled"; import { EyeIcon } from "../HeaderPopover/HeaderPopover.styled";
import { useHistory } from "react-router-dom"; import { useHistory } from "react-router-dom";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { PRICES_PAGE } from "../../../constants/pages";
import { ABOUT_PAGE } from "../../../constants/pages";
import LogoutButton from "./LogoutButton/LogoutButton"; import LogoutButton from "./LogoutButton/LogoutButton";
import AboutButton from "./AboutButton/AboutButton"; import AboutButton from "./AboutButton/AboutButton";
import PrivacyPolicyButton from "./PrivacyPolicyButton/PrivacyPolicyButton"; import PrivacyPolicyButton from "./PrivacyPolicyButton/PrivacyPolicyButton";
import scrollConstants from "../../../constants/scrollConstants";


export const MyProfile = (props) => { export const MyProfile = (props) => {
const { t } = useTranslation(); const { t } = useTranslation();
props.closePopover(); props.closePopover();
}; };
const seePrices = () => { const seePrices = () => {
history.push(PRICES_PAGE);
history.push({
pathname: ABOUT_PAGE,
state: {
clicked: true,
navigation: scrollConstants.about.pricesPage
}
});
props.closePopover();
}; };




> >
<LogoutButton /> <LogoutButton />
<GrayButtonsContainer> <GrayButtonsContainer>
<AboutButton />
<PrivacyPolicyButton />
<AboutButton closePopover={props.closePopover}/>
<PrivacyPolicyButton closePopover={props.closePopover} />
</GrayButtonsContainer> </GrayButtonsContainer>
</HeaderPopover> </HeaderPopover>
); );

+ 12
- 3
src/components/Popovers/MyProfile/PrivacyPolicyButton/PrivacyPolicyButton.js Bestand weergeven

import { GrayButton } from "../MyProfile.styled"; import { GrayButton } from "../MyProfile.styled";
import { PopoverButton } from "../../HeaderPopover/HeaderPopover.styled"; import { PopoverButton } from "../../HeaderPopover/HeaderPopover.styled";
import { BuildingShieldIcon } from "./PrivacyPolicyButton.styled"; import { BuildingShieldIcon } from "./PrivacyPolicyButton.styled";
import { POLICY_PRIVACY_PAGE } from "../../../../constants/pages";
import { ABOUT_PAGE } from "../../../../constants/pages";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useHistory } from "react-router-dom"; import { useHistory } from "react-router-dom";
import scrollConstants from "../../../../constants/scrollConstants";


const PrivacyPolicyButton = () => {
const PrivacyPolicyButton = (props) => {
const { t } = useTranslation(); const { t } = useTranslation();
const history = useHistory(); const history = useHistory();
const seePrivacy = () => { const seePrivacy = () => {
history.push(POLICY_PRIVACY_PAGE);
history.push({
pathname: ABOUT_PAGE,
state: {
clicked: true,
navigation: scrollConstants.about.privacyPolicyPage,
},
});
props.closePopover();
}; };
return ( return (
<GrayButton> <GrayButton>


PrivacyPolicyButton.propTypes = { PrivacyPolicyButton.propTypes = {
children: PropTypes.node, children: PropTypes.node,
closePopover: PropTypes.func,
}; };


export default PrivacyPolicyButton; export default PrivacyPolicyButton;

+ 1
- 0
src/components/Prices/Plan/Plan.styled.js Bestand weergeven

border-radius: 4px; border-radius: 4px;
position: relative; position: relative;
padding: 36px; padding: 36px;
min-width: 408px;
background-color: ${(props) => background-color: ${(props) =>
props.highlighted ? selectedTheme.primaryPurple : "white"}; props.highlighted ? selectedTheme.primaryPurple : "white"};



+ 7
- 4
src/components/Prices/PricesComponent.js Bestand weergeven

import React from "react";
import React, { forwardRef } from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { import {
CartIcon, CartIcon,
import Plan from "./Plan/Plan"; import Plan from "./Plan/Plan";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";


const PricesComponent = () => {
const PricesComponent = forwardRef((props, ref) => {
const { t } = useTranslation(); const { t } = useTranslation();
return ( return (
<PricesComponentContainer>
<PricesComponentContainer id={props.id} ref={ref}>
<PricesHeader /> <PricesHeader />
<PlansContainer> <PlansContainer>
<Plan <Plan
<PricesAltText>{t("prices.altText")}</PricesAltText> <PricesAltText>{t("prices.altText")}</PricesAltText>
</PricesComponentContainer> </PricesComponentContainer>
); );
};
});

PricesComponent.displayName = "PricesComponent";


PricesComponent.propTypes = { PricesComponent.propTypes = {
children: PropTypes.node, children: PropTypes.node,
id: PropTypes.string,
}; };


export default PricesComponent; export default PricesComponent;

+ 4
- 1
src/components/Prices/PricesComponent.styled.js Bestand weergeven

import selectedTheme from "../../themes"; import selectedTheme from "../../themes";


export const PricesComponentContainer = styled(Box)` export const PricesComponentContainer = styled(Box)`
margin: 72px;
padding: 72px;
background: white;
`; `;
export const PlansContainer = styled(Box)` export const PlansContainer = styled(Box)`
display: flex; display: flex;
width: 100%;
flex-direction: row; flex-direction: row;
justify-content: space-between;
gap: 50px; gap: 50px;
margin-top: 46px; margin-top: 46px;
margin-bottom: 36px; margin-bottom: 36px;

+ 3
- 0
src/components/Prices/PricesHeader/PricesHeader.styled.js Bestand weergeven

width: 100%; width: 100%;
justify-content: space-between; justify-content: space-between;
`; `;
// Below is display set to none because there is no currently function for this button,
// but it function may be added in future
export const ButtonContainer = styled(Link)` export const ButtonContainer = styled(Link)`
width: fit-content; width: fit-content;
cursor: pointer; cursor: pointer;
gap: 12px; gap: 12px;
text-decoration: none; text-decoration: none;
color: ${selectedTheme.primaryPurple}; color: ${selectedTheme.primaryPurple};
display: none;
`; `;
export const LinkText = styled(Typography)` export const LinkText = styled(Typography)`
border-bottom: 1px dotted ${selectedTheme.primaryPurple}; border-bottom: 1px dotted ${selectedTheme.primaryPurple};

+ 7
- 4
src/components/PrivacyPolicy/PrivacyPolicyComponent.js Bestand weergeven

import React from "react";
import React, { forwardRef } from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import PrivacyPolicyHeader from "./PrivacyPolicyHeader/PrivacyPolicyHeader"; import PrivacyPolicyHeader from "./PrivacyPolicyHeader/PrivacyPolicyHeader";
import { PrivacyPolicyContainer } from "./PrivacyPolicyComponent.styled"; import { PrivacyPolicyContainer } from "./PrivacyPolicyComponent.styled";
import PrivacyPolicySection from "./PrivacyPolicySection/PrivacyPolicySection"; import PrivacyPolicySection from "./PrivacyPolicySection/PrivacyPolicySection";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";


const PrivacyPolicyComponent = () => {
const PrivacyPolicyComponent = forwardRef((props, ref) => {
const { t } = useTranslation(); const { t } = useTranslation();
return ( return (
<PrivacyPolicyContainer>
<PrivacyPolicyContainer id={props.id} ref={ref}>
<PrivacyPolicyHeader /> <PrivacyPolicyHeader />
<PrivacyPolicySection <PrivacyPolicySection
title={t("privacyPolicy.firstSection.title")} title={t("privacyPolicy.firstSection.title")}
/> />
</PrivacyPolicyContainer> </PrivacyPolicyContainer>
); );
};
});

PrivacyPolicyComponent.displayName = "PrivacyPolicyComponent";


PrivacyPolicyComponent.propTypes = { PrivacyPolicyComponent.propTypes = {
children: PropTypes.node, children: PropTypes.node,
id: PropTypes.string,
}; };


export default PrivacyPolicyComponent; export default PrivacyPolicyComponent;

+ 1
- 0
src/components/UserReviews/UserReviews.styled.js Bestand weergeven

? props.numOfReviews * 185 + 82 + "px" ? props.numOfReviews * 185 + 82 + "px"
: `calc(100% - 90px)`}; */ : `calc(100% - 90px)`}; */
/* max-height: 100vh; */ /* max-height: 100vh; */
min-width: 320px;
@media (max-width: 1200px) { @media (max-width: 1200px) {
padding: 0 50px; padding: 0 50px;
} }

+ 7
- 0
src/constants/scrollConstants.js Bestand weergeven

export default {
about: {
aboutPage: "about",
pricesPage: "prices",
privacyPolicyPage: "privacyPolicy"
}
}

+ 6
- 0
src/hooks/useOffers/useOffers.js Bestand weergeven

if (queryObject[KEY_PAGE] !== 1) if (queryObject[KEY_PAGE] !== 1)
paging.changePage(queryObject[KEY_PAGE]); paging.changePage(queryObject[KEY_PAGE]);
} }
if (KEY_SEARCH in queryObject) {
search.searchOffers(queryObject[KEY_SEARCH]);
} else {
search.clear();
}
dispatch(setSearchString(queryObject[KEY_SEARCH])); dispatch(setSearchString(queryObject[KEY_SEARCH]));
} }
}, [queryStringHook.isInitiallyLoaded]); }, [queryStringHook.isInitiallyLoaded]);
filters.clear(); filters.clear();
sorting.clear(); sorting.clear();
paging.changePage(1); paging.changePage(1);
search.clear();
}; };


return { return {

+ 24
- 0
src/hooks/useOffers/useSearch.js Bestand weergeven

import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
import { useHistory } from "react-router-dom";
import { BASE_PAGE, HOME_PAGE } from "../../constants/pages";
import { KEY_SEARCH } from "../../constants/queryStringConstants";
import { setSearchString } from "../../store/actions/filters/filtersActions"; import { setSearchString } from "../../store/actions/filters/filtersActions";
import { selectSearchString } from "../../store/selectors/filtersSelectors"; import { selectSearchString } from "../../store/selectors/filtersSelectors";
import { routeMatches } from "../../util/helpers/routeHelpers";


const useSearch = (applyAllFilters) => { const useSearch = (applyAllFilters) => {
const [searchStringLocally, setSearchStringLocally] = useState(""); const [searchStringLocally, setSearchStringLocally] = useState("");
const [isInitallyLoaded, setIsInitiallyLoaded] = useState(false); const [isInitallyLoaded, setIsInitiallyLoaded] = useState(false);
const dispatch = useDispatch(); const dispatch = useDispatch();
const searchString = useSelector(selectSearchString); const searchString = useSelector(selectSearchString);
const history = useHistory();


// On every global change of search string, new request to backend should be sent // On every global change of search string, new request to backend should be sent
useEffect(() => { useEffect(() => {
} }
}, [searchString]); }, [searchString]);


// Empty search string when user navigates to other page
useEffect(() => {
if (
(!routeMatches(HOME_PAGE) || !routeMatches(BASE_PAGE)) &&
isInitallyLoaded
) {
clear();
}
const queryObject = new URLSearchParams(history.location.search);
console.log(queryObject.toString())
if (queryObject.has(KEY_SEARCH)) {
searchOffers(queryObject.get(KEY_SEARCH));
} else {
clear();
}
}, [history.location.pathname]);

// On every local change of search string, global state of search string should be also updated // On every local change of search string, global state of search string should be also updated
useEffect(() => { useEffect(() => {
console.log('ovde')
if (isInitallyLoaded && applyAllFilters) { if (isInitallyLoaded && applyAllFilters) {
dispatch(setSearchString(searchStringLocally)); dispatch(setSearchString(searchStringLocally));
} }
}; };


const clear = () => { const clear = () => {
console.log('ovde2')
setSearchStringLocally(""); setSearchStringLocally("");
}; };



+ 7
- 0
src/i18n/resources/rs.js Bestand weergeven

about: { about: {
header: { header: {
title: "O Trampi", title: "O Trampi",
navigation: 'O nama',
paragraph: paragraph:
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ac augue tortor. Nulla facilisi. Cras vestibulum risus eget tincidunt egestas. Duis blandit enim sit amet dui vehicula luctus. Suspendisse id blandit arcu, vitae consequat nisi. Duis ut vestibulum tellus. Curabitur eu fringilla nisi.", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ac augue tortor. Nulla facilisi. Cras vestibulum risus eget tincidunt egestas. Duis blandit enim sit amet dui vehicula luctus. Suspendisse id blandit arcu, vitae consequat nisi. Duis ut vestibulum tellus. Curabitur eu fringilla nisi.",
}, },
privacyPolicy: { privacyPolicy: {
header: { header: {
title: "Politika Privatnosti", title: "Politika Privatnosti",
navigation: "Uslovi korišćenja",
paragraph: paragraph:
"Aenean ut risus faucibus, tempor urna id, luctus urna. Nam placerat scelerisque hendrerit. Nam tortor augue, porta sed nulla vitae, rutrum rhoncus arcu. Ut in leo turpis. Pellentesque eu laoreet orci. Nam id nisi mauris.", "Aenean ut risus faucibus, tempor urna id, luctus urna. Nam placerat scelerisque hendrerit. Nam tortor augue, porta sed nulla vitae, rutrum rhoncus arcu. Ut in leo turpis. Pellentesque eu laoreet orci. Nam id nisi mauris.",
}, },
prices: { prices: {
header: { header: {
title: "Cenovnik", title: "Cenovnik",
navigation: 'Cenovnik',
link: "Pročitajte opširnije o našim ponudama", link: "Pročitajte opširnije o našim ponudama",
}, },
altText: altText:
fifthQuantity: "", fifthQuantity: "",
}, },
}, },
aboutFooter: {
goStart: "Početak stranice",
middleText: "Diligent Software © 2022 | Sva prava zadržana"
}
}; };

+ 2
- 1
src/layouts/ItemDetailsLayout/ItemDetailsLayout.js Bestand weergeven

{props.children} {props.children}
<ContentRightCardContainer> <ContentRightCardContainer>
<Content item>{props.content}</Content> <Content item>{props.content}</Content>
<RightCard item singleOffer={props.singleOffer}>
<RightCard item singleOffer={props.singleOffer} profile={props.profile}>
{props.rightCard} {props.rightCard}
</RightCard> </RightCard>
</ContentRightCardContainer> </ContentRightCardContainer>
content: PropTypes.node, content: PropTypes.node,
rightCard: PropTypes.node, rightCard: PropTypes.node,
singleOffer: PropTypes.bool, singleOffer: PropTypes.bool,
profile: PropTypes.bool,
}; };


export default ItemDetailsLayout; export default ItemDetailsLayout;

+ 1
- 1
src/layouts/ItemDetailsLayout/ItemDetailsLayout.styled.js Bestand weergeven



@media screen and (min-width: 600px) { @media screen and (min-width: 600px) {
margin-top: 34px; margin-top: 34px;
margin-left: 36px;
margin-left: ${props => props.profile ? "0" : "36px"};
padding-left: ${(props) => (props.singleOffer ? "36px" : 0)}; padding-left: ${(props) => (props.singleOffer ? "36px" : 0)};
border-top-right-radius: 4px; border-top-right-radius: 4px;
${(props) => props.singleOffer && `width: 100%`} ${(props) => props.singleOffer && `width: 100%`}

+ 2
- 5
src/layouts/ProfileLayout/ProfileLayout.js Bestand weergeven

import React from "react"; import React from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { Content, LeftCard, RightCard, ProfileLayoutContainer, HeaderCard, MiddleCard } from "./ProfileLayout.styled";
import { Content, RightCard, ProfileLayoutContainer, HeaderCard, MiddleCard } from "./ProfileLayout.styled";
import { Grid } from "@mui/material"; import { Grid } from "@mui/material";


const ProfileLayout = (props) => { const ProfileLayout = (props) => {
<ProfileLayoutContainer> <ProfileLayoutContainer>
{props.children} {props.children}
<Grid container maxHeight maxWidth={1900}> <Grid container maxHeight maxWidth={1900}>
<LeftCard item xs={2} lg={2.5} xl={2.4} md={3}>
{props.leftCard}
</LeftCard>
<MiddleCard item xs={7.5} lg={6.5} xl={6.6} md={6}>
<MiddleCard item xs={9.5} lg={6.5} xl={6.6} md={6}>
<HeaderCard> <HeaderCard>
{props.headerCard} {props.headerCard}
</HeaderCard> </HeaderCard>

+ 82
- 2
src/pages/About/AboutPage.js Bestand weergeven

import React from "react";
import React, { useEffect, useRef } from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import AboutComponent from "../../components/About/AboutComponent"; import AboutComponent from "../../components/About/AboutComponent";
import { AboutPageContainer } from "./AboutPage.styled"; import { AboutPageContainer } from "./AboutPage.styled";
// import PricesComponent from "../../components/Prices/PricesComponent";
import PrivacyPolicyComponent from "../../components/PrivacyPolicy/PrivacyPolicyComponent";
import PricesComponent from "../../components/Prices/PricesComponent";
import { useLocation } from "react-router-dom";
import scrollConstants from "../../constants/scrollConstants";
import { useDispatch, useSelector } from "react-redux";
import { selectAboutRouteSelected } from "../../store/selectors/appSelectors";
import { setAboutRouteSelected } from "../../store/actions/app/appActions";
import AboutFooter from "../../components/Footer/AboutFooter";


const AboutPage = () => { const AboutPage = () => {
const aboutRef = useRef(null);
const pricesRef = useRef(null);
const privacyPolicyRef = useRef(null);
const dispatch = useDispatch();
const aboutRouteSelected = useSelector(selectAboutRouteSelected);
const location = useLocation();
useEffect(() => {
if (location.state && location.state?.clicked) {
if (location.state.navigation === scrollConstants.about.aboutPage) {
window.scrollTo({ top: 0, behavior: "smooth" });
if (aboutRouteSelected !== scrollConstants.about.aboutPage) {
dispatch(setAboutRouteSelected(scrollConstants.about.aboutPage));
}
}
if (location.state.navigation === scrollConstants.about.pricesPage) {
const yAxis = pricesRef.current.offsetTop;
window.scrollTo({ top: yAxis, behavior: "smooth" });
if (aboutRouteSelected !== scrollConstants.about.pricesPage) {
dispatch(setAboutRouteSelected(scrollConstants.about.pricesPage));
}
}
if (
location.state.navigation === scrollConstants.about.privacyPolicyPage
) {
const yAxis = privacyPolicyRef.current.offsetTop - 64;
window.scrollTo({ top: yAxis, behavior: "smooth" });
if (aboutRouteSelected !== scrollConstants.about.privacyPolicyPage) {
dispatch(setAboutRouteSelected(scrollConstants.about.privacyPolicyPage));
}
}
location.state = {};
}
return () => {
console.log(location);
};
}, [location]);

useEffect(() => {
const listener = () => {
if (
window.scrollY >
pricesRef.current.offsetTop - window.innerHeight / 2
) {
console.log(true);
if (
window.scrollY >
privacyPolicyRef.current.offsetTop - window.innerHeight / 2
) {
if (aboutRouteSelected !== scrollConstants.about.privacyPolicyPage) {
dispatch(
setAboutRouteSelected(scrollConstants.about.privacyPolicyPage)
);
}
} else if (aboutRouteSelected !== scrollConstants.about.pricesPage) {
dispatch(setAboutRouteSelected(scrollConstants.about.pricesPage));
}
} else {
if (aboutRouteSelected !== scrollConstants.about.aboutPage) {
dispatch(setAboutRouteSelected(scrollConstants.about.aboutPage));
}
}
};
window.addEventListener("scroll", listener);
return () => window.removeEventListener("scroll", listener);
}, [aboutRouteSelected]);
return ( return (
<AboutPageContainer> <AboutPageContainer>
<AboutComponent />
<AboutComponent ref={aboutRef} id={scrollConstants.about.aboutPage} />
<PricesComponent ref={pricesRef} id={scrollConstants.about.pricesPage} />
<PrivacyPolicyComponent
ref={privacyPolicyRef}
id={scrollConstants.about.privacyPolicyPage}
/>
<AboutFooter />
</AboutPageContainer> </AboutPageContainer>
); );
}; };

+ 1
- 1
src/pages/About/AboutPage.styled.js Bestand weergeven

import selectedTheme from "../../themes"; import selectedTheme from "../../themes";


export const AboutPageContainer = styled(Box)` export const AboutPageContainer = styled(Box)`
margin-top: 80px;
margin-top: 64px;
background-color: ${selectedTheme.staticBackgroundColor}; background-color: ${selectedTheme.staticBackgroundColor};
position: relative; position: relative;
@media (max-width: 600px) { @media (max-width: 600px) {

+ 1
- 1
src/pages/ProfilePage/ProfilePage.js Bestand weergeven

const ProfilePage = () => { const ProfilePage = () => {
return ( return (
<ProfilePageContainer> <ProfilePageContainer>
<ItemDetailsLayout content={<Profile/>} rightCard={<UserReviews isProfileReviews/>} />
<ItemDetailsLayout content={<Profile/>} rightCard={<UserReviews isProfileReviews/>} profile />
</ProfilePageContainer> </ProfilePageContainer>
); );
}; };

+ 2
- 1
src/store/actions/app/appActionConstants.js Bestand weergeven

import { createLoadingType } from '../actionHelpers';
import { createLoadingType, createSetType } from '../actionHelpers';


export const APP_LOADING = createLoadingType('APP_LOADING'); export const APP_LOADING = createLoadingType('APP_LOADING');
export const ADD_LOADER = createLoadingType("ADD_LOADER"); export const ADD_LOADER = createLoadingType("ADD_LOADER");
export const REMOVE_LOADER = createLoadingType("REMOVE_LOADER"); export const REMOVE_LOADER = createLoadingType("REMOVE_LOADER");
export const ABOUT_ROUTE_SELECTED = createSetType("ABOUT_ROUTE_SELECTED");

+ 5
- 1
src/store/actions/app/appActions.js Bestand weergeven

import { ADD_LOADER, REMOVE_LOADER } from "./appActionConstants";
import { ABOUT_ROUTE_SELECTED, ADD_LOADER, REMOVE_LOADER } from "./appActionConstants";


export const addLoader = (payload) => ({ export const addLoader = (payload) => ({
type: ADD_LOADER, type: ADD_LOADER,
type: REMOVE_LOADER, type: REMOVE_LOADER,
payload payload
}) })
export const setAboutRouteSelected = (payload) => ({
type: ABOUT_ROUTE_SELECTED,
payload
})

+ 20
- 0
src/store/reducers/app/appReducer.js Bestand weergeven

import scrollConstants from "../../../constants/scrollConstants";
import { ABOUT_ROUTE_SELECTED } from "../../actions/app/appActionConstants";
import createReducer from "../../utils/createReducer";

const initialState = {
aboutRouteSelected: scrollConstants.about.aboutPage,
};

export default createReducer(
{
[ABOUT_ROUTE_SELECTED]: setAboutRouteSelected,
},
initialState
);
function setAboutRouteSelected(state, { payload }) {
return {
...state,
aboutRouteSelected: payload,
};
}

+ 2
- 0
src/store/reducers/index.js Bestand weergeven

import queryStringReducer from "./queryString/queryStringReducer"; import queryStringReducer from "./queryString/queryStringReducer";
import exchangeReducer from "./exchange/exchangeReducer"; import exchangeReducer from "./exchange/exchangeReducer";
import reviewReducer from "./review/reviewReducer"; import reviewReducer from "./review/reviewReducer";
import appReducer from "./app/appReducer";


const loginPersistConfig = { const loginPersistConfig = {
key: "login", key: "login",
queryString: queryStringReducer, queryString: queryStringReducer,
exchange: exchangeReducer, exchange: exchangeReducer,
review: reviewReducer, review: reviewReducer,
app: appReducer,
}); });

+ 8
- 0
src/store/selectors/appSelectors.js Bestand weergeven

import { createSelector } from "reselect";

const appSelector = (state) => state.app;

export const selectAboutRouteSelected = createSelector(
appSelector,
(state) => state.aboutRouteSelected
)

Laden…
Annuleren
Opslaan