Skip to content
Snippets Groups Projects
NavBar.component.tsx 2.55 KiB
Newer Older
import logoImg from '@/assets/vectors/branding/logo.svg';
import luxembourgLogoImg from '@/assets/vectors/branding/luxembourg-logo.svg';
import { API_DOCS_URL, MINERVA_WEBSITE_URL } from '@/constants';
import { openDrawer } from '@/redux/drawer/drawer.slice';
import { useAppDispatch } from '@/redux/hooks/useAppDispatch';
import { openLegend } from '@/redux/legend/legend.slice';
import { openLoginModal } from '@/redux/modal/modal.slice';
import { openPluginsDrawer } from '@/redux/plugins/plugins.slice';
import { IconButton } from '@/shared/IconButton';
import Image from 'next/image';
export const NavBar = (): JSX.Element => {
  const dispatch = useAppDispatch();

  const openDrawerInfo = (): void => {
    dispatch(openDrawer('project-info'));
  };

  const openDrawerPlugins = (): void => {
    dispatch(openDrawer('available-plugins'));
    dispatch(openPluginsDrawer());
  };

  const openDrawerExport = (): void => {
    dispatch(openDrawer('export'));
  };

  const openDrawerLegend = (): void => {
    dispatch(openLegend());
  const openModalLogin = (): void => {
    dispatch(openLoginModal());
  };

    <div className="flex min-h-full w-[88px] flex-col items-center justify-between overflow-y-auto bg-cultured py-8">
      <div data-testid="nav-buttons">
        <div className="mb-8 flex flex-col gap-[10px]">
          <IconButton icon="info" onClick={openDrawerInfo} title="Project info" />
          <a href={API_DOCS_URL} target="_blank">
            <IconButton icon="page" title="API Doc" />
          </a>
          <IconButton icon="plugin" onClick={openDrawerPlugins} title="Available plugins" />
          <IconButton icon="export" onClick={openDrawerExport} title="Export" />
        </div>
        <div className="flex flex-col gap-[10px]">
          <IconButton icon="admin" onClick={openModalLogin} title="Login" />
          <IconButton icon="legend" onClick={openDrawerLegend} title="Legend" />
      <div className="flex flex-col items-center gap-[20px]" data-testid="nav-logos-and-powered-by">
        <Image
          className="rounded rounded-e rounded-s bg-white-pearl pb-[7px]"
          src={luxembourgLogoImg}
          alt="luxembourg logo"
          height={41}
          width={48}
        />
        <Image src={logoImg} alt="logo" height={48} width={48} />
        <span className="h-16 w-14 text-center text-[8px] leading-4">
          Powered by: MINERVA Platform{' '}
          <a href={MINERVA_WEBSITE_URL} target="_blank">
            (v16.0.8)
          </a>