Quellcode durchsuchen

Finished feature 636

feature/636
jovan.cirkovic vor 3 Jahren
Ursprung
Commit
aeb89519df

+ 3
- 1
src/components/Header/Header.js Datei anzeigen

{!routeMatches(ABOUT_PAGE) && ( {!routeMatches(ABOUT_PAGE) && (
<> <>
<AddOfferButton onClick={handleAddOfferClick} /> <AddOfferButton onClick={handleAddOfferClick} />
<MySwapsButton />
<MySwapsButton
handleAddOfferClick={handleAddOfferClick}
/>
<MyMessagesButton /> <MyMessagesButton />
</> </>
)} )}

+ 9
- 2
src/components/Header/MySwapsButton/MySwapsButton.js Datei anzeigen

import { useEffect } from "react"; import { useEffect } from "react";
import { useLocation } from "react-router-dom"; import { useLocation } from "react-router-dom";


const MySwapsButton = () => {
const MySwapsButton = (props) => {
const location = useLocation(); const location = useLocation();
const [postsPopoverOpen, setPostsPopoverOpen] = useState(false); const [postsPopoverOpen, setPostsPopoverOpen] = useState(false);
const [postsAnchorEl, setPostsAnchorEl] = useState(null); const [postsAnchorEl, setPostsAnchorEl] = useState(null);
setPostsPopoverOpen(false); setPostsPopoverOpen(false);
setPostsAnchorEl(null); setPostsAnchorEl(null);
}; };
const closePopover = () => {
setPostsPopoverOpen(false);
props.handleAddOfferClick();
};
return ( return (
<> <>
<IconButton <IconButton
setPostsPopoverOpen(false); setPostsPopoverOpen(false);
setPostsAnchorEl(null); setPostsAnchorEl(null);
}} }}
content={<MyPosts closePopover={closePostsPopover} />}
content={
<MyPosts addOffer={closePopover} closePopover={closePostsPopover} />
}
/> />
</> </>
); );


MySwapsButton.propTypes = { MySwapsButton.propTypes = {
onClick: PropTypes.func, onClick: PropTypes.func,
handleAddOfferClick: PropTypes.func,
}; };


export default MySwapsButton; export default MySwapsButton;

+ 13
- 4
src/components/Popovers/HeaderPopover/HeaderPopover.js Datei anzeigen

PopoverListItemAvatarContainer, PopoverListItemAvatarContainer,
PopoverListItemProfileAvatar, PopoverListItemProfileAvatar,
PopoverListItemTextContainer, PopoverListItemTextContainer,
PopoverNoItemsText,
PopoverTitle, PopoverTitle,
SecondaryText, SecondaryText,
SecondaryTextContainer, SecondaryTextContainer,
} from "./HeaderPopover.styled"; } from "./HeaderPopover.styled";
import { useTranslation } from "react-i18next";
import useIsMobile from "../../../hooks/useIsMobile"; import useIsMobile from "../../../hooks/useIsMobile";
import { getImageUrl, variants } from "../../../util/helpers/imageUrlGetter"; import { getImageUrl, variants } from "../../../util/helpers/imageUrlGetter";
import { useMemo } from "react"; import { useMemo } from "react";
import MyMessagesNotFound from "../MyMessages/MyMessagesNotFound/MyMessagesNotFound";
import MyPostsNotFound from "../MyPosts/MyPostsNotFound/MyPostsNotFound";


const HeaderPopover = (props) => { const HeaderPopover = (props) => {
const { t } = useTranslation();
const { isMobile } = useIsMobile(); const { isMobile } = useIsMobile();
const items = useMemo(() => props.items, [props.items]); const items = useMemo(() => props.items, [props.items]);
return ( return (
); );
}) })
) : ( ) : (
<PopoverNoItemsText>{t("header.noItems")}</PopoverNoItemsText>
<>
{props.noMessages ? (
<MyMessagesNotFound />
) : (
<MyPostsNotFound addOffer={props.addOffer} />
)}
</>
)} )}
</PopoverList> </PopoverList>
<PopoverButtonsContainer hideButtons={props.hideButtons}> <PopoverButtonsContainer hideButtons={props.hideButtons}>
variant="text" variant="text"
endIcon={props.buttonIcon} endIcon={props.buttonIcon}
onClick={props.buttonOnClick} onClick={props.buttonOnClick}
disabled={props.noMessages || props.noPosts}
> >
{props.buttonText} {props.buttonText}
</PopoverButton> </PopoverButton>
secondButtonOnClick: PropTypes.func, secondButtonOnClick: PropTypes.func,
hideButtons: PropTypes.bool, hideButtons: PropTypes.bool,
bigText: PropTypes.string, bigText: PropTypes.string,
noMessages: PropTypes.bool,
noPosts: PropTypes.bool,
addOffer: PropTypes.func,
}; };


