| return null | return null | ||||
| if (welcomeMessage.suggestedQuestions && welcomeMessage.suggestedQuestions?.length > 0) { | if (welcomeMessage.suggestedQuestions && welcomeMessage.suggestedQuestions?.length > 0) { | ||||
| return ( | return ( | ||||
| <div className='flex h-[50vh] items-center justify-center px-4 py-12'> | |||||
| <div className='flex min-h-[50vh] items-center justify-center px-4 py-12'> | |||||
| <div className='flex max-w-[720px] grow gap-4'> | <div className='flex max-w-[720px] grow gap-4'> | ||||
| <AppIcon | <AppIcon | ||||
| size='xl' | size='xl' | ||||
| background={appData?.site.icon_background} | background={appData?.site.icon_background} | ||||
| imageUrl={appData?.site.icon_url} | imageUrl={appData?.site.icon_url} | ||||
| /> | /> | ||||
| <div className='body-lg-regular grow rounded-2xl bg-chat-bubble-bg px-4 py-3 text-text-primary'> | |||||
| <Markdown content={welcomeMessage.content} /> | |||||
| <SuggestedQuestions item={welcomeMessage} /> | |||||
| <div className='w-0 grow'> | |||||
| <div className='body-lg-regular grow rounded-2xl bg-chat-bubble-bg px-4 py-3 text-text-primary'> | |||||
| <Markdown content={welcomeMessage.content} /> | |||||
| <SuggestedQuestions item={welcomeMessage} /> | |||||
| </div> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> |
| import type { ChatItem } from '../../types' | import type { ChatItem } from '../../types' | ||||
| import { useChatContext } from '../context' | import { useChatContext } from '../context' | ||||
| import Button from '@/app/components/base/button' | import Button from '@/app/components/base/button' | ||||
| import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints' | |||||
| type SuggestedQuestionsProps = { | type SuggestedQuestionsProps = { | ||||
| item: ChatItem | item: ChatItem | ||||
| item, | item, | ||||
| }) => { | }) => { | ||||
| const { onSend } = useChatContext() | const { onSend } = useChatContext() | ||||
| const media = useBreakpoints() | |||||
| const isMobile = media === MediaType.mobile | |||||
| const klassName = `mr-1 mt-1 ${isMobile ? 'block overflow-hidden text-ellipsis' : ''} max-w-full shrink-0 last:mr-0` | |||||
| const { | const { | ||||
| isOpeningStatement, | isOpeningStatement, | ||||
| suggestedQuestions, | suggestedQuestions, | ||||
| <Button | <Button | ||||
| key={index} | key={index} | ||||
| variant='secondary-accent' | variant='secondary-accent' | ||||
| className='mr-1 mt-1 max-w-full shrink-0 last:mr-0' | |||||
| className={klassName} | |||||
| onClick={() => onSend?.(question)} | onClick={() => onSend?.(question)} | ||||
| > | > | ||||
| {question} | {question} |