Pārlūkot izejas kodu

Finished feature

feature/1608
djordjemitrovic00 pirms 3 gadiem
vecāks
revīzija
e2a6f8c630
42 mainītis faili ar 429 papildinājumiem un 330 dzēšanām
  1. 27
    0
      src/components/Admin/Sidebar/LogoutButton/LogoutButton.js
  2. 28
    0
      src/components/Admin/Sidebar/LogoutButton/LogoutButton.styled.js
  3. 30
    0
      src/components/Admin/Sidebar/MarketplaceButton/MarketplaceButton.js
  4. 36
    0
      src/components/Admin/Sidebar/MarketplaceButton/MarketplaceButton.styled.js
  5. 10
    92
      src/components/Admin/Sidebar/Sidebar.js
  6. 1
    156
      src/components/Admin/Sidebar/Sidebar.styled.js
  7. 25
    0
      src/components/Admin/Sidebar/SidebarHeader/SidebarHeader.js
  8. 13
    0
      src/components/Admin/Sidebar/SidebarHeader/SidebarHeader.styled.js
  9. 55
    0
      src/components/Admin/Sidebar/SidebarNavigation/SidebarNavigation.js
  10. 67
    0
      src/components/Admin/Sidebar/SidebarNavigation/SidebarNavigation.styled.js
  11. 40
    0
      src/components/Admin/Sidebar/SidebarProfile/SidebarProfile.js
  12. 30
    0
      src/components/Admin/Sidebar/SidebarProfile/SidebarProfile.styled.js
  13. 1
    1
      src/components/Cards/CreateOfferCard/CreateOffer.js
  14. 3
    3
      src/components/Cards/ItemDetailsCard/ItemDetailsCard.js
  15. 0
    0
      src/components/Cards/ItemDetailsCard/OfferInformations/OfferInformations.js
  16. 0
    0
      src/components/Cards/ItemDetailsCard/OfferInformations/OfferInformations.styled.js
  17. 5
    8
      src/components/Cards/ItemDetailsCard/OfferInformations/SingleInformation/SingleInformation.js
  18. 3
    1
      src/components/Cards/ItemDetailsCard/OfferInformations/SingleInformation/SingleInformation.styled.js
  19. 1
    1
      src/components/Cards/MiniChatCard/MiniChatCard.js
  20. 1
    1
      src/components/Cards/OfferCard/CheckButton/CheckButton.js
  21. 2
    2
      src/components/Cards/OfferCard/OfferCard.js
  22. 1
    1
      src/components/Cards/ProfileCard/BigProfileCard/BigProfileCard.js
  23. 10
    10
      src/components/Cards/ProfileCard/ProfileCard.js
  24. 1
    1
      src/components/Cards/ProfileCard/ProfileMainInfo/ProfileMainInfo.js
  25. 0
    1
      src/components/Cards/RequestExchangeCard/RequestExchangeMessage/RequestExchangeMessage.js
  26. 1
    1
      src/components/Cards/UserReviewsCard/UserReviewsSingleCard/ReviewerProfile/ReviewerProfile.js
  27. 0
    1
      src/components/Cards/UserReviewsCard/UserReviewsSingleCard/UserReviewsSingleCard.js
  28. 6
    5
      src/components/DirectChat/DirectChat.js
  29. 1
    1
      src/components/DirectChat/DirectChatContent/DirectChatContentHeader/DirectChatContentHeader.js
  30. 1
    1
      src/components/ItemDetails/ItemDetailsHeaderCard/ItemDetailsHeaderCard.js
  31. 0
    1
      src/components/Modals/EditCategory/EditCategory.js
  32. 6
    6
      src/components/Profile/Profile.js
  33. 0
    2
      src/components/TextFields/AutoSuggestTextField/AutoSuggestTextField.js
  34. 3
    4
      src/components/UserReviews/UserReviews.js
  35. 2
    2
      src/pages/AdminHomePage/AdminItemDetailsPage/AdminItemDetailsPage.js
  36. 2
    2
      src/pages/ItemDetailsPage/ItemDetailsPageMUI.js
  37. 1
    1
      src/pages/MessagesListPage/MessagesListPage.js
  38. 0
    4
      src/pages/RegisterPages/Register/FirstPart/FirstPartOfRegistration.js
  39. 0
    1
      src/store/saga/adminSaga.js
  40. 0
    1
      src/store/saga/chatSaga.js
  41. 1
    1
      src/store/saga/locationsSaga.js
  42. 15
    18
      src/util/helpers/messageHelper.js

+ 27
- 0
src/components/Admin/Sidebar/LogoutButton/LogoutButton.js Parādīt failu

import React from "react";
import PropTypes from "prop-types";
import { LogoutButtonContainer, LogoutIcon } from "./LogoutButton.styled";
import { useTranslation } from "react-i18next";
import { useDispatch } from "react-redux";
import { logoutAdmin } from "../../../../store/actions/login/loginActions";

const LogoutButton = () => {
const { t } = useTranslation();
const dispatch = useDispatch();

const logoutHandler = () => {
dispatch(logoutAdmin());
};

return (
<LogoutButtonContainer onClick={logoutHandler}>
<LogoutIcon /> {t("admin.navigation.logout")}
</LogoutButtonContainer>
);
};

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

export default LogoutButton;

+ 28
- 0
src/components/Admin/Sidebar/LogoutButton/LogoutButton.styled.js Parādīt failu

import { Box } from "@mui/material";
import styled from "styled-components";
import { ReactComponent as Logout } from "../../../../assets/images/svg/log-out.svg";
import selectedTheme from "../../../../themes";