export default HeaderPopover; export default HeaderPopover;

+ 19
- 4
src/components/Popovers/HeaderPopover/HeaderPopover.styled.js Datei anzeigen

`; `;
export const PopoverList = styled(List)` export const PopoverList = styled(List)`
width: 100%; width: 100%;
max-width: 360px;
max-width: 270px;
background-color: "white"; background-color: "white";
`; `;
export const PopoverListItem = styled(ListItem)` export const PopoverListItem = styled(ListItem)`
align-items: flex-end; align-items: flex-end;
`; `;
export const PopoverNoItemsText = styled(Typography)` export const PopoverNoItemsText = styled(Typography)`
text-align: center;
/* text-align: center; */
width: 100%; width: 100%;
font-weight: 600;
font-weight: 700;
padding-top: 5px; padding-top: 5px;
font-size: 13px;
padding-left: 18px;
font-size: 16px;
font-family: ${selectedTheme.fonts.textFont};
color: ${selectedTheme.colors.primaryPurple};
`;
export const PopoverAddItemText = styled(Typography)`
font-family: ${selectedTheme.fonts.textFont}; font-family: ${selectedTheme.fonts.textFont};
font-size: 12px;
padding-left: 18px;
padding-bottom: 91px;
`;
export const PopoverAddItemButton = styled(Typography)`
font-family: ${selectedTheme.fonts.textFont};
font-size: 12px;
color: ${selectedTheme.colors.primaryPurple};
text-decoration: underline;
cursor: pointer;
`; `;
export const NameOfProduct = styled(Typography)` export const NameOfProduct = styled(Typography)`
font-size: 12px; font-size: 12px;

+ 3
- 0
src/components/Popovers/MyMessages/MyMessages.js Datei anzeigen

import HeaderPopover from "../HeaderPopover/HeaderPopover"; import HeaderPopover from "../HeaderPopover/HeaderPopover";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { makeErrorToastMessage } from "../../../store/utils/makeToastMessage"; import { makeErrorToastMessage } from "../../../store/utils/makeToastMessage";
import { EyeIcon } from "./MyMessages.styled";


export const MyMessages = (props) => { export const MyMessages = (props) => {
const { t } = useTranslation(); const { t } = useTranslation();
items={lastChats} items={lastChats}
buttonOnClick={goToMessages} buttonOnClick={goToMessages}
buttonText={t("header.checkEverything")} buttonText={t("header.checkEverything")}
buttonIcon={<EyeIcon color={chats?.length === 0} />}
noMessages={chats?.length === 0}
/> />
); );
}; };

+ 25
- 14
src/components/Popovers/MyMessages/MyMessages.styled.js Datei anzeigen

import { TextField } from "@mui/material"; import { TextField } from "@mui/material";
import styled from "styled-components"; import styled from "styled-components";
import { ReactComponent as Eye } from "../../../assets/images/svg/eye-striked.svg";
import selectedTheme from "../../../themes";


export const SearchInput = styled(TextField)` export const SearchInput = styled(TextField)`
margin-left: 3.8rem;
background-color: #F4F4F4;
width: 45%;
max-width: 100%;
@media (max-width: 1100px) {
width: 36%;
}
@media (max-width: 900px) {
width: 54%;
}
@media (max-width: 600px) {
width: 36%;
}
`
margin-left: 3.8rem;
background-color: #f4f4f4;
width: 45%;
max-width: 100%;
@media (max-width: 1100px) {
width: 36%;
}
@media (max-width: 900px) {
width: 54%;
}
@media (max-width: 600px) {
width: 36%;
}
`;

export const EyeIcon = styled(Eye)`
& path {
stroke: ${(props) =>
props.color
? selectedTheme.colors.iconStrokeDisabledColor
: selectedTheme.colors.iconYellowColor};
}
`;

+ 33
- 0
src/components/Popovers/MyMessages/MyMessagesNotFound/MyMessagesNotFound.js Datei anzeigen

