import { Fragment } from 'react' import { Button } from '@janhq/joi' import { useAtom, useAtomValue, useSetAtom } from 'jotai' import { PanelLeftCloseIcon, PanelLeftOpenIcon, PanelRightOpenIcon, PanelRightCloseIcon, MinusIcon, MenuIcon, SquareIcon, PaletteIcon, XIcon, PenSquareIcon, } from 'lucide-react' import { twMerge } from 'tailwind-merge' import LogoMark from '@/containers/Brand/Logo/Mark' import { toaster } from '@/containers/Toast' import { MainViewState } from '@/constants/screens' import { useCreateNewThread } from '@/hooks/useCreateNewThread' import { mainViewStateAtom, showLeftPanelAtom, showRightPanelAtom, } from '@/helpers/atoms/App.atom' import { assistantsAtom } from '@/helpers/atoms/Assistant.atom' import { reduceTransparentAtom, selectedSettingAtom, } from '@/helpers/atoms/Setting.atom' const TopPanel = () => { const [showLeftPanel, setShowLeftPanel] = useAtom(showLeftPanelAtom) const [showRightPanel, setShowRightPanel] = useAtom(showRightPanelAtom) const [mainViewState, setMainViewState] = useAtom(mainViewStateAtom) const setSelectedSetting = useSetAtom(selectedSettingAtom) const reduceTransparent = useAtomValue(reduceTransparentAtom) const { requestCreateNewThread } = useCreateNewThread() const assistants = useAtomValue(assistantsAtom) const onCreateNewThreadClick = () => { if (!assistants.length) return toaster({ title: 'No assistant available.', description: `Could not create a new thread. Please add an assistant.`, type: 'error', }) requestCreateNewThread(assistants[0]) } return (