import React, {useState} from 'react'; import {BrowserView, MobileView} from "react-device-detect"; import {Link} from 'react-router-dom'; import List from '@material-ui/core/List'; import ListItem from '@material-ui/core/ListItem'; import MenuItem from '@material-ui/core/MenuItem'; import Select from '@material-ui/core/Select'; import Button from '@material-ui/core/Button'; import HomeIcon from '@material-ui/icons/Home'; import PolymerIcon from '@material-ui/icons/Polymer'; import AppsIcon from '@material-ui/icons/Apps'; import DescriptionIcon from '@material-ui/icons/Description'; import Grid from '@material-ui/core/Grid'; import { useTheme } from '@material-ui/core/styles'; const hoverColor = "#f85a3e" const hoverOutColor = "#e8eaf6" const Header = props => { const { globalUrl, isLoggedIn, removeCookie, homePage, isLoaded, userdata, cookies } = props; const theme = useTheme(); const [HomeHoverColor, setHomeHoverColor] = useState(hoverOutColor); const [SoarHoverColor, setSoarHoverColor] = useState(hoverOutColor); const [LoginHoverColor, setLoginHoverColor] = useState(hoverOutColor); const [DocsHoverColor, setDocsHoverColor] = useState(hoverOutColor); const [HelpHoverColor, setHelpHoverColor] = useState(hoverOutColor); const hrefStyle = { color: hoverOutColor, textDecoration: "none", } // DEBUG HERE const handleClickLogout = () => { console.log("COOKIES: ", cookies, "Remover: ", removeCookie) // Don't really care about the logout fetch(globalUrl+"/api/v1/logout", { credentials: "include", method: 'POST', headers: { 'Content-Type': 'application/json', }, }) .then(() => { // Log out anyway //cookies.remove("session_token") //window.location.pathname = "/" console.log("Should've logged out") removeCookie("session_token", {path: "/"}) removeCookie("session_token", {path: "/workflows"}) window.location.reload() }) .catch(error => { console.log("Error in logout: ", error) removeCookie("session_token", {path: "/"}) window.location.reload() //removeCookie("session_token", {path: "/"}) }) } // Rofl this is weird const handleDocsHover = () => { setDocsHoverColor(hoverColor) } const handleDocsHoverOut = () => { setDocsHoverColor(hoverOutColor) } const handleHomeHover = () => { setHomeHoverColor(hoverColor) } const handleHelpHover = () => { setHelpHoverColor(hoverColor) } const handleHelpHoverOut = () => { setHelpHoverColor(hoverOutColor) } const handleSoarHover = () => { setSoarHoverColor(hoverColor) } const handleSoarHoverOut = () => { setSoarHoverColor(hoverOutColor) } const handleHomeHoverOut = () => { setHomeHoverColor(hoverOutColor) } const handleLoginHover = () => { setLoginHoverColor(hoverColor) } const handleLoginHoverOut = () => { setLoginHoverColor(hoverOutColor) } // Should be based on some path const logoCheck = !homePage ? null : null // Handle top bar or something const loginTextBrowser = !isLoggedIn ?