mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-06-26 18:26:38 +00:00
- Move stores/utils/types to their relative directories (i.e chat stores in chat directory) - Move utility files to shared/utils - Move component files to shared/components - Move type definitions to shared/types - Move stores to shared/stores - Update import paths across the project
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import { useStore } from '@nanostores/react';
|
|
import { workbenchStore } from '~/shared/workbench/stores/workbench';
|
|
import { useState } from 'react';
|
|
import { streamingState } from '~/shared/stores/streaming';
|
|
import { ExportChatButton } from '~/chat/components/chatExportAndImport/ExportChatButton';
|
|
import { useChatHistory } from '~/shared/lib/persistence';
|
|
import { DeployButton } from '~/layout/header/components/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 (
|
|
<div className="flex items-center">
|
|
{chatStarted && shouldShowButtons && <ExportChatButton exportChat={exportChat} />}
|
|
{shouldShowButtons && <DeployButton />}
|
|
</div>
|
|
);
|
|
}
|