@@ -69,6 +69,7 @@ const ThreadPreview = ({ threadId }: { threadId: string }) => {
6969} ;
7070
7171const ExampleQueries = ( { onQueryClick } : { onQueryClick : ( query : string ) => void } ) => {
72+
7273 const firstRowQueries = [
7374 'Find invoice from Stripe' ,
7475 'Show unpaid invoices' ,
@@ -78,22 +79,20 @@ const ExampleQueries = ({ onQueryClick }: { onQueryClick: (query: string) => voi
7879 const secondRowQueries = [ 'Find all work meetings' , 'What projects do i have coming up' ] ;
7980
8081 return (
81- < div className = "horizontal-fade-mask mt-6 flex w-full flex-col items-center gap-2" >
82+ < div className = "mt-6 flex w-full max-w-xl relative flex-col items-center gap-2" >
8283 { /* First row */ }
8384 < div className = "no-scrollbar relative flex w-full justify-center overflow-x-auto" >
8485 < div className = "flex gap-4 px-4" >
8586 { firstRowQueries . map ( ( query ) => (
8687 < button
8788 key = { query }
8889 onClick = { ( ) => onQueryClick ( query ) }
89- className = "flex-shrink-0 whitespace-nowrap rounded-md bg-[#f0f0f0] p-1 px-2 text-sm text-[#555555] dark:bg-[#262626] dark:text-[#929292]"
90- >
90+ className = "flex-shrink-0 whitespace-nowrap rounded-md bg-[#f0f0f0] p-1 px-2 text-sm text-[#555555] dark:bg-[#262626] dark:text-[#929292]" >
9191 { query }
9292 </ button >
9393 ) ) }
9494 </ div >
9595 </ div >
96-
9796 { /* Second row */ }
9897 < div className = "no-scrollbar relative flex w-full justify-center overflow-x-auto" >
9998 < div className = "flex gap-4 px-4" >
@@ -108,6 +107,10 @@ const ExampleQueries = ({ onQueryClick }: { onQueryClick: (query: string) => voi
108107 ) ) }
109108 </ div >
110109 </ div >
110+ { /* Left mask */ }
111+ < div className = "from-panelLight dark:from-panelDark pointer-events-none absolute bottom-0 left-0 top-0 w-12 bg-gradient-to-r to-transparent" > </ div >
112+ { /* Right mask */ }
113+ < div className = "from-panelLight dark:from-panelDark pointer-events-none absolute bottom-0 right-0 top-0 w-12 bg-gradient-to-l to-transparent" > </ div >
111114 </ div >
112115 ) ;
113116} ;
@@ -198,7 +201,6 @@ export function AIChat({
198201} : AIChatProps ) : React . ReactElement {
199202 const messagesEndRef = useRef < HTMLDivElement > ( null ) ;
200203 const messagesContainerRef = useRef < HTMLDivElement > ( null ) ;
201- const inputRef = useRef < HTMLInputElement > ( null ) ;
202204 const { chatMessages } = useBilling ( ) ;
203205 const { isFullScreen } = useAIFullScreen ( ) ;
204206 const [ , setPricingDialog ] = useQueryState ( 'pricingDialog' ) ;
@@ -240,6 +242,12 @@ export function AIChat({
240242 } , 100 ) ;
241243 } ;
242244
245+ const handleQueryClick = ( query : string ) => {
246+ editor . commands . setContent ( query ) ;
247+ setInput ( query ) ;
248+ editor . commands . focus ( ) ;
249+ } ;
250+
243251 useEffect ( ( ) => {
244252 if ( aiSidebarOpen === 'true' ) {
245253 editor . commands . focus ( ) ;
@@ -252,13 +260,13 @@ export function AIChat({
252260 < div className = "min-h-full px-2 py-4" >
253261 { chatMessages && ! chatMessages . enabled ? (
254262 < div
255- onClick = { ( ) => setPricingDialog ( 'true' ) }
256- className = "absolute inset-0 flex flex-col items-center justify-center"
257- >
258- < TextShimmer className = "text-center text-xl font-medium" >
259- Upgrade to Zero Pro for unlimited AI chat
260- </ TextShimmer >
261- < Button className = "mt-2 h-8 w-52" > Start 7 day free trial</ Button >
263+ onClick = { ( ) => setPricingDialog ( 'true' ) }
264+ className = "absolute inset-0 flex flex-col items-center justify-center"
265+ >
266+ < TextShimmer className = "text-center text-xl font-medium" >
267+ Upgrade to Zero Pro for unlimited AI chat
268+ </ TextShimmer >
269+ < Button className = "mt-2 h-8 w-52" > Start 7 day free trial</ Button >
262270 </ div >
263271 ) : ! messages . length ? (
264272 < div className = "absolute inset-0 flex flex-col items-center justify-center" >
@@ -274,12 +282,7 @@ export function AIChat({
274282 </ p >
275283
276284 { /* Example Thread */ }
277- < ExampleQueries
278- onQueryClick = { ( query ) => {
279- setInput ( query ) ;
280- inputRef . current ?. focus ( ) ;
281- } }
282- />
285+ < ExampleQueries onQueryClick = { handleQueryClick } />
283286 </ div >
284287 ) : (
285288 messages . map ( ( message , index ) => {
@@ -399,7 +402,7 @@ export function AIChat({
399402 </ div >
400403 </ div >
401404
402- { /* <div className="flex items-center justify-end gap-1">
405+ { /* <div className="flex items-center justify-end gap-1">
403406 <div className="mt-1 flex items-center justify-end relative z-10">
404407 <Select
405408
0 commit comments