diff --git a/web/src/components/features/layouts/AppVerticalCodeSplitter/DiffSQLContainer.tsx b/web/src/components/features/layouts/AppVerticalCodeSplitter/DiffSQLContainer.tsx index 36c68dfc8..5e817acba 100644 --- a/web/src/components/features/layouts/AppVerticalCodeSplitter/DiffSQLContainer.tsx +++ b/web/src/components/features/layouts/AppVerticalCodeSplitter/DiffSQLContainer.tsx @@ -4,7 +4,7 @@ import { Command, ReturnKey } from '@/components/ui/icons'; import { useBusterNotifications } from '@/context/BusterNotifications'; import { useMemoizedFn } from '@/hooks'; import { Button } from '@/components/ui/buttons/Button'; -import React, { useState } from 'react'; +import React, { useMemo, useState } from 'react'; import type { AppVerticalCodeSplitterProps } from './AppVerticalCodeSplitter'; import { cn } from '@/lib/classMerge'; import { ErrorClosableContainer } from '@/components/ui/error/ErrorClosableContainer'; @@ -12,6 +12,7 @@ import { AppDiffCodeEditor } from '@/components/ui/inputs'; import { Copy2 } from '@/components/ui/icons'; import { Text } from '@/components/ui/typography'; import { VersionPill } from '@/components/ui/tags/VersionPill'; +import { FileCard } from '@/components/ui/card/FileCard'; export const DiffSQLContainer: React.FC<{ className?: string; @@ -54,19 +55,22 @@ export const DiffSQLContainer: React.FC<{ }); return ( -
( +
-
- - -
- {onSaveSQL && ( - - )} - -
- }> - Run - -
- - {error && } - - + ); } ); diff --git a/web/src/components/ui/card/FileCard.tsx b/web/src/components/ui/card/FileCard.tsx index 1cb4b49ca..9fef3b277 100644 --- a/web/src/components/ui/card/FileCard.tsx +++ b/web/src/components/ui/card/FileCard.tsx @@ -23,21 +23,27 @@ export const FileCard = React.memo( footer, footerClassName }: FileCardProps) => { + const showHeader = !!fileName || !!headerButtons; + return ( - -
- {fileName} -
{headerButtons}
-
-
+ {showHeader && ( + +
+ {typeof fileName === 'string' ? {fileName} : fileName} +
{headerButtons}
+
+
+ )} {children} - {footer} + {footer && ( + {footer} + )}
); } diff --git a/web/src/components/ui/streaming/StreamingMessageCode/StreamingMessageCode.tsx b/web/src/components/ui/streaming/StreamingMessageCode/StreamingMessageCode.tsx index fa7b72adb..bcea21ec1 100644 --- a/web/src/components/ui/streaming/StreamingMessageCode/StreamingMessageCode.tsx +++ b/web/src/components/ui/streaming/StreamingMessageCode/StreamingMessageCode.tsx @@ -10,8 +10,7 @@ import { AnimatePresence, motion } from 'framer-motion'; import { Text } from '@/components/ui/typography'; import pluralize from 'pluralize'; import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'; -import { StreamingMessageCodeTitle } from './StreamingMessageCodeTitle'; -import { TextDotLoader } from '../../loaders/PulseLoader'; +import { TextAndVersionPill } from '../../typography/TextAndVersionPill'; const style = SyntaxHighlighterLightTheme; @@ -120,7 +119,7 @@ export const StreamingMessageCode: React.FC< return ( } + title={} language={'yaml'} showCopyButton={false} buttons={buttons}> diff --git a/web/src/components/ui/streaming/StreamingMessageCode/StreamingMessageCodeTitle.tsx b/web/src/components/ui/streaming/StreamingMessageCode/StreamingMessageCodeTitle.tsx deleted file mode 100644 index 046c75a55..000000000 --- a/web/src/components/ui/streaming/StreamingMessageCode/StreamingMessageCodeTitle.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import React from 'react'; -import { Text } from '@/components/ui/typography'; -import { VersionPill } from '@/components/ui/tags/VersionPill'; - -export const StreamingMessageCodeTitle = React.memo( - ({ file_name, version_number }: { file_name: string; version_number: number }) => { - return ( -
- {file_name} - {version_number && } -
- ); - } -); - -StreamingMessageCodeTitle.displayName = 'StreamingMessageCodeTitle'; diff --git a/web/src/components/ui/typography/TextAndVersionPill.tsx b/web/src/components/ui/typography/TextAndVersionPill.tsx new file mode 100644 index 000000000..4f9fbb1b9 --- /dev/null +++ b/web/src/components/ui/typography/TextAndVersionPill.tsx @@ -0,0 +1,16 @@ +import { VersionPill } from '../tags/VersionPill'; +import React from 'react'; +import { Text } from './Text'; + +export const TextAndVersionPill = React.memo( + ({ fileName, versionNumber }: { fileName: string; versionNumber: number }) => { + return ( +
+ {fileName} + {versionNumber !== undefined && } +
+ ); + } +); + +TextAndVersionPill.displayName = 'TextAndVersionPill'; diff --git a/web/src/layouts/ChatLayout/ChatContainer/ChatContent/ChatResponseMessages/ChatResponseMessage_File/ChatResponseMessage_File.tsx b/web/src/layouts/ChatLayout/ChatContainer/ChatContent/ChatResponseMessages/ChatResponseMessage_File/ChatResponseMessage_File.tsx index 83e0371a1..e5933397f 100644 --- a/web/src/layouts/ChatLayout/ChatContainer/ChatContent/ChatResponseMessages/ChatResponseMessage_File/ChatResponseMessage_File.tsx +++ b/web/src/layouts/ChatLayout/ChatContainer/ChatContent/ChatResponseMessages/ChatResponseMessage_File/ChatResponseMessage_File.tsx @@ -15,6 +15,7 @@ import { useChatLayoutContextSelector } from '@/layouts/ChatLayout'; import Link from 'next/link'; import { createBusterRoute, BusterRoutes } from '@/routes'; import { useRouter } from 'next/navigation'; +import { TextAndVersionPill } from '@/components/ui/typography/TextAndVersionPill'; export const ChatResponseMessage_File: React.FC = React.memo( ({ isCompletedStream, chatId, responseMessageId, messageId }) => { @@ -78,9 +79,8 @@ ChatResponseMessage_File.displayName = 'ChatResponseMessage_File'; const ChatResponseMessageHeader: React.FC<{ file_name: string; version_number: number }> = React.memo(({ file_name, version_number }) => { return ( -
- {file_name} - +
+
); });