import React from "react";
import {
MessagesNotFoundContainer,
MessagesNotFoundText,
MessagesNotFoundTextSecond,
MessagesNotFoundSkeleton,
SkeletonImage,
SkeletonLinesContainer,
SkeletonFirstLine,
SkeletonSecondLine,
} from "./MyMessagesNotFound.styled";
import { useTranslation } from "react-i18next";

const MyMessagesNotFound = () => {
const { t } = useTranslation();
return (
<MessagesNotFoundContainer>
<MessagesNotFoundText> {t("messages.noMessages")}</MessagesNotFoundText>
<MessagesNotFoundTextSecond>
{t("messages.noMessagesSecond")}
</MessagesNotFoundTextSecond>
<MessagesNotFoundSkeleton>
<SkeletonImage />
<SkeletonLinesContainer>
<SkeletonFirstLine />
<SkeletonSecondLine />
</SkeletonLinesContainer>
</MessagesNotFoundSkeleton>
</MessagesNotFoundContainer>
);
};

export default MyMessagesNotFound;

+ 53
- 0
src/components/Popovers/MyMessages/MyMessagesNotFound/MyMessagesNotFound.styled.js Datei anzeigen

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

export const MessagesNotFoundContainer = styled(Box)``;

export const MessagesNotFoundText = styled(Typography)`
width: 100%;
font-weight: 700;
padding-top: 5px;
padding-left: 18px;
font-size: 16px;
font-family: ${selectedTheme.fonts.textFont};
color: ${selectedTheme.colors.primaryPurple};
`;
export const MessagesNotFoundTextSecond = styled(Typography)`
font-family: ${selectedTheme.fonts.textFont};
font-size: 12px;
padding-left: 18px;
`;

export const MessagesNotFoundSkeleton = styled(Box)`
margin: 18px 0 0 18px;
display: flex;
`;

export const SkeletonImage = styled(Box)`
width: 54px;
height: 54px;
border-radius: 100%;
background-color: ${selectedTheme.colors.skeletonItemColor};
`;

export const SkeletonLinesContainer = styled(Box)`
display: flex;
flex-direction: column;
margin-left: 9px;
`;

export const SkeletonFirstLine = styled(Box)`
width: 109px;
height: 18px;
border-radius: 2px;
margin-bottom: 6px;
background-color: ${selectedTheme.colors.skeletonItemColor};
`;

export const SkeletonSecondLine = styled(Box)`
width: 62px;
height: 14px;
border-radius: 2px;
background-color: ${selectedTheme.colors.skeletonItemColor};
`;

+ 5
- 1
src/components/Popovers/MyPosts/MyPosts.js Datei anzeigen

import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { PostsImgSuit } from "./MyPosts.styled";
import { EyeIcon, PostsImgSuit } from "./MyPosts.styled";
import PropTypes from "prop-types"; import PropTypes from "prop-types";


// const dummyData2 = [ // const dummyData2 = [
items={mineOffersToRender} items={mineOffersToRender}
buttonText={t("header.checkEverything")} buttonText={t("header.checkEverything")}
buttonOnClick={goToMySwaps} buttonOnClick={goToMySwaps}
buttonIcon={<EyeIcon color={mineOffers.length === 0} />}
noPosts={mineOffers.length === 0}
addOffer={props.addOffer}
/> />
); );
}; };


MyPosts.propTypes = { MyPosts.propTypes = {
closePopover: PropTypes.func, closePopover: PropTypes.func,
addOffer: PropTypes.func,
}; };

+ 32
- 21
src/components/Popovers/MyPosts/MyPosts.styled.js Datei anzeigen

import { TextField, Avatar } from "@mui/material"; import { TextField, Avatar } from "@mui/material";
import Suit from '@mui/icons-material/WorkOutline';
import Suit from "@mui/icons-material/WorkOutline";
import styled from "styled-components"; import styled from "styled-components";
import { ReactComponent as Eye } from "../../../assets/images/svg/eye-striked.svg";
import selectedTheme from "../../../themes";


export const PostsImgSuit = styled(Suit)` export const PostsImgSuit = styled(Suit)`
width: 1rem;
height: 1rem;
margin-right: .36rem;
`
width: 1rem;
height: 1rem;
margin-right: 0.36rem;
`;


export const PostsAvatar = styled(Avatar)` export const PostsAvatar = styled(Avatar)`
border-radius: 4px;
`
border-radius: 4px;
`;


