diff --git a/apps/web/src/components/ui/report/Editor.tsx b/apps/web/src/components/ui/report/Editor.tsx index b5ef1392e..6b2496e48 100644 --- a/apps/web/src/components/ui/report/Editor.tsx +++ b/apps/web/src/components/ui/report/Editor.tsx @@ -40,7 +40,7 @@ const editorVariants = cva( export type EditorProps = PlateContentProps & VariantProps; export const Editor = React.forwardRef( - ({ className, readOnly, focused, variant, ...props }, ref) => { + ({ className, disabled, focused, variant, readOnly, ...props }, ref) => { return ( ; @@ -57,7 +59,8 @@ export const ReportEditor = React.memo( useFixedToolbarKit = false, readOnly = false, isStreaming = false, - children + children, + postEditorChildren }, ref ) => { @@ -133,6 +136,7 @@ export const ReportEditor = React.memo( autoFocus /> + {postEditorChildren} ); diff --git a/apps/web/src/components/ui/report/ThemeWrapper/ThemeWrapper.tsx b/apps/web/src/components/ui/report/ThemeWrapper/ThemeWrapper.tsx index 449590600..58c8f180f 100644 --- a/apps/web/src/components/ui/report/ThemeWrapper/ThemeWrapper.tsx +++ b/apps/web/src/components/ui/report/ThemeWrapper/ThemeWrapper.tsx @@ -46,18 +46,11 @@ const EDITOR_THEME = { ...CSS_VARIABLES_THEME, ...THEME_RESET_STYLE }; export function ThemeWrapper({ children, className, defaultTheme, id }: ThemeWrapperProps) { return ( - <> -
- {children} -
- - {/* */} - +
+ {children} +
); } diff --git a/apps/web/src/controllers/ReportPageControllers/GeneratingContent.tsx b/apps/web/src/controllers/ReportPageControllers/GeneratingContent.tsx new file mode 100644 index 000000000..b533f73dd --- /dev/null +++ b/apps/web/src/controllers/ReportPageControllers/GeneratingContent.tsx @@ -0,0 +1,27 @@ +import { queryKeys } from '@/api/query_keys'; +import { ShimmerText } from '@/components/ui/typography/ShimmerText'; +import { cn } from '@/lib/classMerge'; +import { useQuery } from '@tanstack/react-query'; + +export const GeneratingContent = ({ + messageId, + className +}: { + messageId: string; + className?: string; +}) => { + const { data: text } = useQuery({ + ...queryKeys.chatsBlackBoxMessages(messageId), + notifyOnChangeProps: ['data'], + select: (data) => data + }); + + return ( +
+
+ +
+
+ ); +}; diff --git a/apps/web/src/controllers/ReportPageControllers/ReportPageController.tsx b/apps/web/src/controllers/ReportPageControllers/ReportPageController.tsx index d7f1429d5..2702b552c 100644 --- a/apps/web/src/controllers/ReportPageControllers/ReportPageController.tsx +++ b/apps/web/src/controllers/ReportPageControllers/ReportPageController.tsx @@ -10,6 +10,8 @@ import { type IReportEditor } from '@/components/ui/report/ReportEditor'; import { ReportEditorSkeleton } from '@/components/ui/report/ReportEditorSkeleton'; import { useChatIndividualContextSelector } from '@/layouts/ChatLayout/ChatContext'; import { useTrackAndUpdateReportChanges } from '@/api/buster-electric/reports/hooks'; +import { ShimmerText } from '@/components/ui/typography/ShimmerText'; +import { GeneratingContent } from './GeneratingContent'; import { useHotkeys } from 'react-hotkeys-hook'; export const ReportPageController: React.FC<{ @@ -21,28 +23,13 @@ export const ReportPageController: React.FC<{ }> = React.memo( ({ reportId, readOnly = false, className = '', onReady: onReadyProp, mode = 'default' }) => { const { data: report } = useGetReport({ reportId, versionNumber: undefined }); - let isStreamingMessage = useChatIndividualContextSelector((x) => x.isStreamingMessage); + const isStreamingMessage = useChatIndividualContextSelector((x) => x.isStreamingMessage); + const messageId = useChatIndividualContextSelector((x) => x.currentMessageId); const content = report?.content || ''; + const showGeneratingContent = messageId && isStreamingMessage; const commonClassName = 'sm:px-[max(64px,calc(50%-350px))]'; - const [useOverride, setUseOverride] = React.useState(false); - - useHotkeys('x', () => { - setUseOverride((v) => { - console.log('x', !v); - return !v; - }); - }); - - if (useOverride) { - isStreamingMessage = true; - readOnly = true; - } else { - isStreamingMessage = false; - readOnly = false; - } - const { mutate: updateReport } = useUpdateReport(); const canUpdate = () => { @@ -85,7 +72,12 @@ export const ReportPageController: React.FC<{ readOnly={readOnly || !report} mode={mode} onReady={onReadyProp} - isStreaming={isStreamingMessage}> + isStreaming={isStreamingMessage} + postEditorChildren={ + showGeneratingContent ? ( + + ) : null + }>