import { useStore } from '@nanostores/react'; import { workbenchStore } from '~/lib/stores/workbench'; import { useState } from 'react'; import { streamingState } from '~/lib/stores/streaming'; import { ExportChatButton } from '~/components/chat/chatExportAndImport/ExportChatButton'; import { useChatHistory } from '~/lib/persistence'; import { DeployButton } from '~/components/deploy/DeployButton'; interface HeaderActionButtonsProps { chatStarted: boolean; } export function HeaderActionButtons({ chatStarted }: HeaderActionButtonsProps) { const [activePreviewIndex] = useState(0); const previews = useStore(workbenchStore.previews); const activePreview = previews[activePreviewIndex]; const isStreaming = useStore(streamingState); const { exportChat } = useChatHistory(); const shouldShowButtons = !isStreaming && activePreview; return (
{chatStarted && shouldShowButtons && } {shouldShowButtons && }
); }