Add better generating content

This commit is contained in:
Nate Kelley 2025-09-09 09:50:27 -06:00
parent 7f43a92de3
commit cadbb3de77
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
2 changed files with 30 additions and 9 deletions

View File

@ -1,10 +1,28 @@
import { AnimatePresence, motion } from 'framer-motion';
import { ShimmerText } from '@/components/ui/typography/ShimmerText';
import { cn } from '@/lib/classMerge';
export const GeneratingContent = ({ className }: { messageId: string; className?: string }) => {
export const GeneratingContent = ({
className,
show,
}: {
messageId: string;
className?: string;
show: boolean;
}) => {
return (
<div className={cn('right-0 bottom-0 left-0 -mt-68', className)}>
<ShimmerText text="Generating..." className="text-lg" />
</div>
<AnimatePresence mode="wait">
{show && (
<motion.div
className={cn('right-0 bottom-0 left-0 absolute translate-y-[-255px]', className)}
initial={{ opacity: 0, y: -3 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: -3 }}
transition={{ duration: 0.12, delay: 0.15 }}
>
<ShimmerText text="Generating..." fontSize={15} />
</motion.div>
)}
</AnimatePresence>
);
};

View File

@ -16,6 +16,8 @@ import { useGetCurrentMessageId, useIsStreamingMessage } from '../../context/Cha
import { GeneratingContent } from './GeneratingContent';
import { ReportPageHeader } from './ReportPageHeader';
const commonClassName = 'sm:px-[max(64px,calc(50%-350px))]';
export const ReportPageController: React.FC<{
reportId: string;
readOnly?: boolean;
@ -47,8 +49,7 @@ export const ReportPageController: React.FC<{
}, [currentMessage, isStreamingMessage, messageId, reportId]);
const content = report?.content || '';
const showGeneratingContent = isThisReportBeingGenerated;
const commonClassName = 'sm:px-[max(64px,calc(50%-350px))]';
const showGeneratingContent = isThisReportBeingGenerated || true;
const { mutate: updateReport } = useUpdateReport();
@ -123,9 +124,11 @@ export const ReportPageController: React.FC<{
/>
}
postEditorChildren={
showGeneratingContent ? (
<GeneratingContent messageId={messageId || ''} className={commonClassName} />
) : null
<GeneratingContent
messageId={messageId || ''}
className={commonClassName}
show={showGeneratingContent}
/>
}
/>
) : (