export const SearchInput = styled(TextField)` export const SearchInput = styled(TextField)`
margin-left: 3.8rem;
background-color: #F4F4F4;
width: 45%;
max-width: 100%;
@media (max-width: 1100px) {
width: 36%;
}
@media (max-width: 900px) {
width: 54%;
}
@media (max-width: 600px) {
width: 36%;
}
`
margin-left: 3.8rem;
background-color: #f4f4f4;
width: 45%;
max-width: 100%;
@media (max-width: 1100px) {
width: 36%;
}
@media (max-width: 900px) {
width: 54%;
}
@media (max-width: 600px) {
width: 36%;
}
`;

export const EyeIcon = styled(Eye)`
& path {
stroke: ${(props) =>
props.color
? selectedTheme.colors.iconStrokeDisabledColor
: selectedTheme.colors.iconYellowColor};
}
`;

+ 44
- 0
src/components/Popovers/MyPosts/MyPostsNotFound/MyPostsNotFound.js Datei anzeigen

import React from "react";
import PropTypes from "prop-types";
import {
PostsNotFoundButton,
PostsNotFoundContainer,
PostsNotFoundText,
PostsNotFoundTextSecond,
PostsNotFoundSkeleton,
PostsNotFoundSkeletonImage,
} from "./MyPostsNotFound.styled";
import { useTranslation } from "react-i18next";
import {
SkeletonFirstLine,
SkeletonLinesContainer,
SkeletonSecondLine,
} from "../../MyMessages/MyMessagesNotFound/MyMessagesNotFound.styled";

const MyPostsNotFound = (props) => {
const { t } = useTranslation();
return (
<PostsNotFoundContainer>
<PostsNotFoundText>{t("header.noItems")}</PostsNotFoundText>
<PostsNotFoundTextSecond>
<PostsNotFoundButton onClick={props.addOffer}>
{t("header.addItem")}
</PostsNotFoundButton>
{t("header.yourFirstOffer")}
</PostsNotFoundTextSecond>
<PostsNotFoundSkeleton>
<PostsNotFoundSkeletonImage />
<SkeletonLinesContainer>
<SkeletonFirstLine />
<SkeletonSecondLine />
</SkeletonLinesContainer>
</PostsNotFoundSkeleton>
</PostsNotFoundContainer>
);
};

MyPostsNotFound.propTypes = {
addOffer: PropTypes.func,
};

export default MyPostsNotFound;

+ 41
- 0
src/components/Popovers/MyPosts/MyPostsNotFound/MyPostsNotFound.styled.js Datei anzeigen

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

export const PostsNotFoundContainer = styled(Box)``;

export const PostsNotFoundText = styled(Typography)`
width: 100%;
font-weight: 700;
padding-top: 5px;
padding-left: 18px;
font-size: 16px;
font-family: ${selectedTheme.fonts.textFont};
color: ${selectedTheme.colors.primaryPurple};
`;

export const PostsNotFoundTextSecond = styled(Typography)`
font-family: ${selectedTheme.fonts.textFont};
font-size: 12px;
padding-left: 18px;
`;

export const PostsNotFoundButton = styled(Typography)`
font-family: ${selectedTheme.fonts.textFont};
font-size: 12px;
color: ${selectedTheme.colors.primaryPurple};
text-decoration: underline;
cursor: pointer;
`;

export const PostsNotFoundSkeleton = styled(Box)`
margin: 18px 0 0 18px;
display: flex;
`;

export const PostsNotFoundSkeletonImage = styled(Box)`
width: 54px;
height: 54px;
border-radius: 2px;
background-color: ${selectedTheme.colors.skeletonItemColor};
`;

+ 0
- 1
src/components/Popovers/MyProfile/LogoutButton/LogoutButton.styled.js Datei anzeigen

import styled from "styled-components"; import styled from "styled-components";
import { ReactComponent as Logout } from "../../../../assets/images/svg/log-out.svg"; import { ReactComponent as Logout } from "../../../../assets/images/svg/log-out.svg";



export const MiddleButton = styled(Box)` export const MiddleButton = styled(Box)`
margin: 0 16px; margin: 0 16px;
padding-top: 14px; padding-top: 14px;

+ 4
- 5
src/components/Popovers/MyProfile/MyProfile.js Datei anzeigen

pathname: ABOUT_PAGE, pathname: ABOUT_PAGE,
state: { state: {
clicked: true, clicked: true,
navigation: scrollConstants.about.pricesPage
}
navigation: scrollConstants.about.pricesPage,
},
}); });
props.closePopover(); props.closePopover();
}; };



