| @@ -15,7 +15,7 @@ const PasswordField = forwardRef((props, ref) => { | |||
| const handleMouseDownPassword = () => setShowPassword(!showPassword); | |||
| const error = useSelector(selectLoginError); | |||
| const { t } = useTranslation(); | |||
| console.log(error, props); | |||
| useEffect(() => { | |||
| console.dir(error); | |||
| }, [error]); | |||
| @@ -1,6 +1,6 @@ | |||
| import React from "react"; | |||
| import PropTypes from "prop-types"; | |||
| import { Tooltip } from "@mui/material"; | |||
| // import { Tooltip } from "@mui/material"; | |||
| import { | |||
| ButtonContainer, | |||
| CategoryHeaderIcon, | |||
| @@ -45,63 +45,63 @@ const TooltipHeader = (props) => { | |||
| }; | |||
| return ( | |||
| <Tooltip | |||
| title={ | |||
| history.location.pathname.includes("admin") || | |||
| history.location.pathname.includes("myoffers") | |||
| ? "" | |||
| : headerString.text | |||
| } | |||
| > | |||
| <TooltipInnerContainer> | |||
| {!props?.myOffers ? ( | |||
| <> | |||
| <CategoryHeaderIcon /> | |||
| <HeaderLocation> | |||
| <HeaderCategoryString | |||
| component="span" | |||
| onClick={handleClickCategory} | |||
| > | |||
| {headerString.categoryString} | |||
| </HeaderCategoryString> | |||
| <HeaderSubcategoryString | |||
| component="span" | |||
| onClick={handleClickSubcategory} | |||
| > | |||
| {headerString.subcategoryString} | |||
| </HeaderSubcategoryString> | |||
| <HeaderLocationsString component="span"> | |||
| <HeaderLocationsMainString component="span"> | |||
| {headerString.locationsString} | |||
| </HeaderLocationsMainString> | |||
| <HeaderCompanyString> | |||
| {headerString.companiesString} | |||
| </HeaderCompanyString> | |||
| <HeaderAltLocation component="span"> | |||
| {props?.altText} | |||
| </HeaderAltLocation> | |||
| </HeaderLocationsString> | |||
| </HeaderLocation> | |||
| </> | |||
| ) : ( | |||
| <> | |||
| {!isMobile ? ( | |||
| <HeaderTitleContainer> | |||
| {props?.headerIcon} | |||
| <HeaderTitleText>{props?.headerTitle}</HeaderTitleText> | |||
| </HeaderTitleContainer> | |||
| ) : ( | |||
| !props.hideBackButton && ( | |||
| <ButtonContainer onClick={goBack}> | |||
| <ArrowButton side={"left"}></ArrowButton> | |||
| <HeaderText>{t("messages.goBack")}</HeaderText> | |||
| </ButtonContainer> | |||
| ) | |||
| )} | |||
| </> | |||
| )} | |||
| </TooltipInnerContainer> | |||
| </Tooltip> | |||
| // <Tooltip | |||
| // title={ | |||
| // history.location.pathname.includes("admin") || | |||
| // history.location.pathname.includes("myoffers") | |||
| // ? "" | |||
| // : headerString.text | |||
| // } | |||
| // > | |||
| <TooltipInnerContainer> | |||
| {!props?.myOffers ? ( | |||
| <> | |||
| <CategoryHeaderIcon /> | |||
| <HeaderLocation> | |||
| <HeaderCategoryString | |||
| component="span" | |||
| onClick={handleClickCategory} | |||
| > | |||
| {headerString.categoryString} | |||
| </HeaderCategoryString> | |||
| <HeaderSubcategoryString | |||
| component="span" | |||
| onClick={handleClickSubcategory} | |||
| > | |||
| {headerString.subcategoryString} | |||
| </HeaderSubcategoryString> | |||
| <HeaderLocationsString component="span"> | |||
| <HeaderLocationsMainString component="span"> | |||
| {headerString.locationsString} | |||
| </HeaderLocationsMainString> | |||
| <HeaderCompanyString> | |||
| {headerString.companiesString} | |||
| </HeaderCompanyString> | |||
| <HeaderAltLocation component="span"> | |||
| {props?.altText} | |||
| </HeaderAltLocation> | |||
| </HeaderLocationsString> | |||
| </HeaderLocation> | |||
| </> | |||
| ) : ( | |||
| <> | |||
| {!isMobile ? ( | |||
| <HeaderTitleContainer> | |||
| {props?.headerIcon} | |||
| <HeaderTitleText>{props?.headerTitle}</HeaderTitleText> | |||
| </HeaderTitleContainer> | |||
| ) : ( | |||
| !props.hideBackButton && ( | |||
| <ButtonContainer onClick={goBack}> | |||
| <ArrowButton side={"left"}></ArrowButton> | |||
| <HeaderText>{t("messages.goBack")}</HeaderText> | |||
| </ButtonContainer> | |||
| ) | |||
| )} | |||
| </> | |||
| )} | |||
| </TooltipInnerContainer> | |||
| // </Tooltip> | |||
| ); | |||
| }; | |||
| @@ -21,11 +21,13 @@ import { useMemo } from "react"; | |||
| import MyMessagesNotFound from "../MyMessages/MyMessagesNotFound/MyMessagesNotFound"; | |||
| import MyPostsNotFound from "../MyPosts/MyPostsNotFound/MyPostsNotFound"; | |||
| import { useSelector } from "react-redux"; | |||
| import { selectRoles } from "../../../store/selectors/loginSelectors"; | |||
| import { selectMineProfile } from "../../../store/selectors/profileSelectors"; | |||
| // import { selectRoles } from "../../../store/selectors/loginSelectors"; | |||
| const HeaderPopover = (props) => { | |||
| const role = useSelector(selectRoles); | |||
| const isAdmin = role?.includes("Admin"); | |||
| // const role = useSelector(selectRoles); | |||
| const profile = useSelector(selectMineProfile); | |||
| const isAdmin = profile?.roles?.includes("Admin"); | |||
| const { isMobile } = useIsMobile(); | |||
| const items = useMemo(() => props.items, [props.items]); | |||
| return ( | |||
| @@ -16,7 +16,8 @@ const LinkPopover = (props) => { | |||
| const handleClickFinishButton = () => { | |||
| let urlLink = linkValue.trim(); | |||
| if (urlLink.startsWith("http://") || urlLink.startsWith("https://")) | |||
| props?.callbackFunction(urlLink); else props?.callbackFunction(`http://${urlLink}`) | |||
| props?.callbackFunction(urlLink); | |||
| else props?.callbackFunction(`http://${urlLink}`); | |||
| }; | |||
| return ( | |||
| @@ -2,7 +2,7 @@ import { Box } from "@mui/material"; | |||
| import styled from "styled-components"; | |||
| export const ListContainer = styled(Box)` | |||
| color: green; | |||
| color: #fff; | |||
| padding-left: 18px; | |||
| & > div { | |||
| display: list-item; | |||
| @@ -20,6 +20,7 @@ const RichTextLeaf = ({ attributes, children, leaf }) => { | |||
| children = <span style={{ color: leaf.color }}>{children}</span>; | |||
| } | |||
| if (leaf.a) { | |||
| // prettier-ignore | |||
| children = ( | |||
| <a href={leaf.a} target="_blank">{/*eslint-disable-line*/} | |||
| {children} | |||
| @@ -2,14 +2,17 @@ import React, { useMemo } from "react"; | |||
| import { Redirect, Route } from "react-router"; | |||
| import { useSelector } from "react-redux"; | |||
| import { HOME_PAGE } from "../../constants/pages"; | |||
| import { selectRoles } from "../../store/selectors/loginSelectors"; | |||
| // import { selectRoles } from "../../store/selectors/loginSelectors"; | |||
| import { selectMineProfile } from "../../store/selectors/profileSelectors"; | |||
| const AdminRoute = ({ ...props }) => { | |||
| const role = useSelector(selectRoles); | |||
| // const role = useSelector(selectRoles); | |||
| const profile = useSelector(selectMineProfile); | |||
| const isUserAdmin = useMemo(() => { | |||
| if (!role?.includes("Admin")) return false; | |||
| if (!profile?.roles?.includes("Admin")) return false; | |||
| return true; | |||
| }, [role]); | |||
| }, [profile]); | |||
| return isUserAdmin ? <Route {...props} /> : <Redirect to={HOME_PAGE} />; | |||
| }; | |||
| @@ -47,7 +47,7 @@ export default { | |||
| date: { | |||
| range: "{{start}} do {{end}}", | |||
| }, | |||
| fillIn: "Unesi" | |||
| fillIn: "Unesi", | |||
| }, | |||
| login: { | |||
| welcome: "React template", | |||
| @@ -260,7 +260,7 @@ export default { | |||
| requestSent: "Uspešno ste ponudili trampu kompaniji.", | |||
| requestAccepted: "Kompanija je prihvatila trampu sa Vama.", | |||
| requestReceived: | |||
| "Da li želite da prihvatite trampu sa nama za gorenavedeni proizvod?", | |||
| "Da li želite da prihvatite trampu sa nama za gore navedeni proizvod?", | |||
| acceptRequest: "Prihvati", | |||
| acceptedRequest: "Prihvaćeno", | |||
| declineRequest: "Odbij", | |||
| @@ -604,7 +604,7 @@ export default { | |||
| messageUser: "Message user", | |||
| prevPage: "Previous page", | |||
| nextPage: "Next page", | |||
| link: "Link" | |||
| link: "Link", | |||
| }, | |||
| colorPicker: { | |||
| label: "Boja: ", | |||
| @@ -615,6 +615,6 @@ export default { | |||
| pink: "Roze", | |||
| }, | |||
| examples: { | |||
| link: "ex. https://google.com/" | |||
| } | |||
| link: "ex. https://google.com/", | |||
| }, | |||
| }; | |||
| @@ -12,6 +12,10 @@ export const AdminSingleUserPageContainer = styled(Box)` | |||
| `; | |||
| export const AdminSingleUserPageProfile = styled(Profile)` | |||
| margin-bottom: 5px; | |||
| h5 { | |||
| pointer-events: none; | |||
| } | |||
| `; | |||
| export const AdminSingleUserPageReviews = styled(UserReviews)` | |||
| padding: 0; | |||
| @@ -99,7 +99,7 @@ const Register = () => { | |||
| // if (!informations.image) { | |||
| // setImageError(true); | |||
| // } else { | |||
| registerUser({ ...informations, ...values }); | |||
| registerUser({ ...informations, ...values }); | |||
| // } | |||
| } | |||
| setInformations({ ...informations, ...values }); | |||
| @@ -15,6 +15,9 @@ export default ({ dispatch }) => | |||
| makeErrorToastMessage(i18next.t("apiErrors.somethingWentWrong")); | |||
| return Promise.reject(error); | |||
| } | |||
| if (error.response.status === 400) { | |||
| return Promise.reject(error); | |||
| } | |||
| if (error.response.status === 401) { | |||
| dispatch(logoutUser()); | |||
| return Promise.reject(error); | |||