export const LogoutButtonContainer = styled(Box)`
font-family: "DM Sans";
font-size: 16px;
padding-top: 1.7vh;
padding-bottom: 1.7vh;
padding-left: 18px;
margin-bottom: 18px;
margin-left: 18px;
border-radius: 4px;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
color: ${selectedTheme.colors.primaryPurple};
cursor: pointer;

&:hover {
background-color: #f5edff;
font-weight: 700;
}
`;
export const LogoutIcon = styled(Logout)`
position: relative;
top: 3px;
`;

+ 30
- 0
src/components/Admin/Sidebar/MarketplaceButton/MarketplaceButton.js Parādīt failu

import React from "react";
import PropTypes from "prop-types";
import { HOME_PAGE } from "../../../../constants/pages";
import {
ArrowUpRightIcon,
MarketplaceButtonContainer,
MarketplaceIcon,
} from "./MarketplaceButton.styled";
import { useTranslation } from "react-i18next";

const MarketplaceButton = () => {
const { t } = useTranslation();
const handleButtonClick = () => {
history.push({
pathname: HOME_PAGE,
});
};
return (
<MarketplaceButtonContainer onClick={handleButtonClick}>
<MarketplaceIcon /> {t("admin.navigation.marketplace")}
<ArrowUpRightIcon />
</MarketplaceButtonContainer>
);
};

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

export default MarketplaceButton;

+ 36
- 0
src/components/Admin/Sidebar/MarketplaceButton/MarketplaceButton.styled.js Parādīt failu

import { Box } from "@mui/material";
import styled from "styled-components";
import { ReactComponent as ArrowUpRight } from "../../../../assets/images/svg/arrow-up-right-from-square.svg";
import { ReactComponent as Marketplace } from "../../../../assets/images/svg/package.svg";
import selectedTheme from "../../../../themes";

export const MarketplaceButtonContainer = styled(Box)`
font-family: "DM Sans";
font-size: 16px;
padding-top: 1.7vh;
padding-bottom: 1.7vh;
padding-left: 18px;
margin-top: 8vh;
margin-left: 18px;
border-radius: 4px;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
color: ${selectedTheme.colors.primaryPurple};
cursor: pointer;

&:hover {
background-color: #f5edff;
font-weight: 700;
}
`;

export const MarketplaceIcon = styled(Marketplace)`
position: relative;
top: 3px;
width: 18px;
height: 18px;
`;
export const ArrowUpRightIcon = styled(ArrowUpRight)`
position: relative;
left: 4px;
`;

+ 10
- 92
src/components/Admin/Sidebar/Sidebar.js Parādīt failu

import { import {
SidebarContainer, SidebarContainer,
SidebarContent, SidebarContent,
SidebarHeader,
SidebarProfileImageContainer,
SidebarProfileImage,
SidebarProfileName,
SidebarNavigation,
SidebarNavigationMeni,
SidebarNavigationMeniItemUl,
SidebarNavigationMeniItem,
SidebarNavigationMeniItemIcon,
SidebarProfileRole,
SidebarNavigationMeniLogout,
LogoutIcon,
SidebarNavigationMeniMarketplace,
MarketplaceIcon,
ButtonsContainer, ButtonsContainer,
ArrowUpRightIcon,
} from "./Sidebar.styled"; } from "./Sidebar.styled";
import { ReactComponent as LogoHorizontal } from "../../../assets/images/svg/logo-horizontal.svg";
import { useHistory } from "react-router-dom";
import { useSelector } from "react-redux";
import { selectMineProfile } from "../../../store/selectors/profileSelectors";
import { getImageUrl, variants } from "../../../util/helpers/imageUrlGetter";
import useIsMobile from "../../../hooks/useIsMobile";
import { ADMIN_NAVIGATION } from "../../../constants/adminNavigation";
import { useTranslation } from "react-i18next";
import { useDispatch } from "react-redux";
import { logoutAdmin } from "../../../store/actions/login/loginActions";
import { isInRoute, routeMatches } from "../../../util/helpers/routeHelpers";
import {
ADMIN_HOME_PAGE,
ADMIN_USERS_PAGE,
HOME_PAGE,
} from "../../../constants/pages";
import SidebarHeader from "./SidebarHeader/SidebarHeader";
import SidebarProfile from "./SidebarProfile/SidebarProfile";
import SidebarNavigation from "./SidebarNavigation/SidebarNavigation";
import MarketplaceButton from "./MarketplaceButton/MarketplaceButton";
import LogoutButton from "./LogoutButton/LogoutButton";


