2022-06-08 13:40:22 +00:00
|
|
|
import React from "react";
|
2022-06-26 09:43:08 +00:00
|
|
|
import PropTypes, { number } from "prop-types";
|
2022-06-08 13:40:22 +00:00
|
|
|
import { ReactSVG } from "react-svg";
|
|
|
|
|
2022-06-26 09:43:08 +00:00
|
|
|
import { RoomsType } from "@appserver/common/constants";
|
|
|
|
|
2022-06-08 13:40:22 +00:00
|
|
|
import StyledLogoContainer from "./styled-room-logo";
|
|
|
|
|
2022-06-26 09:43:08 +00:00
|
|
|
const RoomLogo = ({ id, className, style, type, isPrivacy, isArchive }) => {
|
|
|
|
console.log(type);
|
2022-06-08 13:40:22 +00:00
|
|
|
const getIcon = () => {
|
2022-06-26 09:43:08 +00:00
|
|
|
if (isArchive) {
|
|
|
|
return isPrivacy
|
|
|
|
? "/static/images/room.privacy.archive.svg"
|
|
|
|
: "/static/images/room.archive.svg";
|
|
|
|
}
|
|
|
|
|
2022-06-08 13:40:22 +00:00
|
|
|
switch (type) {
|
2022-06-26 09:43:08 +00:00
|
|
|
case RoomsType.ReadOnlyRoom:
|
2022-06-08 13:40:22 +00:00
|
|
|
return isPrivacy
|
2022-06-10 11:58:38 +00:00
|
|
|
? "/static/images/room.privacy.view.svg"
|
|
|
|
: "/static/images/room.view.svg";
|
2022-06-26 09:43:08 +00:00
|
|
|
case RoomsType.ReviewRoom:
|
2022-06-08 13:40:22 +00:00
|
|
|
return isPrivacy
|
2022-06-10 11:58:38 +00:00
|
|
|
? "/static/images/room.privacy.review.svg"
|
|
|
|
: "/static/images/room.review.svg";
|
2022-06-26 09:43:08 +00:00
|
|
|
case RoomsType.FillingFormsRoom:
|
2022-06-08 13:40:22 +00:00
|
|
|
return isPrivacy
|
2022-06-10 11:58:38 +00:00
|
|
|
? "/static/images/room.privacy.fill.svg"
|
|
|
|
: "/static/images/room.fill.svg";
|
2022-06-26 09:43:08 +00:00
|
|
|
case RoomsType.EditingRoom:
|
2022-06-08 13:40:22 +00:00
|
|
|
return isPrivacy
|
2022-06-10 11:58:38 +00:00
|
|
|
? "/static/images/room.privacy.editing.svg"
|
|
|
|
: "/static/images/room.editing.svg";
|
2022-06-26 09:43:08 +00:00
|
|
|
case RoomsType.CustomRoom:
|
2022-06-08 13:40:22 +00:00
|
|
|
return isPrivacy
|
2022-06-10 11:58:38 +00:00
|
|
|
? "/static/images/room.privacy.custom.svg"
|
|
|
|
: "/static/images/room.custom.svg";
|
2022-06-26 09:43:08 +00:00
|
|
|
default:
|
2022-06-08 13:40:22 +00:00
|
|
|
return isPrivacy
|
2022-06-26 09:43:08 +00:00
|
|
|
? "/static/images/room.privacy.custom.svg"
|
|
|
|
: "/static/images/room.custom.svg";
|
2022-06-08 13:40:22 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const icon = getIcon();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<StyledLogoContainer
|
|
|
|
id={id}
|
|
|
|
className={className}
|
|
|
|
style={style}
|
|
|
|
type={type}
|
|
|
|
isPrivacy={isPrivacy}
|
2022-06-26 09:43:08 +00:00
|
|
|
isArchive={isArchive}
|
2022-06-08 13:40:22 +00:00
|
|
|
>
|
|
|
|
<ReactSVG className="room-logo_icon" src={icon} />
|
|
|
|
</StyledLogoContainer>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
RoomLogo.defaultProps = {
|
|
|
|
isPrivacy: false,
|
|
|
|
};
|
|
|
|
|
|
|
|
RoomLogo.propTypes = {
|
|
|
|
/** Accepts type of the room */
|
2022-06-26 09:43:08 +00:00
|
|
|
type: PropTypes.number,
|
2022-06-08 13:40:22 +00:00
|
|
|
/** Add privacy icon */
|
|
|
|
isPrivacy: PropTypes.bool,
|
|
|
|
/** Accepts id */
|
|
|
|
id: PropTypes.string,
|
|
|
|
/** Accepts class name */
|
|
|
|
className: PropTypes.string,
|
|
|
|
/** Accepts css style */
|
|
|
|
style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
|
|
|
};
|
|
|
|
|
|
|
|
export default React.memo(RoomLogo);
|