2022-07-12 21:49:11 +00:00
|
|
|
import React from "react";
|
|
|
|
|
2022-07-13 20:02:37 +00:00
|
|
|
import VideoComponent from "../VideoTag/VideoComponent";
|
|
|
|
|
|
|
|
import { ReactComponent as Tickets } from "../../assets/icons/Menu/Whatsapp.svg";
|
|
|
|
import { ReactComponent as Contact } from "../../assets/icons/Menu/Contact.svg";
|
|
|
|
import { ReactComponent as Reminder } from "../../assets/icons/Menu/Send.svg";
|
|
|
|
import { ReactComponent as FastAanswer } from "../../assets/icons/Menu/Mensage.svg";
|
2022-07-12 21:49:11 +00:00
|
|
|
|
2022-07-13 20:02:37 +00:00
|
|
|
import { ReactComponent as Users } from "../../assets/icons/Menu/Peoplealt.svg";
|
|
|
|
import { ReactComponent as Rows } from "../../assets/icons/Menu/Accounttree.svg";
|
|
|
|
import { ReactComponent as Conetions } from "../../assets/icons/Menu/Swap.svg";
|
|
|
|
import { ReactComponent as Dashboard } from "../../assets/icons/Menu/Dashboard.svg";
|
|
|
|
import { ReactComponent as FastResumes } from "../../assets/icons/Menu/Graph.svg";
|
|
|
|
import { ReactComponent as Super } from "../../assets/icons/Menu/Super.svg";
|
|
|
|
|
|
|
|
import { ReactComponent as Configuration } from "../../assets/icons/Menu/Configuration.svg";
|
|
|
|
|
|
|
|
import { MenuStyled, MenuListStyled, MenuListItemStyled } from "./MenuComponent.style";
|
2022-07-12 21:49:11 +00:00
|
|
|
import { WhatsAppsContext } from "../../context/WhatsApp/WhatsAppsContext";
|
|
|
|
import { AuthContext } from "../../context/Auth/AuthContext";
|
2022-07-13 20:02:37 +00:00
|
|
|
|
|
|
|
import img from "../../assets/images/Logo.png";
|
|
|
|
import MenuItem from "./MenuItem";
|
2022-07-12 21:49:11 +00:00
|
|
|
|
|
|
|
const MenuComponent = () => {
|
2022-07-13 20:02:37 +00:00
|
|
|
const [hover, setHover] = React.useState(false);
|
2022-07-12 21:49:11 +00:00
|
|
|
const { whatsApps } = React.useContext(WhatsAppsContext);
|
|
|
|
const { user } = React.useContext(AuthContext);
|
|
|
|
const [connectionWarning, setConnectionWarning] = React.useState(false);
|
|
|
|
|
2022-07-13 20:02:37 +00:00
|
|
|
const HoverMenu = () => {
|
|
|
|
setHover(!hover);
|
|
|
|
};
|
|
|
|
|
2022-07-12 21:49:11 +00:00
|
|
|
React.useEffect(() => {
|
|
|
|
const delayDebounceFn = setTimeout(() => {
|
|
|
|
if (whatsApps.length > 0) {
|
|
|
|
const offlineWhats = whatsApps.filter((whats) => {
|
|
|
|
return (
|
|
|
|
whats.status === "qrcode" ||
|
|
|
|
whats.status === "PAIRING" ||
|
|
|
|
whats.status === "DISCONNECTED" ||
|
|
|
|
whats.status === "TIMEOUT" ||
|
|
|
|
whats.status === "OPENING"
|
|
|
|
);
|
|
|
|
});
|
|
|
|
if (offlineWhats.length > 0) {
|
|
|
|
setConnectionWarning(true);
|
|
|
|
} else {
|
|
|
|
setConnectionWarning(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, 2000);
|
|
|
|
return () => clearTimeout(delayDebounceFn);
|
|
|
|
}, [whatsApps]);
|
|
|
|
|
|
|
|
return (
|
2022-07-13 20:02:37 +00:00
|
|
|
<MenuStyled onMouseEnter={HoverMenu} onMouseLeave={HoverMenu} hover={hover}>
|
2022-07-12 21:49:11 +00:00
|
|
|
<VideoComponent width={"100%"} zIndex={"-1"} position={"absolute"} />
|
2022-07-13 20:02:37 +00:00
|
|
|
|
|
|
|
{/*Menu Top Header*/}
|
|
|
|
<div style={{ display: "flex", flexDirection: "row", width: "100%" }}>
|
|
|
|
<div style={{ width: "76px", backgroundColor: "white" }}>
|
|
|
|
<img src={img} alt="" style={{ width: "100%" }} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{/*Menu Top Header*/}
|
|
|
|
|
2022-07-12 21:49:11 +00:00
|
|
|
<MenuListStyled>
|
2022-07-13 20:02:37 +00:00
|
|
|
{/* <MenuItem icon={<Whatsapp />} to="/tickets" text="Tickets" hover={hover} /> */}
|
|
|
|
<MenuItem icon={<Tickets />} text="Tickets" to="" hover={hover} />
|
|
|
|
<MenuItem icon={<Contact />} text="Contatos" to="" hover={hover} />
|
|
|
|
<MenuItem icon={<Reminder />} text="Lembretes" to="" hover={hover} />
|
|
|
|
<MenuItem icon={<FastAanswer />} text="Respostas" to="" hover={hover} />
|
|
|
|
<br />
|
|
|
|
<MenuItem icon={<Users />} text="Usuários" to="" hover={hover} />
|
|
|
|
<MenuItem icon={<Rows />} text="Filas" to="" hover={hover} />
|
|
|
|
<MenuItem icon={<Conetions />} text="Conexões" to="" hover={hover} />
|
|
|
|
<MenuItem icon={<Dashboard />} text="Dashboard" to="" hover={hover} />
|
|
|
|
<MenuItem icon={<FastResumes />} text="Relatórios" to="" hover={hover} />
|
|
|
|
<MenuItem icon={<Super />} text="Supervisão" to="" hover={hover} />
|
|
|
|
<br />
|
|
|
|
<MenuItem icon={<Configuration />} text="Configurações" to="" hover={hover} />
|
2022-07-12 21:49:11 +00:00
|
|
|
</MenuListStyled>
|
|
|
|
</MenuStyled>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default MenuComponent;
|
|
|
|
|