33import { useCallback , useEffect , useLayoutEffect , useRef , useState } from 'react'
44import { createLogger } from '@sim/logger'
55import { useParams , useRouter } from 'next/navigation'
6- import { Skeleton } from '@/components/emcn'
76import { PanelLeft } from '@/components/emcn/icons'
87import { getDocumentIcon } from '@/components/icons/document-icons'
98import { useSession } from '@/lib/auth/auth-client'
@@ -46,23 +45,6 @@ function FileAttachmentPill({ mediaType, filename }: FileAttachmentPillProps) {
4645 )
4746}
4847
49- const SKELETON_LINE_COUNT = 4
50-
51- function ChatSkeleton ( { children } : { children : React . ReactNode } ) {
52- return (
53- < div className = 'flex h-full flex-col bg-[var(--bg)]' >
54- < div className = 'min-h-0 flex-1 overflow-hidden px-6 py-4' >
55- < div className = 'mx-auto max-w-[42rem] space-y-[10px] pt-3' >
56- { Array . from ( { length : SKELETON_LINE_COUNT } ) . map ( ( _ , i ) => (
57- < Skeleton key = { i } className = 'h-[16px]' style = { { width : `${ 120 + ( i % 4 ) * 48 } px` } } />
58- ) ) }
59- </ div >
60- </ div >
61- < div className = 'flex-shrink-0 px-[24px] pb-[16px]' > { children } </ div >
62- </ div >
63- )
64- }
65-
6648interface HomeProps {
6749 chatId ?: string
6850}
@@ -77,6 +59,8 @@ export function Home({ chatId }: HomeProps = {}) {
7759 const templateRef = useRef < HTMLDivElement > ( null )
7860 const baseInputHeightRef = useRef < number | null > ( null )
7961
62+ const [ isInputEntering , setIsInputEntering ] = useState ( false )
63+
8064 const createWorkflowFromLandingSeed = useCallback (
8165 async ( seed : LandingWorkflowSeed ) => {
8266 try {
@@ -150,7 +134,7 @@ export function Home({ chatId }: HomeProps = {}) {
150134
151135 const wasSendingRef = useRef ( false )
152136
153- const { isLoading : isLoadingHistory } = useChatHistory ( chatId )
137+ useChatHistory ( chatId )
154138 const { mutate : markRead } = useMarkTaskRead ( workspaceId )
155139
156140 const [ isResourceCollapsed , setIsResourceCollapsed ] = useState ( true )
@@ -177,7 +161,6 @@ export function Home({ chatId }: HomeProps = {}) {
177161 const {
178162 messages,
179163 isSending,
180- isReconnecting,
181164 sendMessage,
182165 stopGeneration,
183166 resolvedChatId,
@@ -245,6 +228,11 @@ export function Home({ chatId }: HomeProps = {}) {
245228 ( text : string , fileAttachments ?: FileAttachmentForApi [ ] , contexts ?: ChatContext [ ] ) => {
246229 const trimmed = text . trim ( )
247230 if ( ! trimmed && ! ( fileAttachments && fileAttachments . length > 0 ) ) return
231+
232+ if ( initialViewInputRef . current ) {
233+ setIsInputEntering ( true )
234+ }
235+
248236 sendMessage ( trimmed || 'Analyze the attached file(s).' , fileAttachments , contexts )
249237 } ,
250238 [ sendMessage ]
@@ -339,22 +327,7 @@ export function Home({ chatId }: HomeProps = {}) {
339327 return ( ) => ro . disconnect ( )
340328 } , [ hasMessages ] )
341329
342- if ( chatId && ( isLoadingHistory || isReconnecting ) ) {
343- return (
344- < ChatSkeleton >
345- < UserInput
346- onSubmit = { handleSubmit }
347- isSending = { isSending }
348- onStopGeneration = { stopGeneration }
349- isInitialView = { false }
350- userId = { session ?. user ?. id }
351- onContextAdd = { handleContextAdd }
352- />
353- </ ChatSkeleton >
354- )
355- }
356-
357- if ( ! hasMessages ) {
330+ if ( ! hasMessages && ! chatId ) {
358331 return (
359332 < div className = 'h-full overflow-y-auto bg-[var(--bg)] [scrollbar-gutter:stable]' >
360333 < div className = 'flex min-h-full flex-col items-center justify-center px-[24px] pb-[2vh]' >
@@ -451,7 +424,10 @@ export function Home({ chatId }: HomeProps = {}) {
451424 </ div >
452425 </ div >
453426
454- < div className = 'flex-shrink-0 px-[24px] pb-[16px]' >
427+ < div
428+ className = { `flex-shrink-0 px-[24px] pb-[16px]${ isInputEntering ? ' animate-slide-in-bottom' : '' } ` }
429+ onAnimationEnd = { isInputEntering ? ( ) => setIsInputEntering ( false ) : undefined }
430+ >
455431 < div className = 'mx-auto max-w-[42rem]' >
456432 < QueuedMessages
457433 messageQueue = { messageQueue }
0 commit comments