const Sidebar = () => { const Sidebar = () => {
const history = useHistory();
const profile = useSelector(selectMineProfile);
const dispatch = useDispatch();
const { isMobile } = useIsMobile();
const { t } = useTranslation();
const routeToItem = (route) => {
history.push(route);
};
const marketplaceHandler = () => {
history.push({
pathname: HOME_PAGE,
});
};
const logoutHandler = () => {
dispatch(logoutAdmin());
};

return ( return (
<SidebarContainer> <SidebarContainer>
<SidebarHeader>
<LogoHorizontal />
</SidebarHeader>
<SidebarHeader />
<SidebarContent> <SidebarContent>
<SidebarProfileImageContainer>
<SidebarProfileImage
src={getImageUrl(profile.image, variants.profileImage, isMobile)}
/>
<SidebarProfileName>{profile.company.name}</SidebarProfileName>
<SidebarProfileRole>{t("admin.navigation.role")}</SidebarProfileRole>
</SidebarProfileImageContainer>
<SidebarNavigation>
<SidebarNavigationMeni>
{t("admin.navigation.menu")}
</SidebarNavigationMeni>
<SidebarNavigationMeniItemUl>
{ADMIN_NAVIGATION.map((value) => {
let isRouteActive = isInRoute(value.route);
if (
routeMatches(ADMIN_HOME_PAGE) &&
routeMatches(ADMIN_USERS_PAGE, value.route)
)
isRouteActive = true;
return (
<SidebarNavigationMeniItem
active={isRouteActive}
key={value.text}
onClick={() => routeToItem(value.route)}
>
<SidebarNavigationMeniItemIcon active={isRouteActive}>
{value.icon}
</SidebarNavigationMeniItemIcon>
{value.text}
</SidebarNavigationMeniItem>
);
})}
</SidebarNavigationMeniItemUl>
</SidebarNavigation>
<SidebarProfile />
<SidebarNavigation />
<ButtonsContainer> <ButtonsContainer>
<SidebarNavigationMeniMarketplace onClick={marketplaceHandler}>
<MarketplaceIcon /> {t("admin.navigation.marketplace")}
<ArrowUpRightIcon />
</SidebarNavigationMeniMarketplace>
<SidebarNavigationMeniLogout onClick={logoutHandler}>
<LogoutIcon /> {t("admin.navigation.logout")}
</SidebarNavigationMeniLogout>
<MarketplaceButton />
<LogoutButton />
</ButtonsContainer> </ButtonsContainer>
</SidebarContent> </SidebarContent>
</SidebarContainer> </SidebarContainer>

+ 1
- 156
src/components/Admin/Sidebar/Sidebar.styled.js Parādīt failu

import styled from "styled-components"; import styled from "styled-components";
import { Box, Typography } from "@mui/material";
import { ReactComponent as Marketplace } from "../../../assets/images/svg/package.svg";
import { ReactComponent as Logout } from "../../../assets/images/svg/log-out.svg";
import { ReactComponent as ArrowUpRight } from "../../../assets/images/svg/arrow-up-right-from-square.svg";
import selectedTheme from "../../../themes";
import { Box } from "@mui/material";


export const SidebarContainer = styled(Box)` export const SidebarContainer = styled(Box)`
margin-top: -30px; margin-top: -30px;
} }
`; `;


export const SidebarHeader = styled(Box)`
background-color: #f5edff;
padding-top: 3.3vh;
padding-left: 36px;
padding-bottom: 3.3vh;
`;

export const SidebarContent = styled(Box)` export const SidebarContent = styled(Box)`
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
`; `;


export const SidebarProfileImageContainer = styled(Box)`
display: flex;
flex-direction: column;
align-items: center;
padding: 0;
`;

export const SidebarProfileImage = styled.img`
width: 108px;
height: 108px;
border-radius: 100%;
`;

export const SidebarProfileName = styled(Typography)`
font-family: "DM Sans";
font-size: 16px;
font-weight: 700;
margin-top: 19px;
color: ${selectedTheme.colors.primaryPurple};
`;

export const SidebarProfileRole = styled(Typography)`
font-family: "DM Sans";
font-size: 12px;
color: ${selectedTheme.colors.primaryPurple};
`;

export const SidebarNavigation = styled(Box)`
margin-left: 18px;
display: flex;
flex-direction: column;
/* flex: 1; */
`;

export const SidebarNavigationMeni = styled(Typography)`
font-family: "DM Sans";
font-size: 24px;
font-weight: 700;
margin-bottom: 4vh;
margin-left: 18px;
`;

export const SidebarNavigationMeniItemUl = styled.ul``;
export const SidebarNavigationMeniItem = styled.li`
padding-top: 1.7vh;
padding-bottom: 1.7vh;
padding-left: 18px;
font-family: "DM Sans";
font-size: 16px;
font-weight: 400;
display: flex;
border-radius: 4px;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
align-items: center;
color: ${selectedTheme.colors.primaryPurple};
cursor: pointer;
${(props) =>
props.active &&
`
background-color: #f5edff;
font-weight: 700;
`}
path {
stroke: #c4c4c4;
}

&:hover {
background-color: #f5edff;
font-weight: 700;

path {
stroke: #feb005;
}
}
`;

export const SidebarNavigationMeniItemIcon = styled(Box)`
margin-right: 9px;
position: relative;
top: 2px;

${(props) =>
props.active &&
`
path {
stroke: #feb005;
}
`}
`;

export const ButtonsContainer = styled(Box)``; export const ButtonsContainer = styled(Box)``;

export const SidebarNavigationMeniMarketplace = styled(Box)`
font-family: "DM Sans";
font-size: 16px;
padding-top: 1.7vh;
padding-bottom: 1.7vh;
padding-left: 18px;
margin-top: 8vh;
margin-left: 18px;
border-radius: 4px;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
color: ${selectedTheme.colors.primaryPurple};
cursor: pointer;

&:hover {
background-color: #f5edff;
font-weight: 700;
}
`;

export const MarketplaceIcon = styled(Marketplace)`
position: relative;
top: 5px;
`;

export const SidebarNavigationMeniLogout = styled(Box)`
font-family: "DM Sans";
font-size: 16px;
padding-top: 1.7vh;
padding-bottom: 1.7vh;
padding-left: 18px;
margin-bottom: 18px;
margin-left: 18px;
border-radius: 4px;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
color: ${selectedTheme.colors.primaryPurple};
cursor: pointer;

&:hover {
background-color: #f5edff;
font-weight: 700;
}
`;
export const LogoutIcon = styled(Logout)`
position: relative;
top: 3px;
`;

export const ArrowUpRightIcon = styled(ArrowUpRight)`
margin-left: 4px;
`;

+ 25
- 0
src/components/Admin/Sidebar/SidebarHeader/SidebarHeader.js Parādīt failu

import React from "react";
import PropTypes from "prop-types";
import {
LogoHorizontalIcon,
SidebarHeaderContainer,
} from "./SidebarHeader.styled";
import history from "../../../../store/utils/history";
import { ADMIN_HOME_PAGE } from "../../../../constants/pages";

const SidebarHeader = () => {
const handleLogoClick = () => {
history.push(ADMIN_HOME_PAGE);
};
return (
<SidebarHeaderContainer>
<LogoHorizontalIcon onClick={handleLogoClick} />
</SidebarHeaderContainer>
);
};

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

export default SidebarHeader;

+ 13
- 0
src/components/Admin/Sidebar/SidebarHeader/SidebarHeader.styled.js Parādīt failu

import { Box } from "@mui/material";
import { ReactComponent as LogoHorizontal } from "../../../../assets/images/svg/logo-horizontal.svg";
import styled from "styled-components";

export const SidebarHeaderContainer = styled(Box)`
background-color: #f5edff;
padding-top: 3.3vh;
padding-left: 36px;
padding-bottom: 3.3vh;
`;
export const LogoHorizontalIcon = styled(LogoHorizontal)`
cursor: pointer;
`;

+ 55
- 0
src/components/Admin/Sidebar/SidebarNavigation/SidebarNavigation.js Parādīt failu

import React from "react";
import PropTypes from "prop-types";
import {
SidebarNavigationContainer,
SidebarNavigationItem,
SidebarNavigationItemIcon,
SidebarNavigationListContainer,
SidebarNavigationTitle,
} from "./SidebarNavigation.styled";
import { useTranslation } from "react-i18next";
import { isInRoute, routeMatches } from "../../../../util/helpers/routeHelpers";
import { ADMIN_HOME_PAGE, ADMIN_USERS_PAGE } from "../../../../constants/pages";
import { ADMIN_NAVIGATION } from "../../../../constants/adminNavigation";

const SidebarNavigation = () => {
const { t } = useTranslation();
const goToRoute = (route) => {
history.push(route);
};
return (
<SidebarNavigationContainer>
<SidebarNavigationTitle>
{t("admin.navigation.menu")}
</SidebarNavigationTitle>
<SidebarNavigationListContainer>
{ADMIN_NAVIGATION.map((value) => {
let isRouteActive = isInRoute(value.route);
if (
routeMatches(ADMIN_HOME_PAGE) &&
routeMatches(ADMIN_USERS_PAGE, value.route)
)
isRouteActive = true;
return (
<SidebarNavigationItem
active={isRouteActive}
key={value.text}
onClick={() => goToRoute(value.route)}
>
<SidebarNavigationItemIcon active={isRouteActive}>
{value.icon}
</SidebarNavigationItemIcon>
{value.text}
</SidebarNavigationItem>
);
})}
</SidebarNavigationListContainer>
</SidebarNavigationContainer>
);
};

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

export default SidebarNavigation;

+ 67
- 0
src/components/Admin/Sidebar/SidebarNavigation/SidebarNavigation.styled.js Parādīt failu

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

export const SidebarNavigationContainer = styled(Box)`
margin-left: 18px;
display: flex;
flex-direction: column;
/* flex: 1; */
`;

export const SidebarNavigationTitle = styled(Typography)`
font-family: "DM Sans";
font-size: 24px;
font-weight: 700;
margin-bottom: 4vh;
margin-left: 18px;
`;

export const SidebarNavigationListContainer = styled.ul``;
export const SidebarNavigationItem = styled.li`
padding-top: 1.7vh;
padding-bottom: 1.7vh;
padding-left: 18px;
font-family: "DM Sans";
font-size: 16px;
font-weight: 400;
display: flex;
border-radius: 4px;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
align-items: center;
color: ${selectedTheme.colors.primaryPurple};
cursor: pointer;
${(props) =>
props.active &&
`
background-color: #f5edff;
font-weight: 700;
`}
path {
stroke: #c4c4c4;
}

&:hover {
background-color: #f5edff;
font-weight: 700;

path {
stroke: #feb005;
}
}
`;

export const SidebarNavigationItemIcon = styled(Box)`
margin-right: 9px;
position: relative;
top: 2px;

${(props) =>
props.active &&
`
path {
stroke: #feb005;
}
`}
`;

+ 40
- 0
src/components/Admin/Sidebar/SidebarProfile/SidebarProfile.js Parādīt failu

import React from "react";
import PropTypes from "prop-types";
import {
SidebarProfileContainer,
SidebarProfileImage,
SidebarProfileName,
SidebarProfileRole,
} from "./SidebarProfile.styled";
import { getImageUrl, variants } from "../../../../util/helpers/imageUrlGetter";
import useIsMobile from "../../../../hooks/useIsMobile";
import { useTranslation } from "react-i18next";
import { useSelector } from "react-redux";
import { selectMineProfile } from "../../../../store/selectors/profileSelectors";

const SidebarProfile = () => {
const { isMobile } = useIsMobile();
const profile = useSelector(selectMineProfile);
const { t } = useTranslation();

return (
<SidebarProfileContainer>
<SidebarProfileImage
src={getImageUrl(profile.image, variants.profileImage, isMobile)}
/>
<SidebarProfileName>{profile.company.name}</SidebarProfileName>
<SidebarProfileRole>{t("admin.navigation.role")}</SidebarProfileRole>
</SidebarProfileContainer>
);
};

SidebarProfile.propTypes = {
profile: PropTypes.shape({
image: PropTypes.string,
company: PropTypes.shape({
name: PropTypes.string,
}),
}),
};

export default SidebarProfile;

+ 30
- 0
src/components/Admin/Sidebar/SidebarProfile/SidebarProfile.styled.js Parādīt failu

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

export const SidebarProfileContainer = styled(Box)`
display: flex;
flex-direction: column;
align-items: center;
padding: 0;
`;

export const SidebarProfileImage = styled.img`
width: 108px;
height: 108px;
border-radius: 100%;
`;

export const SidebarProfileName = styled(Typography)`
font-family: "DM Sans";
font-size: 16px;
font-weight: 700;
margin-top: 19px;
color: ${selectedTheme.colors.primaryPurple};
`;

export const SidebarProfileRole = styled(Typography)`
font-family: "DM Sans";
font-size: 12px;
color: ${selectedTheme.colors.primaryPurple};
`;

+ 1
- 1
src/components/Cards/CreateOfferCard/CreateOffer.js Parādīt failu

} else } else
history.push( history.push(
replaceInRoute(PROFILE_PAGE, { replaceInRoute(PROFILE_PAGE, {
idProfile: userId,
profileId: userId,
}) })
); );
closeCreateOfferModal(); closeCreateOfferModal();

