You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SidebarProfile.js 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import React from "react";
  2. import PropTypes from "prop-types";
  3. import {
  4. SidebarProfileContainer,
  5. SidebarProfileImage,
  6. SidebarProfileName,
  7. SidebarProfileRole,
  8. } from "./SidebarProfile.styled";
  9. import { getImageUrl, variants } from "../../../../util/helpers/imageUrlGetter";
  10. import useIsMobile from "../../../../hooks/useIsMobile";
  11. import { useTranslation } from "react-i18next";
  12. import { useSelector } from "react-redux";
  13. import { selectMineProfile } from "../../../../store/selectors/profileSelectors";
  14. const SidebarProfile = () => {
  15. const { isMobile } = useIsMobile();
  16. const profile = useSelector(selectMineProfile);
  17. const { t } = useTranslation();
  18. return (
  19. <SidebarProfileContainer>
  20. <SidebarProfileImage
  21. src={getImageUrl(profile.image, variants.profileImage, isMobile)}
  22. />
  23. <SidebarProfileName>{profile.company.name}</SidebarProfileName>
  24. <SidebarProfileRole>{t("admin.navigation.role")}</SidebarProfileRole>
  25. </SidebarProfileContainer>
  26. );
  27. };
  28. SidebarProfile.propTypes = {
  29. profile: PropTypes.shape({
  30. image: PropTypes.string,
  31. company: PropTypes.shape({
  32. name: PropTypes.string,
  33. }),
  34. }),
  35. };
  36. export default SidebarProfile;