| flex-direction: row; | flex-direction: row; | ||||
| justify-content: space-between; | justify-content: space-between; | ||||
| position: relative; | position: relative; | ||||
| @media (max-width: 1050px) { | |||||
| height: 102px; | |||||
| margin-left: 0; | |||||
| margin-right: 0; | |||||
| width: 100%; | |||||
| } | |||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| height: 102px; | height: 102px; | ||||
| margin-left: 0; | margin-left: 0; | ||||
| export const CategoryCardRightContainer = styled(Box)` | export const CategoryCardRightContainer = styled(Box)` | ||||
| display: flex; | display: flex; | ||||
| flex-direction: row; | flex-direction: row; | ||||
| @media (max-width: 345px) { | |||||
| position: absolute; | |||||
| right: 0; | |||||
| } | |||||
| `; | `; | ||||
| export const CategoryCardDetailsContainer = styled(Box)` | export const CategoryCardDetailsContainer = styled(Box)` | ||||
| display: flex; | display: flex; | ||||
| flex-direction: row; | flex-direction: row; | ||||
| @media (max-width: 1050px) { | |||||
| position: absolute; | |||||
| bottom: 50px; | |||||
| left: -13px; | |||||
| max-height: 16px; | |||||
| } | |||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| position: absolute; | position: absolute; | ||||
| bottom: 18px; | bottom: 18px; |
| height: 44px; | height: 44px; | ||||
| } | } | ||||
| } | } | ||||
| @media (max-width: 360px) { | |||||
| width: 300px; | |||||
| } | |||||
| @media (max-width: 320px) { | |||||
| width: 260px; | |||||
| } | |||||
| @media (max-height: 660px) { | |||||
| position: relative; | |||||
| width: 100%; | |||||
| margin-top: 34px; | |||||
| } | |||||
| `; | `; | ||||
| export const ErrorText = styled(Typography)` | export const ErrorText = styled(Typography)` | ||||
| color: red; | color: red; |
| export const CreateOfferFormContainer = styled(Box)` | export const CreateOfferFormContainer = styled(Box)` | ||||
| width: 335px; | width: 335px; | ||||
| padding: 20px 0 35px 0; | padding: 20px 0 35px 0; | ||||
| @media (max-width: 360px) { | |||||
| width: 100%; | |||||
| } | |||||
| `; | `; | ||||
| export const FieldLabel = styled(Label)` | export const FieldLabel = styled(Label)` | ||||
| position: relative; | position: relative; |
| display: flex; | display: flex; | ||||
| flex-direction: column; | flex-direction: column; | ||||
| justify-content: center; | justify-content: center; | ||||
| @media (max-width: 360px) { | |||||
| width: 260px; | |||||
| } | |||||
| `; | `; |
| position: absolute; | position: absolute; | ||||
| bottom: 26px; | bottom: 26px; | ||||
| } | } | ||||
| @media (max-width: 320px) { | |||||
| width: 260px; | |||||
| } | |||||
| @media (max-height: 629px) { | |||||
| position: relative; | |||||
| margin-top: 40px; | |||||
| } | |||||
| `; | `; |
| const closeAllSections = () => { | const closeAllSections = () => { | ||||
| categoryRef.current.closeSection(); | categoryRef.current.closeSection(); | ||||
| subcategoryRef.current.closeSection(); | subcategoryRef.current.closeSection(); | ||||
| locationRef.current.closeSection(); | |||||
| companyRef.current.closeSection(); | |||||
| locationRef?.current?.closeSection(); | |||||
| companyRef?.current?.closeSection(); | |||||
| }; | }; | ||||
| console.log(props); | |||||
| return ( | return ( | ||||
| <FilterCardContainer | <FilterCardContainer | ||||
| filtersOpened={props.filtersOpened} | filtersOpened={props.filtersOpened} |
| {isMobile ? ( | {isMobile ? ( | ||||
| <CloseIcon onClick={props.toggleFilters} /> | <CloseIcon onClick={props.toggleFilters} /> | ||||
| ) : ( | ) : ( | ||||
| <Link to="#" textsize={"12px"} font={selectedTheme.fonts.textFont} onClick={clearFilters}> | |||||
| <Link | |||||
| to="#" | |||||
| textsize={"12px"} | |||||
| font={selectedTheme.fonts.textFont} | |||||
| onClick={clearFilters} | |||||
| > | |||||
| {t("filters.cancel")} | {t("filters.cancel")} | ||||
| </Link> | </Link> | ||||
| )} | )} |
| 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")}; | |||||
| flex-direction: row; | flex-direction: row; | ||||
| align-items: center; | align-items: center; | ||||
| gap: 4px; | gap: 4px; | ||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| font-size: 12px; | font-size: 12px; | ||||
| } | } | ||||
| `; | |||||
| @media (max-width: 360px) { | |||||
| max-width: 50px; | |||||
| } | |||||
| `; |
| export const SaveButton = styled(PrimaryButton)` | export const SaveButton = styled(PrimaryButton)` | ||||
| font-size: 12px; | font-size: 12px; | ||||
| letter-spacing: 1.5px; | letter-spacing: 1.5px; | ||||
| @media (max-width: 375px) { | |||||
| width: 100%; | |||||
| } | |||||
| `; | `; | ||||
| export const FinishButton = styled(PrimaryAnimatedButton)` | export const FinishButton = styled(PrimaryAnimatedButton)` | ||||
| font-size: 12px; | font-size: 12px; | ||||
| letter-spacing: 1.5px; | letter-spacing: 1.5px; | ||||
| ` | |||||
| @media (max-width: 375px) { | |||||
| width: 100%; | |||||
| } | |||||
| `; | |||||
| export const ButtonsContainer = styled(Box)` | export const ButtonsContainer = styled(Box)` | ||||
| display: flex; | display: flex; |
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| width: 100%; | width: 100%; | ||||
| margin: 0; | margin: 0; | ||||
| ${props => props.ismymessage ? "margin-right: 9px;" : "margin-left: 9px;"} | |||||
| ${(props) => | |||||
| props.ismymessage ? "margin-right: 9px;" : "margin-left: 9px;"} | |||||
| } | } | ||||
| `; | `; | ||||
| export const MessageText = styled(Typography)` | export const MessageText = styled(Typography)` |
| gap: 27px; | gap: 27px; | ||||
| width: 314px; | width: 314px; | ||||
| margin-bottom: 10px; | margin-bottom: 10px; | ||||
| @media (max-width: 445px) { | |||||
| width: 100%; | |||||
| } | |||||
| `; | `; | ||||
| export const RequestExchangeMessageText = styled(Typography)` | export const RequestExchangeMessageText = styled(Typography)` | ||||
| font-family: ${selectedTheme.fonts.textFont}; | font-family: ${selectedTheme.fonts.textFont}; | ||||
| flex-direction: row; | flex-direction: row; | ||||
| justify-content: space-between; | justify-content: space-between; | ||||
| gap: 18px; | gap: 18px; | ||||
| @media (max-width: 375px) { | |||||
| gap: 9px; | |||||
| } | |||||
| `; | `; | ||||
| export const RequestExchangeMessageButton = styled(PrimaryButton)` | export const RequestExchangeMessageButton = styled(PrimaryButton)` | ||||
| flex: 1; | flex: 1; | ||||
| font-family: ${selectedTheme.fonts.textFont}; | font-family: ${selectedTheme.fonts.textFont}; | ||||
| letter-spacing: 1.5px; | letter-spacing: 1.5px; | ||||
| } | } | ||||
| @media (max-width: 375px) { | |||||
| height: 40px; | |||||
| & button { | |||||
| letter-spacing: 1px; | |||||
| } | |||||
| } | |||||
| `; | `; |
| `; | `; | ||||
| export const DirectChatHeaderStatusContainer = styled(Box)` | export const DirectChatHeaderStatusContainer = styled(Box)` | ||||
| background-color: ${selectedTheme.colors.primaryPurple}; | background-color: ${selectedTheme.colors.primaryPurple}; | ||||
| height: 39px; | |||||
| /* height: 39px; */ | |||||
| width: 100%; | width: 100%; | ||||
| padding: 9px 36px; | padding: 9px 36px; | ||||
| @media (max-width: 600px) { | @media (max-width: 600px) { |
| CategoryIcon, | CategoryIcon, | ||||
| DollarIcon, | DollarIcon, | ||||
| LocationIcon, | LocationIcon, | ||||
| MarketplaceIcon, | |||||
| UserIcon, | UserIcon, | ||||
| } from "./AdminButtons.styled"; | } from "./AdminButtons.styled"; | ||||
| import { | import { | ||||
| ADMIN_LOCATIONS_PAGE, | ADMIN_LOCATIONS_PAGE, | ||||
| ADMIN_PAYMENT_PAGE, | ADMIN_PAYMENT_PAGE, | ||||
| ADMIN_USERS_PAGE, | ADMIN_USERS_PAGE, | ||||
| HOME_PAGE, | |||||
| } from "../../../../../constants/pages"; | } from "../../../../../constants/pages"; | ||||
| import { useTranslation } from "react-i18next"; | import { useTranslation } from "react-i18next"; | ||||
| title={t("admin.navigation.payment")} | title={t("admin.navigation.payment")} | ||||
| route={ADMIN_PAYMENT_PAGE} | route={ADMIN_PAYMENT_PAGE} | ||||
| /> | /> | ||||
| <AdminButton | |||||
| toggleDrawer={props.toggleDrawer} | |||||
| icon={<MarketplaceIcon />} | |||||
| title={t("admin.navigation.marketplace")} | |||||
| route={HOME_PAGE} | |||||
| /> | |||||
| </> | </> | ||||
| ); | ); | ||||
| }; | }; |
| import { ReactComponent as Location } from "../../../../../assets/images/svg/location.svg"; | import { ReactComponent as Location } from "../../../../../assets/images/svg/location.svg"; | ||||
| import { ReactComponent as Category } from "../../../../../assets/images/svg/category.svg"; | import { ReactComponent as Category } from "../../../../../assets/images/svg/category.svg"; | ||||
| import { ReactComponent as Dollar } from "../../../../../assets/images/svg/dollar-sign.svg"; | import { ReactComponent as Dollar } from "../../../../../assets/images/svg/dollar-sign.svg"; | ||||
| import { ReactComponent as Marketplace } from "../../../../../assets/images/svg/package.svg"; | |||||
| import styled from "styled-components"; | import styled from "styled-components"; | ||||
| export const LocationIcon = styled(Location)``; | export const LocationIcon = styled(Location)``; | ||||
| export const UserIcon = styled(User)``; | export const UserIcon = styled(User)``; | ||||
| export const CategoryIcon = styled(Category)``; | export const CategoryIcon = styled(Category)``; | ||||
| export const DollarIcon = styled(Dollar)``; | |||||
| export const DollarIcon = styled(Dollar)``; | |||||
| export const MarketplaceIcon = styled(Marketplace)``; |
| import React from "react"; | |||||
| import PropTypes from "prop-types"; | |||||
| import { useTranslation } from "react-i18next"; | |||||
| import { DrawerButton, DrawerOption } from "../../Drawer.styled"; | |||||
| import { IconButton } from "../../../../Buttons/IconButton/IconButton"; | |||||
| import history from "../../../../../store/utils/history"; | |||||
| import { ADMIN_HOME_PAGE } from "../../../../../constants/pages"; | |||||
| import { SettingsIcon } from "./AdminPanelButton.styled"; | |||||
| const AdminPanelButton = (props) => { | |||||
| const { t } = useTranslation(); | |||||
| const handleClick = () => { | |||||
| props.toggleDrawer(); | |||||
| history.push(ADMIN_HOME_PAGE); | |||||
| }; | |||||
| return ( | |||||
| <DrawerButton onClick={handleClick}> | |||||
| <IconButton sx={{ borderRadius: "4px" }}> | |||||
| <SettingsIcon /> | |||||
| </IconButton> | |||||
| <DrawerOption>{t("profile.adminPanel")}</DrawerOption> | |||||
| </DrawerButton> | |||||
| ); | |||||
| }; | |||||
| AdminPanelButton.propTypes = { | |||||
| toggleDrawer: PropTypes.func, | |||||
| }; | |||||
| export default AdminPanelButton; |
| import styled from "styled-components"; | |||||
| import { ReactComponent as Settings } from "../../../../../assets/images/svg/settings.svg"; | |||||
| import selectedTheme from "../../../../../themes"; | |||||
| export const SettingsIcon = styled(Settings)` | |||||
| width: 24px; | |||||
| height: 24px; | |||||
| margin-right: 9px; | |||||
| & path { | |||||
| stroke: ${selectedTheme.colors.primaryYellow}; | |||||
| } | |||||
| `; |
| import AboutButton from "./Buttons/AboutButton/AboutButton"; | import AboutButton from "./Buttons/AboutButton/AboutButton"; | ||||
| import PrivacyPolicyButton from "./Buttons/PrivacyPolicyButton/PrivacyPolicyButton"; | import PrivacyPolicyButton from "./Buttons/PrivacyPolicyButton/PrivacyPolicyButton"; | ||||
| import { useSelector } from "react-redux"; | import { useSelector } from "react-redux"; | ||||
| import { selectUserId } from "../../../store/selectors/loginSelectors"; | |||||
| import { | |||||
| selectRoles, | |||||
| selectUserId, | |||||
| } from "../../../store/selectors/loginSelectors"; | |||||
| import { isAdminRoute } from "../../../util/helpers/routeHelpers"; | import { isAdminRoute } from "../../../util/helpers/routeHelpers"; | ||||
| import { useLocation } from "react-router-dom"; | import { useLocation } from "react-router-dom"; | ||||
| import AdminButtons from "./Buttons/AdminButtons/AdminButtons"; | import AdminButtons from "./Buttons/AdminButtons/AdminButtons"; | ||||
| import AdminInfo from "./AdminInfo/AdminInfo"; | import AdminInfo from "./AdminInfo/AdminInfo"; | ||||
| import { selectMineProfile } from "../../../store/selectors/profileSelectors"; | import { selectMineProfile } from "../../../store/selectors/profileSelectors"; | ||||
| import AdminPanelButton from "./Buttons/AdminPanelButton/AdminPanelButton"; | |||||
| export const Drawer = (props) => { | export const Drawer = (props) => { | ||||
| const { t } = useTranslation(); | const { t } = useTranslation(); | ||||
| const mineProfile = useSelector(selectMineProfile); | const mineProfile = useSelector(selectMineProfile); | ||||
| const location = useLocation(); | const location = useLocation(); | ||||
| const isAdmin = useMemo(() => isAdminRoute(), [location.pathname]); | const isAdmin = useMemo(() => isAdminRoute(), [location.pathname]); | ||||
| const role = useSelector(selectRoles); | |||||
| const isUserAdmin = role?.includes("Admin"); | |||||
| return ( | return ( | ||||
| <DrawerContainer> | <DrawerContainer> | ||||
| <ToolsContainer mobile isAdmin={isAdmin}> | <ToolsContainer mobile isAdmin={isAdmin}> | ||||
| {user ? ( | {user ? ( | ||||
| isAdmin ? ( | isAdmin ? ( | ||||
| <AdminButtons toggleDrawer={props.toggleDrawer}/> | |||||
| <AdminButtons toggleDrawer={props.toggleDrawer} /> | |||||
| ) : ( | ) : ( | ||||
| <> | <> | ||||
| <MyPostsButton toggleDrawer={props.toggleDrawer} /> | <MyPostsButton toggleDrawer={props.toggleDrawer} /> | ||||
| <MyMessagesButton toggleDrawer={props.toggleDrawer} /> | <MyMessagesButton toggleDrawer={props.toggleDrawer} /> | ||||
| <MyProfileButton toggleDrawer={props.toggleDrawer} /> | <MyProfileButton toggleDrawer={props.toggleDrawer} /> | ||||
| {isUserAdmin && ( | |||||
| <AdminPanelButton toggleDrawer={props.toggleDrawer} /> | |||||
| )} | |||||
| <Separator /> | <Separator /> | ||||
| <PricesButton toggleDrawer={props.toggleDrawer} /> | <PricesButton toggleDrawer={props.toggleDrawer} /> | ||||
| <AboutButton toggleDrawer={props.toggleDrawer} /> | <AboutButton toggleDrawer={props.toggleDrawer} /> | ||||
| {isAdmin ? ( | {isAdmin ? ( | ||||
| <AdminInfo name={mineProfile?.company?.name} /> | <AdminInfo name={mineProfile?.company?.name} /> | ||||
| ) : ( | ) : ( | ||||
| <AddOfferButton | |||||
| toggleDrawer={props.toggleDrawer} | |||||
| /> | |||||
| <AddOfferButton toggleDrawer={props.toggleDrawer} /> | |||||
| )} | )} | ||||
| <LogoutButton toggleDrawer={props.toggleDrawer} /> | <LogoutButton toggleDrawer={props.toggleDrawer} /> | ||||
| </FooterButtons> | </FooterButtons> |
| bottom: 70px; | bottom: 70px; | ||||
| left: ${(props) => (props.isAdmin ? "18px" : "36px")}; | left: ${(props) => (props.isAdmin ? "18px" : "36px")}; | ||||
| gap: ${(props) => (props.isAdmin ? "0" : "26px")}; | gap: ${(props) => (props.isAdmin ? "0" : "26px")}; | ||||
| @media (max-width: 320px) { | |||||
| gap: 6px; | |||||
| } | |||||
| `; | `; | ||||
| export const AuthButtonsDrawerContainer = styled(Box)` | export const AuthButtonsDrawerContainer = styled(Box)` | ||||
| export const CloseButton = styled(IconButton)` | export const CloseButton = styled(IconButton)` | ||||
| position: absolute; | position: absolute; | ||||
| top: 30px; | |||||
| right: 36px; | |||||
| top: 16px; | |||||
| right: 18px; | |||||
| z-index: 1000; | z-index: 1000; | ||||
| `; | `; | ||||
| export const CloseIcon = styled(Close)` | export const CloseIcon = styled(Close)` | ||||
| position: absolute; | position: absolute; | ||||
| top: 36px; | top: 36px; | ||||
| left: 36px; | left: 36px; | ||||
| @media (max-width: 375px) { | |||||
| top: 18px; | |||||
| } | |||||
| `; | `; | ||||
| export const Separator = styled(Box)` | export const Separator = styled(Box)` | ||||
| border-bottom: 1px solid ${selectedTheme.colors.primaryPurpleDisabled}; | border-bottom: 1px solid ${selectedTheme.colors.primaryPurpleDisabled}; |
| import React from "react"; | import React from "react"; | ||||
| import PropTypes from "prop-types"; | import PropTypes from "prop-types"; | ||||
| import useIsMobile from "../../../hooks/useIsMobile"; | |||||
| // import useIsMobile from "../../../hooks/useIsMobile"; | |||||
| import { Drawer as HeaderDrawer } from "../Drawer/Drawer"; | import { Drawer as HeaderDrawer } from "../Drawer/Drawer"; | ||||
| import Drawer from "../../MUI/DrawerComponent"; | import Drawer from "../../MUI/DrawerComponent"; | ||||
| import { useState } from "react"; | import { useState } from "react"; | ||||
| const DrawerContainer = forwardRef((props, ref) => { | const DrawerContainer = forwardRef((props, ref) => { | ||||
| const [openDrawer, setOpenDrawer] = useState(false); | const [openDrawer, setOpenDrawer] = useState(false); | ||||
| const { isMobile } = useIsMobile(); | |||||
| // const { isMobile } = useIsMobile(); | |||||
| useImperativeHandle(ref, () => ({ | useImperativeHandle(ref, () => ({ | ||||
| handleToggleDrawer, | handleToggleDrawer, | ||||
| const handleToggleDrawer = () => { | const handleToggleDrawer = () => { | ||||
| setOpenDrawer((prevOpenDrawer) => !prevOpenDrawer); | setOpenDrawer((prevOpenDrawer) => !prevOpenDrawer); | ||||
| }; | }; | ||||
| if (!isMobile) return <></>; | |||||
| // if (!isMobile) return <></>; | |||||
| return ( | return ( | ||||
| <Drawer | <Drawer | ||||
| open={openDrawer} | open={openDrawer} |
| import UserButton from "./UserButton/UserButton"; | import UserButton from "./UserButton/UserButton"; | ||||
| import LoginButton from "./LoginButton/LoginButton"; | import LoginButton from "./LoginButton/LoginButton"; | ||||
| import RegisterButton from "./RegisterButton/RegisterButton"; | import RegisterButton from "./RegisterButton/RegisterButton"; | ||||
| import useIsMobile from "../../hooks/useIsMobile"; | |||||
| import { toggleCreateOfferModal } from "../../store/actions/modal/modalActions"; | import { toggleCreateOfferModal } from "../../store/actions/modal/modalActions"; | ||||
| import { ReactComponent as Marketplace } from "../../assets/images/svg/package.svg"; | import { ReactComponent as Marketplace } from "../../assets/images/svg/package.svg"; | ||||
| import { useTranslation } from "react-i18next"; | import { useTranslation } from "react-i18next"; | ||||
| import useIsTablet from "../../hooks/useIsTablet"; | |||||
| const Header = () => { | const Header = () => { | ||||
| const theme = useTheme(); | const theme = useTheme(); | ||||
| const drawerRef = useRef(null); | const drawerRef = useRef(null); | ||||
| const [shouldShow, setShouldShow] = useState(true); | const [shouldShow, setShouldShow] = useState(true); | ||||
| const routeMatch = useRouteMatch(); | const routeMatch = useRouteMatch(); | ||||
| const { isMobile } = useIsMobile(); | |||||
| const { isTablet } = useIsTablet(); | |||||
| const { t } = useTranslation(); | const { t } = useTranslation(); | ||||
| // Dont show header on auth routes(login, register, etc.) and admin routes | // Dont show header on auth routes(login, register, etc.) and admin routes | ||||
| useEffect(() => { | useEffect(() => { | ||||
| if (isAuthRoute() || (isAdminRoute() && !isMobile)) setShouldShow(false); | |||||
| if (isAuthRoute() || (isAdminRoute() && !isTablet)) setShouldShow(false); | |||||
| else setShouldShow(true); | else setShouldShow(true); | ||||
| }, [routeMatch, isMobile]); | |||||
| }, [routeMatch, isTablet]); | |||||
| // Fetch mine profile on loading home page | // Fetch mine profile on loading home page | ||||
| useEffect(() => { | useEffect(() => { |
| import { Icon } from "../../../../Icon/Icon"; | import { Icon } from "../../../../Icon/Icon"; | ||||
| import { ReactComponent as Location } from "../../../../../assets/images/svg/location.svg"; | import { ReactComponent as Location } from "../../../../../assets/images/svg/location.svg"; | ||||
| export const DetailContainer = styled(Box)` | export const DetailContainer = styled(Box)` | ||||
| display: flex; | display: flex; | ||||
| flex-direction: row; | flex-direction: row; | ||||
| line-height: 16px; | line-height: 16px; | ||||
| margin-bottom: 7px; | margin-bottom: 7px; | ||||
| font-size: 12px; | font-size: 12px; | ||||
| @media (max-width: 600px) { | |||||
| /* @media (max-width: 600px) { | |||||
| ${(props) => props.shouldHideResponsive && `display: none;`} | ${(props) => props.shouldHideResponsive && `display: none;`} | ||||
| } */ | |||||
| @media (max-width: 600px) { | |||||
| margin-bottom: 3px; | |||||
| } | } | ||||
| `; | `; | ||||
| export const DetailIcon = styled(Icon)` | export const DetailIcon = styled(Icon)` | ||||
| width: 22px; | width: 22px; | ||||
| position: relative; | position: relative; | ||||
| } | } | ||||
| @media (max-width: 600px) { | |||||
| & svg { | |||||
| width: 14px; | |||||
| } | |||||
| } | |||||
| `; | `; | ||||
| export const DetailText = styled(Typography)` | export const DetailText = styled(Typography)` | ||||
| font-family: ${selectedTheme.fonts.textFont}; | font-family: ${selectedTheme.fonts.textFont}; | ||||
| color: ${props => props.ismyprofile ? "white" : selectedTheme.colors.primaryText}; | |||||
| color: ${(props) => | |||||
| props.ismyprofile ? "white" : selectedTheme.colors.primaryText}; | |||||
| line-height: 16px; | line-height: 16px; | ||||
| font-size: 16px; | font-size: 16px; | ||||
| position: relative; | position: relative; | ||||
| font-size: 14px; | font-size: 14px; | ||||
| } | } | ||||
| `; | `; | ||||
| export const LocationIcon = styled(Location)` | |||||
| ` | |||||
| export const LocationIcon = styled(Location)``; |
| font-size: 12px; | font-size: 12px; | ||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| ${(props) => props.shouldHideResponsive && `display: none;`} | ${(props) => props.shouldHideResponsive && `display: none;`} | ||||
| margin-bottom: 3px; | |||||
| } | } | ||||
| `; | `; | ||||
| export const DetailIcon = styled(Icon)` | export const DetailIcon = styled(Icon)` | ||||
| `; | `; | ||||
| export const DetailText = styled(Typography)` | export const DetailText = styled(Typography)` | ||||
| font-family: ${selectedTheme.fonts.textFont}; | font-family: ${selectedTheme.fonts.textFont}; | ||||
| color: ${props => props.isMyProfile ? "white" : selectedTheme.colors.primaryText}; | |||||
| color: ${(props) => | |||||
| props.isMyProfile ? "white" : selectedTheme.colors.primaryText}; | |||||
| line-height: 16px; | line-height: 16px; | ||||
| font-size: 16px; | font-size: 16px; | ||||
| position: relative; | position: relative; | ||||
| height: 14px; | height: 14px; | ||||
| } | } | ||||
| } | } | ||||
| `; | |||||
| `; |
| import { selectLoginError } from "../../store/selectors/loginSelectors"; | import { selectLoginError } from "../../store/selectors/loginSelectors"; | ||||
| import { HOME_PAGE, ADMIN_HOME_PAGE } from "../../constants/pages"; | import { HOME_PAGE, ADMIN_HOME_PAGE } from "../../constants/pages"; | ||||
| import { ReactComponent as Logo } from "../../assets/images/svg/logo-vertical.svg"; | import { ReactComponent as Logo } from "../../assets/images/svg/logo-vertical.svg"; | ||||
| import { ReactComponent as LogoAdmin } from "../../assets/images/svg/logo-vertical-admin.svg"; | |||||
| import { LoginPageContainer, LoginFormContainer } from "./Login.styled"; | |||||
| // import { ReactComponent as LogoAdmin } from "../../assets/images/svg/logo-vertical-admin.svg"; | |||||
| import { | |||||
| LoginPageContainer, | |||||
| LoginFormContainer, | |||||
| LogoAdmin, | |||||
| } from "./Login.styled"; | |||||
| import loginValidation from "../../validations/loginValidation"; | import loginValidation from "../../validations/loginValidation"; | ||||
| import loginInitialValues from "../../initialValues/loginInitialValues"; | import loginInitialValues from "../../initialValues/loginInitialValues"; | ||||
| import LoginTitle from "./Title/LoginTitle"; | import LoginTitle from "./Title/LoginTitle"; | ||||
| // Api response callback function on success | // Api response callback function on success | ||||
| const handleApiResponseSuccess = () => { | const handleApiResponseSuccess = () => { | ||||
| props.isAdmin ? history.push({ | |||||
| pathname: ADMIN_HOME_PAGE, | |||||
| state: { | |||||
| from: history.location.pathname, | |||||
| }, | |||||
| }) : | |||||
| history.push({ | |||||
| pathname: HOME_PAGE, | |||||
| state: { | |||||
| from: history.location.pathname, | |||||
| }, | |||||
| }); | |||||
| props.isAdmin | |||||
| ? history.push({ | |||||
| pathname: ADMIN_HOME_PAGE, | |||||
| state: { | |||||
| from: history.location.pathname, | |||||
| }, | |||||
| }) | |||||
| : history.push({ | |||||
| pathname: HOME_PAGE, | |||||
| state: { | |||||
| from: history.location.pathname, | |||||
| }, | |||||
| }); | |||||
| }; | }; | ||||
| // Resets password to blank field when there is need to | // Resets password to blank field when there is need to | ||||
| password, | password, | ||||
| handleApiResponseSuccess, | handleApiResponseSuccess, | ||||
| handleApiResponseError, | handleApiResponseError, | ||||
| isAdmin: props.isAdmin | |||||
| isAdmin: props.isAdmin, | |||||
| }) | }) | ||||
| ); | ); | ||||
| } | } | ||||
| return ( | return ( | ||||
| <LoginPageContainer> | <LoginPageContainer> | ||||
| { | |||||
| props.isAdmin ? <LogoAdmin/> : <Logo/> | |||||
| } | |||||
| {props.isAdmin ? <LogoAdmin /> : <Logo />} | |||||
| <LoginTitle isAdmin={props.isAdmin} /> | <LoginTitle isAdmin={props.isAdmin} /> | ||||
| <LoginDescription isAdmin={props.isAdmin}/> | |||||
| <LoginDescription isAdmin={props.isAdmin} /> | |||||
| <LoginFormContainer component="form" onSubmit={handleSubmitForm}> | <LoginFormContainer component="form" onSubmit={handleSubmitForm}> | ||||
| <EmailField formik={formik} /> | <EmailField formik={formik} /> | ||||
| <PasswordField formik={formik} ref={passwordRef} /> | <PasswordField formik={formik} ref={passwordRef} /> | ||||
| <ErrorMessage formik={formik} /> | <ErrorMessage formik={formik} /> | ||||
| {!props.isAdmin ? <ForgotPasswordLink/>:<></>} | |||||
| {!props.isAdmin ? <ForgotPasswordLink /> : <></>} | |||||
| <LoginButton formik={formik} /> | <LoginButton formik={formik} /> | ||||
| {!props.isAdmin ? <RegisterLink/>:<></>} | |||||
| {!props.isAdmin ? <RegisterLink /> : <></>} | |||||
| </LoginFormContainer> | </LoginFormContainer> | ||||
| </LoginPageContainer> | </LoginPageContainer> | ||||
| ); | ); | ||||
| pathname: PropTypes.string, | pathname: PropTypes.string, | ||||
| }), | }), | ||||
| }), | }), | ||||
| isAdmin: PropTypes.bool | |||||
| isAdmin: PropTypes.bool, | |||||
| }; | }; | ||||
| export default Login; | export default Login; |
| import { Box, Container } from "@mui/material"; | |||||
| import styled from "styled-components"; | import styled from "styled-components"; | ||||
| import { Box, Container } from "@mui/material"; | |||||
| import { ReactComponent as AdminLogo } from "../../assets/images/svg/logo-vertical-admin.svg"; | |||||
| export const LoginPageContainer = styled(Container)` | export const LoginPageContainer = styled(Container)` | ||||
| margin-top: 150px; | margin-top: 150px; | ||||
| @media (max-height: 800px) { | @media (max-height: 800px) { | ||||
| margin-top: 70px; | margin-top: 70px; | ||||
| } | } | ||||
| @media (max-width: 320px) { | |||||
| margin-top: 30px; | |||||
| } | |||||
| `; | `; | ||||
| export const LogoAdmin = styled(AdminLogo)``; | |||||
| export const LoginFormContainer = styled(Box)` | export const LoginFormContainer = styled(Box)` | ||||
| width: 335px; | width: 335px; | ||||
| height: 216px; | height: 216px; | ||||
| @media (max-width: 320px) { | |||||
| width: 100%; | |||||
| } | |||||
| `; | `; |
| import { sortEnum } from "../../../enums/sortEnum"; | import { sortEnum } from "../../../enums/sortEnum"; | ||||
| import { useTranslation } from "react-i18next"; | import { useTranslation } from "react-i18next"; | ||||
| import SkeletonHeader from "./SkeletonHeader/SkeletonHeader"; | import SkeletonHeader from "./SkeletonHeader/SkeletonHeader"; | ||||
| import useIsMobile from "../../../hooks/useIsMobile"; | |||||
| import useIsTablet from "../../../hooks/useIsTablet"; | |||||
| // import { ArrowButton } from "../../Buttons/ArrowButton/ArrowButton"; | // import { ArrowButton } from "../../Buttons/ArrowButton/ArrowButton"; | ||||
| import TooltipHeader from "./TooltipHeader/TooltipHeader"; | import TooltipHeader from "./TooltipHeader/TooltipHeader"; | ||||
| import GridButtons from "./GridButtons/GridButtons"; | import GridButtons from "./GridButtons/GridButtons"; | ||||
| import HeaderSelect from "./HeaderSelect/HeaderSelect"; | import HeaderSelect from "./HeaderSelect/HeaderSelect"; | ||||
| // import HeaderTitle from "../../Profile/ProfileOffers/HeaderTitle/HeaderTitle"; | |||||
| const Header = (props) => { | const Header = (props) => { | ||||
| const { t } = useTranslation(); | const { t } = useTranslation(); | ||||
| const sorting = props?.sorting; | const sorting = props?.sorting; | ||||
| const { isMobile } = useIsMobile(); | |||||
| const { isTablet } = useIsTablet(); | |||||
| // Changing header string on refresh or on load | // Changing header string on refresh or on load | ||||
| const altString = useMemo(() => { | const altString = useMemo(() => { | ||||
| ? t("admin.subcategories.headerTitle") | ? t("admin.subcategories.headerTitle") | ||||
| : props.location | : props.location | ||||
| ? t("admin.locations.headerTitle") | ? t("admin.locations.headerTitle") | ||||
| : !isMobile | |||||
| : !isTablet | |||||
| ? t("header.myOffers") | ? t("header.myOffers") | ||||
| : props.myOffers | : props.myOffers | ||||
| ? t("header.myOffers") | ? t("header.myOffers") | ||||
| : t("offer.offers"); | : t("offer.offers"); | ||||
| }, [props, t, isMobile]); | |||||
| }, [props, t, isTablet]); | |||||
| const headerIcon = useMemo(() => { | const headerIcon = useMemo(() => { | ||||
| return props.users ? ( | return props.users ? ( | ||||
| <UserIcon /> | <UserIcon /> | ||||
| <SubcategoryIcon /> | <SubcategoryIcon /> | ||||
| ) : props.location ? ( | ) : props.location ? ( | ||||
| <LocationIcon /> | <LocationIcon /> | ||||
| ) : isMobile ? ( | |||||
| ) : isTablet ? ( | |||||
| <SwapsIcon /> | <SwapsIcon /> | ||||
| ) : ( | ) : ( | ||||
| <SwapsHeaderIcon /> | <SwapsHeaderIcon /> | ||||
| myOffers={props?.myOffers} | myOffers={props?.myOffers} | ||||
| hideBackButton={props?.hideBackButton} | hideBackButton={props?.hideBackButton} | ||||
| /> | /> | ||||
| {/* <HeaderTitle isMyProfile={props?.myOffers} /> */} | |||||
| {/* ^^^^^^ */} | {/* ^^^^^^ */} | ||||
| <HeaderOptions> | <HeaderOptions> | ||||
| {/* ^^^^^^ */} | {/* ^^^^^^ */} | ||||
| </HeaderOptions> | </HeaderOptions> | ||||
| </HeaderContainer> | </HeaderContainer> | ||||
| {isMobile && ( | |||||
| {isTablet && ( | |||||
| <PageTitleContainer> | <PageTitleContainer> | ||||
| {headerIcon} | {headerIcon} | ||||
| <SwapsTitle>{headerTitle}</SwapsTitle> | <SwapsTitle>{headerTitle}</SwapsTitle> |
| flex-direction: row; | flex-direction: row; | ||||
| flex: 1; | flex: 1; | ||||
| justify-content: end; | justify-content: end; | ||||
| @media (max-width: 320px) { | |||||
| width: 180px; | |||||
| } | |||||
| `; | `; | ||||
| export const IconStyled = styled(Box)` | export const IconStyled = styled(Box)` |
| } | } | ||||
| onChange={handleChangeSelect} | onChange={handleChangeSelect} | ||||
| myOffers={props?.myOffers} | myOffers={props?.myOffers} | ||||
| isMyOffers={props?.isMyOffers} | |||||
| > | > | ||||
| <SelectOption style={{ display: "none" }} value="default"> | <SelectOption style={{ display: "none" }} value="default"> | ||||
| {t("reviews.sortBy")} | {t("reviews.sortBy")} | ||||
| sorting: PropTypes.any, | sorting: PropTypes.any, | ||||
| myOffers: PropTypes.bool, | myOffers: PropTypes.bool, | ||||
| hideSorting: PropTypes.bool, | hideSorting: PropTypes.bool, | ||||
| isMyOffers: PropTypes.bool, | |||||
| }; | }; | ||||
| HeaderSelect.defaultProps = { | HeaderSelect.defaultProps = { | ||||
| myOffers: false, | myOffers: false, |
| position: relative; | position: relative; | ||||
| left: -5px; | left: -5px; | ||||
| background-color: white; | background-color: white; | ||||
| display: ${(props) => props.hideSorting && "none"}; | |||||
| /* display: ${(props) => props.hideSorting && "none"}; */ | |||||
| & div:first-child { | & div:first-child { | ||||
| padding-left: 8px; | padding-left: 8px; | ||||
| } | } | ||||
| @media (max-width: 650px) { | |||||
| ${(props) => | |||||
| !props.isMyOffers | |||||
| ? ` | |||||
| @media (max-width: 600px) { | |||||
| width: 144px; | width: 144px; | ||||
| height: 30px; | height: 30px; | ||||
| font-size: 14px; | font-size: 14px; | ||||
| top: 60px; | top: 60px; | ||||
| left: ${(props) => (props.myOffers ? "-7px" : "0")}; | left: ${(props) => (props.myOffers ? "-7px" : "0")}; | ||||
| } | } | ||||
| ` | |||||
| : ` | |||||
| @media (max-width: 600px) { | |||||
| width: 144px; | |||||
| height: 30px; | |||||
| font-size: 14px; | |||||
| } | |||||
| `} | |||||
| `; | `; | ||||
| export const SelectItem = styled(MenuItem)` | export const SelectItem = styled(MenuItem)` | ||||
| font-family: ${selectedTheme.fonts.textFont}; | font-family: ${selectedTheme.fonts.textFont}; |
| width: 100%; | width: 100%; | ||||
| white-space: nowrap; | white-space: nowrap; | ||||
| overflow: hidden; | overflow: hidden; | ||||
| text-overflow: ellipsis; | |||||
| /* text-overflow: ellipsis; */ | |||||
| & * { | & * { | ||||
| display: inline; | display: inline; | ||||
| } | } |
| isAdmin={props.isAdmin} | isAdmin={props.isAdmin} | ||||
| users={props.users} | users={props.users} | ||||
| /> | /> | ||||
| <Offers | <Offers | ||||
| isGrid={isGrid} | isGrid={isGrid} | ||||
| myOffers={props.myOffers} | myOffers={props.myOffers} |
| line-height: 15px; | line-height: 15px; | ||||
| text-align: center; | text-align: center; | ||||
| } | } | ||||
| @media (min-width: 600px) { | @media (min-width: 600px) { | ||||
| display: none; | display: none; | ||||
| } | } | ||||
| `; | `; | ||||
| export const FilterIcon = styled(Filter)` | export const FilterIcon = styled(Filter)` | ||||
| background-color: ${selectedTheme.colors.primaryBackgroundColor}; | background-color: ${selectedTheme.colors.primaryBackgroundColor}; | ||||
| `; | |||||
| `; |
| @media screen and (max-width: 480px) { | @media screen and (max-width: 480px) { | ||||
| width: 340px; | width: 340px; | ||||
| } | } | ||||
| @media screen and (max-width: 360px) { | |||||
| width: 300px; | |||||
| } | |||||
| `; | `; | ||||
| export const Arrow = styled(IconButton)` | export const Arrow = styled(IconButton)` | ||||
| border: 1px solid ${selectedTheme.colors.primaryPurple}; | border: 1px solid ${selectedTheme.colors.primaryPurple}; |
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| margin-bottom: 0; | margin-bottom: 0; | ||||
| } | } | ||||
| @media (max-width: 360px) { | |||||
| width: 100%; | |||||
| } | |||||
| @media (max-width: 345px) { | |||||
| max-width: 300px; | |||||
| margin: auto; | |||||
| } | |||||
| `; | `; | ||||
| export const StepLine = styled(Box)` | export const StepLine = styled(Box)` |
| import { useEffect, useState } from "react"; | |||||
| function getScreenWidth() { | |||||
| return window.innerWidth; | |||||
| } | |||||
| const useIsTablet = () => { | |||||
| const [isTablet, setIsTablet] = useState(window.innerWidth < 900); | |||||
| useEffect(() => { | |||||
| const resize = () => { | |||||
| if (getScreenWidth() < 900) { | |||||
| setIsTablet(true); | |||||
| } else { | |||||
| setIsTablet(false); | |||||
| } | |||||
| }; | |||||
| window.addEventListener("resize", resize); | |||||
| resize(); | |||||
| return () => window.removeEventListener("resize", resize); | |||||
| }, []); | |||||
| return { isTablet }; | |||||
| }; | |||||
| export default useIsTablet; |
| mineProfileBlocked: "Vaš profil je trenutno blokiran.", | mineProfileBlocked: "Vaš profil je trenutno blokiran.", | ||||
| deletedProfile: "Obrisan profil", | deletedProfile: "Obrisan profil", | ||||
| admin: "Administrator", | admin: "Administrator", | ||||
| adminPanel: "Admin Panel", | |||||
| }, | }, | ||||
| about: { | about: { | ||||
| header: { | header: { |
| export const AdminCategoriesPageContainer = styled(Box)` | export const AdminCategoriesPageContainer = styled(Box)` | ||||
| padding: 60px; | padding: 60px; | ||||
| padding-top: 38px; | |||||
| padding-top: 38px; | |||||
| min-height: 100vh; | min-height: 100vh; | ||||
| padding-bottom: 100px; | padding-bottom: 100px; | ||||
| position: relative; | position: relative; | ||||
| `; | `; | ||||
| export const AdminCategoriesSearchField = styled(SearchField)` | export const AdminCategoriesSearchField = styled(SearchField)` | ||||
| top: -15px; | top: -15px; | ||||
| @media (max-width: 900px) { | |||||
| margin-top: 72px; | |||||
| } | |||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| display: none; | display: none; | ||||
| } | } | ||||
| bottom: 18px; | bottom: 18px; | ||||
| right: 16px; | right: 16px; | ||||
| } | } | ||||
| ` | |||||
| `; | |||||
| export const CategoriesList = styled(Box)` | export const CategoriesList = styled(Box)` | ||||
| /* padding-top: 10px */ | /* padding-top: 10px */ | ||||
| ` | |||||
| `; |
| } | } | ||||
| `; | `; | ||||
| export const LocationsList = styled(Box)` | export const LocationsList = styled(Box)` | ||||
| padding-top: 10px; | |||||
| ` | |||||
| padding-top: 10px; | |||||
| `; | |||||
| export const AdminLocationsSearchField = styled(SearchField)` | export const AdminLocationsSearchField = styled(SearchField)` | ||||
| top: -15px; | top: -15px; | ||||
| @media (max-width: 900px) { | |||||
| margin-top: 72px; | |||||
| } | |||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| display: none; | display: none; | ||||
| } | } |
| fetchAllProfilesAsAdmin({ | fetchAllProfilesAsAdmin({ | ||||
| currentPage: paging.currentPage, | currentPage: paging.currentPage, | ||||
| searchValue: searchValue, | searchValue: searchValue, | ||||
| sortOption: sorting.selectedSortOptionLocally | |||||
| sortOption: sorting.selectedSortOptionLocally, | |||||
| }) | }) | ||||
| ); | ); | ||||
| }, [paging.currentPage, searchValue, sorting.selectedSortOptionLocally]); | }, [paging.currentPage, searchValue, sorting.selectedSortOptionLocally]); |
| `; | `; | ||||
| export const AdminUsersSearchField = styled(SearchField)` | export const AdminUsersSearchField = styled(SearchField)` | ||||
| top: -15px; | top: -15px; | ||||
| @media (max-width: 900px) { | |||||
| margin-top: 72px; | |||||
| } | |||||
| @media (max-width: 600px) { | @media (max-width: 600px) { | ||||
| display: none; | display: none; | ||||
| } | } |
| export const FormContainer = styled(Box)` | export const FormContainer = styled(Box)` | ||||
| width: 335px; | width: 335px; | ||||
| height: 216px; | height: 216px; | ||||
| @media (max-width: 345px) { | |||||
| width: 300px; | |||||
| } | |||||
| `; | `; | ||||
| export const ErrorMessage = styled(Typography)` | export const ErrorMessage = styled(Typography)` | ||||
| color: red; | color: red; | ||||
| position: relative; | position: relative; | ||||
| top: -7px; | top: -7px; | ||||
| font-size: 14px; | font-size: 14px; | ||||
| ` | |||||
| `; | |||||
| export const LoginAltText = styled(Typography)` | export const LoginAltText = styled(Typography)` | ||||
| font-family: ${selectedTheme.fonts.textFont}; | font-family: ${selectedTheme.fonts.textFont}; | ||||
| color: ${selectedTheme.colors.primaryText}; | color: ${selectedTheme.colors.primaryText}; |
| export const FormContainer = styled.form` | export const FormContainer = styled.form` | ||||
| width: 335px; | width: 335px; | ||||
| @media (max-width: 345px) { | |||||
| width: 300px; | |||||
| } | |||||
| `; | `; | ||||
| export const RegisterDescription = styled(Typography)` | export const RegisterDescription = styled(Typography)` | ||||
| font-family: ${selectedTheme.fonts.textFont}; | font-family: ${selectedTheme.fonts.textFont}; | ||||
| @media (max-height: 800px) { | @media (max-height: 800px) { | ||||
| margin-top: 14px; | margin-top: 14px; | ||||
| } | } | ||||
| `; | `; | ||||
| export const ErrorMessage = styled(Typography)` | export const ErrorMessage = styled(Typography)` | ||||
| color: red; | color: red; | ||||
| position: relative; | position: relative; | ||||
| top: -7px; | top: -7px; | ||||
| font-size: 14px; | font-size: 14px; | ||||
| ` | |||||
| `; |
| import styled from "styled-components"; | import styled from "styled-components"; | ||||
| import selectedTheme from "../../../../themes"; | import selectedTheme from "../../../../themes"; | ||||
| export const FormContainer = styled.form` | export const FormContainer = styled.form` | ||||
| width: 335px; | width: 335px; | ||||
| @media (max-width: 345px) { | |||||
| width: 300px; | |||||
| } | |||||
| `; | `; | ||||
| export const RegisterDescription = styled(Typography)` | export const RegisterDescription = styled(Typography)` | ||||
| font-family: ${selectedTheme.fonts.textFont}; | font-family: ${selectedTheme.fonts.textFont}; | ||||
| position: relative; | position: relative; | ||||
| top: -7px; | top: -7px; | ||||
| font-size: 14px; | font-size: 14px; | ||||
| ` | |||||
| `; |
| export const FormContainer = styled.form` | export const FormContainer = styled.form` | ||||
| width: 335px; | width: 335px; | ||||
| @media (max-width: 345px) { | |||||
| width: 300px; | |||||
| } | |||||
| `; | `; | ||||
| export const RegisterDescription = styled(Typography)` | export const RegisterDescription = styled(Typography)` | ||||
| font-family: ${selectedTheme.fonts.textFont}; | font-family: ${selectedTheme.fonts.textFont}; | ||||
| margin-top: 14px; | margin-top: 14px; | ||||
| } | } | ||||
| `; | `; | ||||