+ 3
- 3
src/components/Cards/ItemDetailsCard/ItemDetailsCard.js Parādīt failu

import { selectUserId } from "../../../store/selectors/loginSelectors"; import { selectUserId } from "../../../store/selectors/loginSelectors";
import { formatDateLocale } from "../../../util/helpers/dateHelpers"; import { formatDateLocale } from "../../../util/helpers/dateHelpers";
import { startChat } from "../../../util/helpers/chatHelper"; import { startChat } from "../../../util/helpers/chatHelper";
import Information from "./Information/Information";
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 } from "react-router-dom";
const offer = useMemo(() => { const offer = useMemo(() => {
if (props.offer) { if (props.offer) {
if ( if (
props.offer.offer._id === routeMatch.params.idProizvod ||
props.offer.offer._id === routeMatch.params?.offerId ||
props.createOffer props.createOffer
) { ) {
return props.offer; return props.offer;
editOffer: true, editOffer: true,
offer: offer?.offer, offer: offer?.offer,
isAdmin: props.isAdmin, isAdmin: props.isAdmin,
customUserId: offer?.offer?.userId
customUserId: offer?.offer?.userId,
}) })
); );
}; };

+ 0
- 0
src/components/Cards/ItemDetailsCard/OfferInformations/OfferInformations.js Parādīt failu


