@@ -31,6 +31,8 @@ import { expoUrlAtom } from '~/lib/stores/qrCodeStore';
3131import { useStore } from '@nanostores/react' ;
3232import { StickToBottom , useStickToBottomContext } from '~/lib/hooks' ;
3333import { ChatBox } from './ChatBox' ;
34+ import type { DesignScheme } from '~/types/design-scheme' ;
35+ import type { ElementInfo } from '~/components/workbench/Inspector' ;
3436
3537const TEXTAREA_MIN_HEIGHT = 76 ;
3638
@@ -73,6 +75,10 @@ interface BaseChatProps {
7375 chatMode ?: 'discuss' | 'build' ;
7476 setChatMode ?: ( mode : 'discuss' | 'build' ) => void ;
7577 append ?: ( message : Message ) => void ;
78+ designScheme ?: DesignScheme ;
79+ setDesignScheme ?: ( scheme : DesignScheme ) => void ;
80+ selectedElement ?: ElementInfo | null ;
81+ setSelectedElement ?: ( element : ElementInfo | null ) => void ;
7682}
7783
7884export const BaseChat = React . forwardRef < HTMLDivElement , BaseChatProps > (
@@ -114,6 +120,10 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
114120 chatMode,
115121 setChatMode,
116122 append,
123+ designScheme,
124+ setDesignScheme,
125+ selectedElement,
126+ setSelectedElement,
117127 } ,
118128 ref ,
119129 ) => {
@@ -253,6 +263,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
253263 const handleSendMessage = ( event : React . UIEvent , messageInput ?: string ) => {
254264 if ( sendMessage ) {
255265 sendMessage ( event , messageInput ) ;
266+ setSelectedElement ?.( null ) ;
256267
257268 if ( recognition ) {
258269 recognition . abort ( ) ; // Stop current recognition
@@ -332,7 +343,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
332343 < div className = "flex flex-col lg:flex-row overflow-y-auto w-full h-full" >
333344 < div className = { classNames ( styles . Chat , 'flex flex-col flex-grow lg:min-w-[var(--chat-min-width)] h-full' ) } >
334345 { ! chatStarted && (
335- < div id = "intro" className = "mt-[16vh] max-w-chat mx-auto text-center px-4 lg:px-0" >
346+ < div id = "intro" className = "mt-[16vh] max-w-2xl mx-auto text-center px-4 lg:px-0" >
336347 < h1 className = "text-3xl lg:text-6xl font-bold text-bolt-elements-textPrimary mb-4 animate-fade-in" >
337348 Where ideas begin
338349 </ h1 >
@@ -348,12 +359,12 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
348359 resize = "smooth"
349360 initial = "smooth"
350361 >
351- < StickToBottom . Content className = "flex flex-col gap-4" >
362+ < StickToBottom . Content className = "flex flex-col gap-4 relative " >
352363 < ClientOnly >
353364 { ( ) => {
354365 return chatStarted ? (
355366 < Messages
356- className = "flex flex-col w-full flex-1 max-w-chat pb-6 mx-auto z-1"
367+ className = "flex flex-col w-full flex-1 max-w-chat pb-4 mx-auto z-1"
357368 messages = { messages }
358369 isStreaming = { isStreaming }
359370 append = { append }
@@ -365,6 +376,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
365376 ) : null ;
366377 } }
367378 </ ClientOnly >
379+ < ScrollToBottom />
368380 </ StickToBottom . Content >
369381 < div
370382 className = { classNames ( 'my-auto flex flex-col gap-2 w-full max-w-chat mx-auto z-prompt mb-6' , {
@@ -403,7 +415,6 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
403415 />
404416 ) }
405417 </ div >
406- < ScrollToBottom />
407418 { progressAnnotations && < ProgressCompilation data = { progressAnnotations } /> }
408419 < ChatBox
409420 isModelSettingsCollapsed = { isModelSettingsCollapsed }
@@ -442,6 +453,10 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
442453 handleFileUpload = { handleFileUpload }
443454 chatMode = { chatMode }
444455 setChatMode = { setChatMode }
456+ designScheme = { designScheme }
457+ setDesignScheme = { setDesignScheme }
458+ selectedElement = { selectedElement }
459+ setSelectedElement = { setSelectedElement }
445460 />
446461 </ div >
447462 </ StickToBottom >
@@ -472,6 +487,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
472487 actionRunner = { actionRunner ?? ( { } as ActionRunner ) }
473488 chatStarted = { chatStarted }
474489 isStreaming = { isStreaming }
490+ setSelectedElement = { setSelectedElement }
475491 />
476492 ) }
477493 </ ClientOnly >
@@ -488,13 +504,16 @@ function ScrollToBottom() {
488504
489505 return (
490506 ! isAtBottom && (
491- < button
492- className = "absolute z-50 top-[0%] translate-y-[-100%] text-4xl rounded-lg left-[50%] translate-x-[-50%] px-1.5 py-0.5 flex items-center gap-2 bg-bolt-elements-background-depth-3 border border-bolt-elements-borderColor text-bolt-elements-textPrimary text-sm"
493- onClick = { ( ) => scrollToBottom ( ) }
494- >
495- Go to last message
496- < span className = "i-ph:arrow-down animate-bounce" />
497- </ button >
507+ < >
508+ < div className = "sticky bottom-0 left-0 right-0 bg-gradient-to-t from-bolt-elements-background-depth-1 to-transparent h-20 z-10" />
509+ < button
510+ className = "sticky z-50 bottom-0 left-0 right-0 text-4xl rounded-lg px-1.5 py-0.5 flex items-center justify-center mx-auto gap-2 bg-bolt-elements-background-depth-2 border border-bolt-elements-borderColor text-bolt-elements-textPrimary text-sm"
511+ onClick = { ( ) => scrollToBottom ( ) }
512+ >
513+ Go to last message
514+ < span className = "i-ph:arrow-down animate-bounce" />
515+ </ button >
516+ </ >
498517 )
499518 ) ;
500519}
0 commit comments