| const handleMouseDownPassword = () => setShowPassword(!showPassword); | const handleMouseDownPassword = () => setShowPassword(!showPassword); | ||||
| const error = useSelector(selectLoginError); | const error = useSelector(selectLoginError); | ||||
| const { t } = useTranslation(); | const { t } = useTranslation(); | ||||
| console.log(error, props); | |||||
| useEffect(() => { | useEffect(() => { | ||||
| console.dir(error); | console.dir(error); | ||||
| }, [error]); | }, [error]); |
| import React from "react"; | import React from "react"; | ||||
| import PropTypes from "prop-types"; | import PropTypes from "prop-types"; | ||||
| import { Tooltip } from "@mui/material"; | |||||
| // import { Tooltip } from "@mui/material"; | |||||
| import { | import { | ||||
| ButtonContainer, | ButtonContainer, | ||||
| CategoryHeaderIcon, | CategoryHeaderIcon, | ||||
| }; | }; | ||||
| return ( | 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> | |||||
| ); | ); | ||||
| }; | }; | ||||
| import MyMessagesNotFound from "../MyMessages/MyMessagesNotFound/MyMessagesNotFound"; | import MyMessagesNotFound from "../MyMessages/MyMessagesNotFound/MyMessagesNotFound"; | ||||
| import MyPostsNotFound from "../MyPosts/MyPostsNotFound/MyPostsNotFound"; | import MyPostsNotFound from "../MyPosts/MyPostsNotFound/MyPostsNotFound"; | ||||
| import { useSelector } from "react-redux"; | 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 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 { isMobile } = useIsMobile(); | ||||
| const items = useMemo(() => props.items, [props.items]); | const items = useMemo(() => props.items, [props.items]); | ||||
| return ( | return ( |
| const handleClickFinishButton = () => { | const handleClickFinishButton = () => { | ||||
| let urlLink = linkValue.trim(); | let urlLink = linkValue.trim(); | ||||
| if (urlLink.startsWith("http://") || urlLink.startsWith("https://")) | if (urlLink.startsWith("http://") || urlLink.startsWith("https://")) | ||||
| props?.callbackFunction(urlLink); else props?.callbackFunction(`http://${urlLink}`) | |||||
| props?.callbackFunction(urlLink); | |||||
| else props?.callbackFunction(`http://${urlLink}`); | |||||
| }; | }; | ||||
| return ( | return ( |
| import styled from "styled-components"; | import styled from "styled-components"; | ||||
| export const ListContainer = styled(Box)` | export const ListContainer = styled(Box)` | ||||
| color: green; | |||||
| color: #fff; | |||||
| padding-left: 18px; | padding-left: 18px; | ||||
| & > div { | & > div { | ||||
| display: list-item; | display: list-item; |
| children = <span style={{ color: leaf.color }}>{children}</span>; | children = <span style={{ color: leaf.color }}>{children}</span>; | ||||
| } | } | ||||
| if (leaf.a) { | if (leaf.a) { | ||||
| // prettier-ignore | |||||
| children = ( | children = ( | ||||
| <a href={leaf.a} target="_blank">{/*eslint-disable-line*/} | <a href={leaf.a} target="_blank">{/*eslint-disable-line*/} | ||||
| {children} | {children} |
| import { Redirect, Route } from "react-router"; | import { Redirect, Route } from "react-router"; | ||||
| import { useSelector } from "react-redux"; | import { useSelector } from "react-redux"; | ||||
| import { HOME_PAGE } from "../../constants/pages"; | 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 AdminRoute = ({ ...props }) => { | ||||
| const role = useSelector(selectRoles); | |||||
| // const role = useSelector(selectRoles); | |||||
| const profile = useSelector(selectMineProfile); | |||||
| const isUserAdmin = useMemo(() => { | const isUserAdmin = useMemo(() => { | ||||
| if (!role?.includes("Admin")) return false; | |||||
| if (!profile?.roles?.includes("Admin")) return false; | |||||
| return true; | return true; | ||||
| }, [role]); | |||||
| }, [profile]); | |||||
| return isUserAdmin ? <Route {...props} /> : <Redirect to={HOME_PAGE} />; | return isUserAdmin ? <Route {...props} /> : <Redirect to={HOME_PAGE} />; | ||||
| }; | }; |
| date: { | date: { | ||||
| range: "{{start}} do {{end}}", | range: "{{start}} do {{end}}", | ||||
| }, | }, | ||||
| fillIn: "Unesi" | |||||
| fillIn: "Unesi", | |||||
| }, | }, | ||||
| login: { | login: { | ||||
| welcome: "React template", | welcome: "React template", | ||||
| requestSent: "Uspešno ste ponudili trampu kompaniji.", | requestSent: "Uspešno ste ponudili trampu kompaniji.", | ||||
| requestAccepted: "Kompanija je prihvatila trampu sa Vama.", | requestAccepted: "Kompanija je prihvatila trampu sa Vama.", | ||||
| requestReceived: | 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", | acceptRequest: "Prihvati", | ||||
| acceptedRequest: "Prihvaćeno", | acceptedRequest: "Prihvaćeno", | ||||
| declineRequest: "Odbij", | declineRequest: "Odbij", | ||||
| messageUser: "Message user", | messageUser: "Message user", | ||||
| prevPage: "Previous page", | prevPage: "Previous page", | ||||
| nextPage: "Next page", | nextPage: "Next page", | ||||
| link: "Link" | |||||
| link: "Link", | |||||
| }, | }, | ||||
| colorPicker: { | colorPicker: { | ||||
| label: "Boja: ", | label: "Boja: ", | ||||
| pink: "Roze", | pink: "Roze", | ||||
| }, | }, | ||||
| examples: { | examples: { | ||||
| link: "ex. https://google.com/" | |||||
| } | |||||
| link: "ex. https://google.com/", | |||||
| }, | |||||
| }; | }; |
| `; | `; | ||||
| export const AdminSingleUserPageProfile = styled(Profile)` | export const AdminSingleUserPageProfile = styled(Profile)` | ||||
| margin-bottom: 5px; | margin-bottom: 5px; | ||||
| h5 { | |||||
| pointer-events: none; | |||||
| } | |||||
| `; | `; | ||||
| export const AdminSingleUserPageReviews = styled(UserReviews)` | export const AdminSingleUserPageReviews = styled(UserReviews)` | ||||
| padding: 0; | padding: 0; |
| // if (!informations.image) { | // if (!informations.image) { | ||||
| // setImageError(true); | // setImageError(true); | ||||
| // } else { | // } else { | ||||
| registerUser({ ...informations, ...values }); | |||||
| registerUser({ ...informations, ...values }); | |||||
| // } | // } | ||||
| } | } | ||||
| setInformations({ ...informations, ...values }); | setInformations({ ...informations, ...values }); |
| makeErrorToastMessage(i18next.t("apiErrors.somethingWentWrong")); | makeErrorToastMessage(i18next.t("apiErrors.somethingWentWrong")); | ||||
| return Promise.reject(error); | return Promise.reject(error); | ||||
| } | } | ||||
| if (error.response.status === 400) { | |||||
| return Promise.reject(error); | |||||
| } | |||||
| if (error.response.status === 401) { | if (error.response.status === 401) { | ||||
| dispatch(logoutUser()); | dispatch(logoutUser()); | ||||
| return Promise.reject(error); | return Promise.reject(error); |