+ 0
- 0
src/components/Cards/ItemDetailsCard/OfferInformations/OfferInformations.styled.js Parādīt failu


src/components/Cards/ItemDetailsCard/Information/Information.js → src/components/Cards/ItemDetailsCard/OfferInformations/SingleInformation/SingleInformation.js Parādīt failu

import React from "react"; import React from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import selectedTheme from "../../../../themes";
import { InfoGroup, InfoIcon, InfoText } from "./Information.styled";
import selectedTheme from "../../../../../themes";
import { InfoGroup, InfoIcon, InfoText } from "./SingleInformation.styled";


const Information = (props) => {
const SingleInformation = (props) => {
return ( return (
<InfoGroup hide={props.hide}> <InfoGroup hide={props.hide}>
<InfoIcon <InfoIcon
color={selectedTheme.colors.iconStrokeColor} color={selectedTheme.colors.iconStrokeColor}
component="span" component="span"
size="16px"
> >
{/* <CategoryIcon width={"14px"} /> */}
{props.icon} {props.icon}
</InfoIcon> </InfoIcon>
{/* <InfoText>{offer?.offer?.category?.name}</InfoText> */}
<InfoText>{props.value}</InfoText> <InfoText>{props.value}</InfoText>
</InfoGroup> </InfoGroup>
); );
}; };


Information.propTypes = {
SingleInformation.propTypes = {
icon: PropTypes.node, icon: PropTypes.node,
value: PropTypes.string, value: PropTypes.string,
hide: PropTypes.bool, hide: PropTypes.bool,
}; };


export default Information;
export default SingleInformation;

src/components/Cards/ItemDetailsCard/Information/Information.styled.js → src/components/Cards/ItemDetailsCard/OfferInformations/SingleInformation/SingleInformation.styled.js Parādīt failu

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


export const InfoGroup = styled(Box)` export const InfoGroup = styled(Box)`
display: ${props => props.hide ? 'none' : 'flex'}; display: ${props => props.hide ? 'none' : 'flex'};
export const InfoIcon = styled(Box)` export const InfoIcon = styled(Box)`
display: flex; display: flex;
align-items: center; align-items: center;
width: 16px;
height: 16px;
`; `;
export const InfoText = styled(Typography)` export const InfoText = styled(Typography)`
font-family: ${selectedTheme.fonts.textFont}; font-family: ${selectedTheme.fonts.textFont};

+ 1
- 1
src/components/Cards/MiniChatCard/MiniChatCard.js Parādīt failu

const changeChat = () => { const changeChat = () => {
history.push( history.push(
replaceInRoute(DIRECT_CHAT_PAGE, { replaceInRoute(DIRECT_CHAT_PAGE, {
idChat: props?.chat?.chat?._id,
chatId: props?.chat?.chat?._id,
}) })
); );
}; };

+ 1
- 1
src/components/Cards/OfferCard/CheckButton/CheckButton.js Parādīt failu

const routeToItem = (itemId) => { const routeToItem = (itemId) => {
history.push( history.push(
replaceInRoute(ITEM_DETAILS_PAGE, { replaceInRoute(ITEM_DETAILS_PAGE, {
idProizvod: itemId,
offerId: itemId,
}) })
); );
}; };

