Prevent Tooltip from displaying when Sidebar toggles between The Home sidebar and the Personal sidebar while closed
This commit is contained in:
@@ -3,7 +3,7 @@ import { chakra, useSlotRecipe } from "@chakra-ui/react";
|
|||||||
|
|
||||||
|
|
||||||
export default function Tooltip ({tooltipkey, content, sidebarIsOpen, children}) {
|
export default function Tooltip ({tooltipkey, content, sidebarIsOpen, children}) {
|
||||||
const [isVisible, setIsVisible] = useState(!sidebarIsOpen);
|
const [isVisible, setIsVisible] = useState(false);
|
||||||
const recipe = useSlotRecipe({ key: "sidebar" });
|
const recipe = useSlotRecipe({ key: "sidebar" });
|
||||||
const styles = recipe();
|
const styles = recipe();
|
||||||
const timeoutId = useRef(null);
|
const timeoutId = useRef(null);
|
||||||
|
|||||||
@@ -19,21 +19,21 @@ export default function Sidebar({ view, onChangeView, darkMode, setDarkMode }) {
|
|||||||
const styles = recipe();
|
const styles = recipe();
|
||||||
const { toggleColorMode } = useColorMode();
|
const { toggleColorMode } = useColorMode();
|
||||||
|
|
||||||
// this list of btns will come from the db (not every usr will have access to admin)
|
let buttons = [];
|
||||||
let buttons = [
|
|
||||||
{icon: FaHome, name: "Home", view: "mydashboard"},
|
|
||||||
{icon: FaGlobeAmericas, name: "Global Map", view: "global"},
|
|
||||||
{icon: FaMapMarkerAlt, name: "Regional Map", view: "regional"},
|
|
||||||
{icon: FaVolcano, name: "Volcano", view: "volcano"},
|
|
||||||
{icon: HiUsers, name: "Admin", view: "admin"}
|
|
||||||
];
|
|
||||||
|
|
||||||
// Different Sidebar Button Options for Settings View
|
// Different Sidebar Button Options for Settings View
|
||||||
if (view === "settings" || view === "personal" || view === "security") {
|
if (view === "settings" || view === "personal" || view === "security") {
|
||||||
buttons = [
|
buttons = [
|
||||||
{icon: IoPersonCircleSharp, name: "Personal Info", view: "personal"},
|
{icon: IoPersonCircleSharp, name: "Personal Info", view: "personal"},
|
||||||
{icon: MdOutlineSecurity, name: "Security", view: "security"},
|
{icon: MdOutlineSecurity, name: "Security", view: "security"},
|
||||||
]
|
]
|
||||||
|
} else {
|
||||||
|
buttons = [
|
||||||
|
{icon: FaHome, name: "Home", view: "mydashboard"},
|
||||||
|
{icon: FaGlobeAmericas, name: "Global Map", view: "global"},
|
||||||
|
{icon: FaMapMarkerAlt, name: "Regional Map", view: "regional"},
|
||||||
|
{icon: FaVolcano, name: "Volcano", view: "volcano"},
|
||||||
|
{icon: HiUsers, name: "Admin", view: "admin"}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
const toggleSidebar = () => {
|
const toggleSidebar = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user