All files / src/components/assistant AiAssistantNavbar.tsx

71.42% Statements 5/7
50% Branches 1/2
33.33% Functions 1/3
71.42% Lines 5/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64                              1x   4x 4x 4x 4x                                                                                      
import React, { ReactElement } from "react";
import {
  MinusOutlined, SwapOutlined, QuestionCircleOutlined
} from "@ant-design/icons";
import { Trans, useTranslation } from "react-i18next";
import { Space, Tooltip } from "antd";
import { DisplayMode } from "@props/RecordProps";
 
export interface AiAssistantNavbarProps {
  loading: boolean;
  zIndex: number;
  handleSetConversationBarrier: () => void;
  setDisplay: (display: DisplayMode) => void;
}
 
const AiAssistantNavbar = (props: AiAssistantNavbarProps): ReactElement => {
 
  const { loading, zIndex, handleSetConversationBarrier, setDisplay } = props;
  const { t } = useTranslation();
  const style = { cursor: "pointer", zIndex: zIndex + 1 };
  return <div
    className="Navbar"
    style={{
      display: "flex",
      flexDirection: "row",
      justifyContent: "center",
    }}
  >
    <div>
      {!loading && (
        <Space>
          <Tooltip
            title={<Trans i18nKey="assistant:Usage instructions" />}
            placement="leftBottom"
            overlayStyle={{maxWidth: '420px'}}
            zIndex={zIndex + 1}
          >
            <QuestionCircleOutlined style={style} />
          </Tooltip>
          <SwapOutlined
            style={style}
            title={t("assistant:Start a new conversation")}
            onClick={() => handleSetConversationBarrier()}
          />
        </Space>
      )}
    </div>
    <div className="Navbar-main">
      <h2 className="Navbar-title">
        {t("assistant:Ai Assistant")}
      </h2>
    </div>
    <div>
      <MinusOutlined
        style={style}
        onClick={() => setDisplay("minimal")}
        title={t("assistant:Close assistant")}
      />
    </div>
  </div>;
};
 
export default AiAssistantNavbar;