+ 2
- 2
src/components/Cards/OfferCard/OfferCard.js Parādīt failu

if (props.isAdmin) { if (props.isAdmin) {
history.push( history.push(
replaceInRoute(ADMIN_ITEM_DETAILS_PAGE, { replaceInRoute(ADMIN_ITEM_DETAILS_PAGE, {
idProizvod: itemId,
offerId: itemId,
}) })
); );
} else { } else {
history.push( history.push(
replaceInRoute(ITEM_DETAILS_PAGE, { replaceInRoute(ITEM_DETAILS_PAGE, {
idProizvod: itemId,
offerId: itemId,
}) })
); );
} }

+ 1
- 1
src/components/Cards/ProfileCard/BigProfileCard/BigProfileCard.js Parādīt failu

const goToUser = () => { const goToUser = () => {
history.push( history.push(
replaceInRoute(ADMIN_SINGLE_USER_PAGE, { replaceInRoute(ADMIN_SINGLE_USER_PAGE, {
idProfile: props.profile?._id,
profileId: props.profile?._id,
}) })
); );
}; };

+ 10
- 10
src/components/Cards/ProfileCard/ProfileCard.js Parādīt failu

const { isMobile } = useIsMobile(); const { isMobile } = useIsMobile();
const profileFromRedux = useSelector(selectProfile); const profileFromRedux = useSelector(selectProfile);
const userId = useSelector(selectUserId); const userId = useSelector(selectUserId);
const idProfile = useMemo(() => {
return routeMatch.params.idProfile;
}, [routeMatch.params.idProfile]);
const profileId = useMemo(() => {
return routeMatch.params.profileId;
}, [routeMatch.params.profileId]);
const { t } = useTranslation(); const { t } = useTranslation();


const profile = useMemo(() => { const profile = useMemo(() => {
if (profileFromRedux) { if (profileFromRedux) {
if (profileFromRedux._id === routeMatch.params.idProfile) {
if (profileFromRedux._id === routeMatch.params.profileId) {
return profileFromRedux; return profileFromRedux;
} }
} }
}, [profileFromRedux]); }, [profileFromRedux]);


const isMyProfile = useMemo( const isMyProfile = useMemo(
() => userId === idProfile && !props.isAdmin,
[userId, idProfile]
() => userId === profileId && !props.isAdmin,
[userId, profileId]
); );