return ( return (
<HeaderPopover <HeaderPopover
title={t("header.myProfile")} title={t("header.myProfile")}
secondButtonText={t("header.prices")} secondButtonText={t("header.prices")}
secondButtonOnClick={seePrices} secondButtonOnClick={seePrices}
> >
<LogoutButton />
<GrayButtonsContainer> <GrayButtonsContainer>
<AboutButton closePopover={props.closePopover}/>
<AboutButton closePopover={props.closePopover} />
<PrivacyPolicyButton closePopover={props.closePopover} /> <PrivacyPolicyButton closePopover={props.closePopover} />
</GrayButtonsContainer> </GrayButtonsContainer>
<LogoutButton />
</HeaderPopover> </HeaderPopover>
); );
}; };

+ 8
- 4
src/components/Popovers/MyProfile/MyProfile.styled.js Datei anzeigen

margin-right: 0.36rem; margin-right: 0.36rem;
`; `;



export const ProfileAvatar = styled(Avatar)` export const ProfileAvatar = styled(Avatar)`
width: 63px; width: 63px;
height: 63px; height: 63px;
& button { & button {
margin-bottom: 5.5px; margin-bottom: 5.5px;
margin-top: 5.5px; margin-top: 5.5px;
color: ${selectedTheme.colors.primaryGrayText};
margin-right: 0;
color: ${selectedTheme.colors.primaryPurple};
} }
`; `;
export const GrayButtonsContainer = styled(Box)` export const GrayButtonsContainer = styled(Box)`
margin: 16px 0;
margin-bottom: 16px;
margin-left: 16px;
margin-right: 16px;
padding-top: 16px;
border-top: 1px solid rgba(77, 77, 77, 0.12);
`; `;
export const DollarIcon = styled(Dollar)` export const DollarIcon = styled(Dollar)`
position: relative; position: relative;
left: -4px; left: -4px;
margin-left: 10px; margin-left: 10px;
`
`;

+ 5
- 6
src/i18n/resources/rs.js Datei anzeigen

myMessages: "Moje poruke", myMessages: "Moje poruke",
newOffers: "Najnovije ponude", newOffers: "Najnovije ponude",
navMenu: "Navigacioni Meni", navMenu: "Navigacioni Meni",
noItems: "Trenutno nema ni jedne stavke...",
noItems: "Objave nisu pronađene.",
logout: "Odjavite se", logout: "Odjavite se",
about: "O trampi", about: "O trampi",
prices: "Cenovnik", prices: "Cenovnik",
privacy: "Politika privatnosti", privacy: "Politika privatnosti",
addItem: "Dodajte",
yourFirstOffer: " svoju prvu objavu.",
}, },
reviews: { reviews: {
title: "Ova kompanija još uvek nema ocenu.", title: "Ova kompanija još uvek nema ocenu.",
noMessagesToast: "Nemate ni jednu poruku!", noMessagesToast: "Nemate ni jednu poruku!",
notAllowedChat: "Trampa za ovaj proizvod je završena.", notAllowedChat: "Trampa za ovaj proizvod je završena.",
goBack: "Nazad na sve poruke", goBack: "Nazad na sve poruke",
noMessages: "Poruke nisu pronađene.",
noMessagesSecond: "Nažalost, nemate ni jednu poruku.",
}, },
editProfile: { editProfile: {
website: "Web Sajt*", website: "Web Sajt*",
labelLocationRequired: "Lokacija je obavezna!", labelLocationRequired: "Lokacija je obavezna!",
labelPhoneValid: "Unesite validan broj telefona", labelPhoneValid: "Unesite validan broj telefona",
labelPhoneRequired: "Broj telefona je obavezan!", labelPhoneRequired: "Broj telefona je obavezan!",
labelLocationValid: "Unesite validnu lokaciju!",
}, },
deleteOffer: { deleteOffer: {
areYouSure: "Da li ste sigurni da želite da <br /> obrišete proizvod?", areYouSure: "Da li ste sigurni da želite da <br /> obrišete proizvod?",
description: "Opis", description: "Opis",
email: "Mejl kompanije", email: "Mejl kompanije",
}, },
carousel: {
imagesReview: "Pregled fotografija",
offer: "Proizvod:",
},
}; };

Laden…
Abbrechen
Speichern