import * as React from 'react'; import { useState } from 'react'; import { Link, NavLink } from 'react-router-dom'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faCogs, faLayerGroup, faSignOutAlt, faUserCircle } from '@fortawesome/free-solid-svg-icons'; import { useStoreState } from 'easy-peasy'; import { ApplicationStore } from '@/state'; import SearchContainer from '@/components/dashboard/search/SearchContainer'; import tw, { theme } from 'twin.macro'; import styled from 'styled-components/macro'; import http from '@/api/http'; import SpinnerOverlay from '@/components/elements/SpinnerOverlay'; import Tooltip from '@/components/elements/tooltip/Tooltip'; const RightNavigation = styled.div` & > a, & > button, & > .navigation-link { ${tw`flex items-center h-full no-underline text-neutral-300 px-6 cursor-pointer transition-all duration-150`}; &:active, &:hover { ${tw`text-neutral-100 bg-black`}; } &:active, &:hover, &.active { box-shadow: inset 0 -2px ${theme`colors.cyan.600`.toString()}; } } `; export default () => { const name = useStoreState((state: ApplicationStore) => state.settings.data!.name); const rootAdmin = useStoreState((state: ApplicationStore) => state.user.data!.rootAdmin); const [ isLoggingOut, setIsLoggingOut ] = useState(false); const onTriggerLogout = () => { setIsLoggingOut(true); http.post('/auth/logout').finally(() => { // @ts-ignore window.location = '/'; }); }; return (
{name}
{rootAdmin && }
); };