useEffect(() => { useEffect(() => {
if (idProfile?.length > 0) {
if (profileId?.length > 0) {
reFetchProfile(); reFetchProfile();
} }
}, [idProfile]);
}, [profileId]);
useEffect(() => { useEffect(() => {
if (profile && isMyProfile !== undefined) { if (profile && isMyProfile !== undefined) {
if (!isMyProfile && profile._blocked && !props.isAdmin) if (!isMyProfile && profile._blocked && !props.isAdmin)
}, [profile, isMyProfile, props.isAdmin]); }, [profile, isMyProfile, props.isAdmin]);


const reFetchProfile = () => { const reFetchProfile = () => {
dispatch(fetchProfile(idProfile));
dispatch(fetchProfileOffers(idProfile));
dispatch(fetchProfile(profileId));
dispatch(fetchProfileOffers(profileId));
}; };


let percentOfSucceededExchanges; let percentOfSucceededExchanges;

+ 1
- 1
src/components/Cards/ProfileCard/ProfileMainInfo/ProfileMainInfo.js Parādīt failu

if (isAdminRoute()) { if (isAdminRoute()) {
history.push( history.push(
replaceInRoute(ADMIN_SINGLE_USER_PAGE, { replaceInRoute(ADMIN_SINGLE_USER_PAGE, {
idProfile: props.profile?._id,
profileId: props.profile?._id,
}) })
); );
} }

+ 0
- 1
src/components/Cards/RequestExchangeCard/RequestExchangeMessage/RequestExchangeMessage.js Parādīt failu

const exchange = useSelector(selectExchange); const exchange = useSelector(selectExchange);
const requester = useSelector(selectRequester); const requester = useSelector(selectRequester);


console.log(props);
const handleAcceptExchange = () => { const handleAcceptExchange = () => {
acceptExchangeSocket( acceptExchangeSocket(
props.chatId, props.chatId,

+ 1
- 1
src/components/Cards/UserReviewsCard/UserReviewsSingleCard/ReviewerProfile/ReviewerProfile.js Parādīt failu

const { isMobile } = useIsMobile(); const { isMobile } = useIsMobile();
const routeToUser = () => { const routeToUser = () => {
history.push(replaceInRoute(PROFILE_PAGE, { history.push(replaceInRoute(PROFILE_PAGE, {
idProfile: props.userId
profileId: props.userId
})) }))
} }
return ( return (

+ 0
- 1
src/components/Cards/UserReviewsCard/UserReviewsSingleCard/UserReviewsSingleCard.js Parādīt failu

const handleRemove = () => { const handleRemove = () => {
props.handleRemove(); props.handleRemove();
}; };
console.log(props.review);
return ( return (
<ReviewContainer <ReviewContainer
lastReview={props.lastReview} lastReview={props.lastReview}

+ 6
- 5
src/components/DirectChat/DirectChat.js Parādīt failu

// Fetch chat after it is created // Fetch chat after it is created
// (renders after state of location changes) // (renders after state of location changes)
useEffect(() => { useEffect(() => {
if (routeMatch.params.idChat) {
if (routeMatch.params?.chatId) {
refreshChat(); refreshChat();
} }
}, [routeMatch.params.idChat, location.state?.offerId]);
}, [routeMatch.params?.chatId, location.state?.offerId]);


// Listener to socket.IO chat // Listener to socket.IO chat
useEffect(() => { useEffect(() => {
} }
} else { } else {
dispatch(fetchChats()); dispatch(fetchChats());
dispatch(fetchOneChat(routeMatch.params.idChat));
dispatch(fetchOneChat(routeMatch.params?.chatId));
makeErrorToastMessage(t("apiErrors.somethingWentWrong")); makeErrorToastMessage(t("apiErrors.somethingWentWrong"));
} }
}); });
return () => removeMessageListener(); return () => removeMessageListener();
}, [allChats, routeMatch]); }, [allChats, routeMatch]);



const refreshChat = () => { const refreshChat = () => {
if (routeMatch.params.idChat === "newMessage") {
if (routeMatch.params?.chatId === "newMessage") {
dispatch(fetchOneOffer(location.state.offerId)); dispatch(fetchOneOffer(location.state.offerId));
dispatch(setOneChat({})); dispatch(setOneChat({}));
} else { } else {
dispatch(fetchOneChat(routeMatch.params.idChat));
dispatch(fetchOneChat(routeMatch.params?.chatId));
} }
}; };
const handleAcceptExchange = () => { const handleAcceptExchange = () => {

+ 1
- 1
src/components/DirectChat/DirectChatContent/DirectChatContentHeader/DirectChatContentHeader.js Parādīt failu

if (!props?.interlucator?._blocked) if (!props?.interlucator?._blocked)
history.push( history.push(
replaceInRoute(PROFILE_PAGE, { replaceInRoute(PROFILE_PAGE, {
idProfile: props?.interlucator?.userId,
profileId: props?.interlucator?.userId,
}) })
); );
}; };

+ 1
- 1
src/components/ItemDetails/ItemDetailsHeaderCard/ItemDetailsHeaderCard.js Parādīt failu

const { t } = useTranslation(); const { t } = useTranslation();
const offer = useMemo(() => { const offer = useMemo(() => {
if (props.offer) { if (props.offer) {
if (props.offer.offer._id === routeMatch.params.idProizvod) {
if (props.offer.offer._id === routeMatch.params.offerId) {
return props.offer; return props.offer;
} }
} }

+ 0
- 1
src/components/Modals/EditCategory/EditCategory.js Parādīt failu

} else closeModalHandler(); } else closeModalHandler();
}; };
const handleSubmit = (values) => { const handleSubmit = (values) => {
console.log(props);
dispatch( dispatch(
fetchAdminMethod({ fetchAdminMethod({
type: props.type, type: props.type,

+ 6
- 6
src/components/Profile/Profile.js Parādīt failu

const userId = useSelector(selectUserId); const userId = useSelector(selectUserId);
const dispatch = useDispatch(); const dispatch = useDispatch();
const routeMatch = useRouteMatch(); const routeMatch = useRouteMatch();
const idProfile = useMemo(() => routeMatch.params?.idProfile, [routeMatch]);
const profileId = useMemo(() => routeMatch.params?.profileId, [routeMatch]);
useEffect(() => { useEffect(() => {
if (idProfile?.length > 0) {
dispatch(fetchProfile(idProfile));
if (profileId?.length > 0) {
dispatch(fetchProfile(profileId));
} }
}, [idProfile]);
}, [profileId]);
const isMyProfile = useMemo(() => { const isMyProfile = useMemo(() => {
return userId === routeMatch.params.idProfile;
return userId === routeMatch.params?.profileId;
}, [userId, routeMatch]); }, [userId, routeMatch]);
return ( return (
<ProfileContainer className={props.className}> <ProfileContainer className={props.className}>
<ProfileOffers <ProfileOffers
isAdmin={props.isAdmin} isAdmin={props.isAdmin}
isMyProfile={isMyProfile} isMyProfile={isMyProfile}
idProfile={idProfile}
idProfile={profileId}
/> />
</ProfileContainer> </ProfileContainer>
); );

+ 0
- 2
src/components/TextFields/AutoSuggestTextField/AutoSuggestTextField.js Parādīt failu

onChange: props.onChange, onChange: props.onChange,
}; };


console.log(suggestions);

return ( return (
<AutoSuggestTextFieldContainer <AutoSuggestTextFieldContainer
editLocation={props.editLocation} editLocation={props.editLocation}

+ 3
- 4
src/components/UserReviews/UserReviews.js Parādīt failu

) )
); );


console.log("userr", props)


useEffect(() => { useEffect(() => {
let idProfile = routeMatch.params.idProfile;
let idProfile = routeMatch.params?.profileId;
if (idProfile) { if (idProfile) {
if (props.isAdmin) { if (props.isAdmin) {
dispatch(fetchReviewsAsAdmin(idProfile)); dispatch(fetchReviewsAsAdmin(idProfile));
} }
} }


// if (props.profileReviews && routeMatch.params?.idProfile) {
// let idProfile = routeMatch.params.idProfile;
// if (props.profileReviews && routeMatch.params?.profileId) {
// let idProfile = routeMatch.params?.profileId;
// dispatch(fetchReviews(idProfile)); // dispatch(fetchReviews(idProfile));
// } // }
}, [props.profileReviews, routeMatch]); }, [props.profileReviews, routeMatch]);

+ 2
- 2
src/pages/AdminHomePage/AdminItemDetailsPage/AdminItemDetailsPage.js Parādīt failu

const dispatch = useDispatch(); const dispatch = useDispatch();
const selectedOffer = useSelector(selectOffer); const selectedOffer = useSelector(selectOffer);
const [isInitiallyLoaded, setIsInitiallyLoaded] = useState(false); const [isInitiallyLoaded, setIsInitiallyLoaded] = useState(false);
const offerId = props.match.params.idProizvod;
const offerId = props.match.params?.offerId;
useEffect(() => { useEffect(() => {
dispatch(fetchOneOffer(offerId)); dispatch(fetchOneOffer(offerId));
AdminItemDetailsPage.propTypes = { AdminItemDetailsPage.propTypes = {
match: PropTypes.shape({ match: PropTypes.shape({
params: PropTypes.shape({ params: PropTypes.shape({
idProizvod: PropTypes.string,
offerId: PropTypes.string,
}), }),
}), }),
}; };

+ 2
- 2
src/pages/ItemDetailsPage/ItemDetailsPageMUI.js Parādīt failu

const dispatch = useDispatch(); const dispatch = useDispatch();
const selectedOffer = useSelector(selectOffer); const selectedOffer = useSelector(selectOffer);
const [isInitiallyLoaded, setIsInitiallyLoaded] = useState(false); const [isInitiallyLoaded, setIsInitiallyLoaded] = useState(false);
const offerId = props.match.params.idProizvod;
const offerId = props.match.params.offerId;


useEffect(() => { useEffect(() => {
dispatch(fetchOneOffer(offerId)); dispatch(fetchOneOffer(offerId));
ItemDetailsPage.propTypes = { ItemDetailsPage.propTypes = {
match: PropTypes.shape({ match: PropTypes.shape({
params: PropTypes.shape({ params: PropTypes.shape({
idProizvod: PropTypes.string,
offerId: PropTypes.string,
}), }),
}), }),
}; };

+ 1
- 1
src/pages/MessagesListPage/MessagesListPage.js Parādīt failu

setTimeout(() => { setTimeout(() => {
history.push( history.push(
replaceInRoute(DIRECT_CHAT_PAGE, { replaceInRoute(DIRECT_CHAT_PAGE, {
idChat: chatId,
chatId: chatId,
}) })
); );
}, 120); }, 120);

+ 0
- 4
src/pages/RegisterPages/Register/FirstPart/FirstPartOfRegistration.js Parādīt failu

}} }}
/> />




{console.log(formik)}

{formik.errors.mail && formik.touched.mail ? ( {formik.errors.mail && formik.touched.mail ? (
<ErrorMessage>{formik.errors.mail}</ErrorMessage> <ErrorMessage>{formik.errors.mail}</ErrorMessage>
) : formik.errors.registerPassword && formik.touched.registerPassword ? ( ) : formik.errors.registerPassword && formik.touched.registerPassword ? (

+ 0
- 1
src/store/saga/adminSaga.js Parādīt failu



function* fetchAdminMethod({ payload }) { function* fetchAdminMethod({ payload }) {
try { try {
yield call(console.log, "admin", payload);
if (payload.type === CATEGORIES_TYPE) { if (payload.type === CATEGORIES_TYPE) {
if (payload.method === ADD_TYPE) if (payload.method === ADD_TYPE)
yield call(addCategory, { values: payload.values, id: payload.id }); yield call(addCategory, { values: payload.values, id: payload.id });

+ 0
- 1
src/store/saga/chatSaga.js Parādīt failu

const data = yield call(attemptFetchChats, { userId, queryString }); const data = yield call(attemptFetchChats, { userId, queryString });
yield put(setChats([...data.data.chatsWithData])); yield put(setChats([...data.data.chatsWithData]));
yield put(setChatsTotal(data.data.total)) yield put(setChatsTotal(data.data.total))
console.log(data);
const newChatId = newChatData.data.chatId; const newChatId = newChatData.data.chatId;
yield put(startNewChatSuccess()); yield put(startNewChatSuccess());
yield call( yield call(

+ 1
- 1
src/store/saga/locationsSaga.js Parādīt failu

try { try {
const data = yield call(attemptFetchLocations); const data = yield call(attemptFetchLocations);
if (!data?.data) throw new Error(); if (!data?.data) throw new Error();
yield put(setLocations(data.data.value));
yield put(setLocations(data.data));
yield put(fetchLocationsSuccess()); yield put(fetchLocationsSuccess());
} catch (e) { } catch (e) {
yield put(fetchLocationsError()); yield put(fetchLocationsError());

+ 15
- 18
src/util/helpers/messageHelper.js Parādīt failu

import { replaceInRoute } from "./routeHelpers"; import { replaceInRoute } from "./routeHelpers";


export const messageUserHelper = (chats, userId, offer) => { export const messageUserHelper = (chats, userId, offer) => {
const chatItem = chats.find(
(item) => item.chat.offerId === offer?.offer?._id
);
if (chatItem !== undefined) {
history.push(
replaceInRoute(DIRECT_CHAT_PAGE, { idChat: chatItem.chat._id })
);
} else {
if (offer?.offer?.userId !== userId) {
history.push(
replaceInRoute(DIRECT_CHAT_PAGE, { idChat: "newMessage" }),
{
offerId: offer?.offer?._id,
}
);
}
}
}
const chatItem = chats.find(
(item) => item.chat.offerId === offer?.offer?._id
);
if (chatItem !== undefined) {
history.push(
replaceInRoute(DIRECT_CHAT_PAGE, { chatId: chatItem.chat._id })
);
} else {
if (offer?.offer?.userId !== userId) {
history.push(replaceInRoute(DIRECT_CHAT_PAGE, { chatId: "newMessage" }), {
offerId: offer?.offer?._id,
});
}
}
};

Notiek ielāde…
Atcelt
Saglabāt