bolt.diy/app/layout/header/components/HeaderActionButtons.client.tsx
KevIsDev 4d3222ee96 refactor: reorganize project structure by moving files to a more dev friendly setup
- 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
2025-06-16 15:33:59 +01:00

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>
);
}